#!/usr/local/bin/perl -I. =pod this is a sample AIS "add" program, which will add a sign-on identity to its database or display a log-in page if no "email" variable appears in the CGI data. =cut # look for "email" in CGI data $rawdata = join '', $ENV{QUERY_STRING}, ; ($email) = ($rawdata =~ m/email=([^&]+)/); $email =~ s/%(..)/chr(hex($1))/ge; # look for an e-mail address ($email) = ($email =~ m/([^\s\<\>\@\|]+\@[^\s\<\>\@\|]+)/); unless ($email){ ($SHORT) = $ENV{REQUEST_URI} =~ /(^.+)add/; print <AIS log-in page You do not appear to be logged into the AIS server used by the page you are trying to access.

Please click on the button in your log-in links e-mail, or enter your e-mail address below to receive a new one.

After validation, the e-mail address you provide will be shared with web services that subscribe to the $ENV{SERVER_NAME}${SHORT} authenticated identity service.

What is a good e-mail address for you?
EOF exit; }; use DirDB; # a concurrent-write-safe database :) tie %DATA,'DirDB','data/SSO_keys'; my $SSO_key = join '',time,(map {("A".."Z")[rand 26]} (0..15)), $$; print STDERR "saving $email to $SSO_key\n"; $DATA{$SSO_key} = $email; open(MAIL,"|sendmail -t -i -f 'AIS-bounce-recipient\@$ENV{SERVER_NAME}'"); print MAIL < From: AIS-autoresponder\@$ENV{SERVER_NAME} X-Abuse-To: (tracert $ENV{HTTP_ADDR})\@abuse.net Subject: AIS LOGIN LINKS for $email Content-Type: text/html
To log your web browser into the single sign-on service at $ENV{SERVER_NAME}/cgi/ais/, or click here, if your e-mail software cannot submit a "post" style form submission.

To log your web browser out, click here:

http://$ENV{SERVER_NAME}/cgi/ais/logout

To disable the log-in button in this message click here:

http://$ENV{SERVER_NAME}/cgi/ais/delete?$SSO_key

You appear to have requested this log-in link while using a $ENV{HTTP_USER_AGENT} web browser from IP address $ENV{REMOTE_ADDR}

EOF print < You are connecting from $ENV{REMOTE_ADDR}

A message containing an AIS log-in button has been e-mailed to <$email> EOF __END__