A few weeks ago, I asked for ideas about an email robot
script to automagically authenticate psu wifi, so that
I enter the robot's address into the PSU guest wifi
request page and let the robot access the URL. 

Almost there!

I would like to figure out how to redirect the email to
the script below.  Pretend the following is (for example)
a line in /etc/postfix/aliases.db that actually executes:

psu: "| /bin/grep https | /bin/sed 
'sX.*\(https://sentinel.net.pdx.edu/activate/email/[0-9a-f]*\).*X/usr/bin/curl 
-s \1X' | /bin/sh > /dev/null"

Where should I actually put this one line script to make
it execute when postfix gets an email to p...@keithl.com ?
What more should I do to secure it against malformed emails
and minimize the script's privileges to the bare minimum?

Keith

P.S.:  how it works:  it uses grep to find the line in the
email (from PSU's authentication bot) with the https link,
then feeds that line into sed to extract the weblink,
which ends with a random hexidecimal number.

I substitute the match "\1" into the string
   /usr/bin/curl -s [matched characters here]
then pipe the string as a command into /bin/sh 
which executes curl.  Results from curl go into
/dev/null .  The -s means curl runs silently,
without displaying download progress.

P.P.S.: Note to evildoers: I will use a different email
address than "p...@keithl.com".  It is true I am lazy,
but I don't want to create extra hassles for PSU if 
some twit starts hammering my mail server.

-- 
Keith Lofstrom          kei...@keithl.com
-----
Don't waste your vote in 2016!  Give it to the Republicans
and Democrats, and they will gladly waste it for you!
_______________________________________________
PLUG mailing list
PLUG@lists.pdxlinux.org
http://lists.pdxlinux.org/mailman/listinfo/plug

Reply via email to