Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

52 lines (35 sloc) 1.753 kB
PURPOSE
=======
The point here is to provide a user with valid password, sent by mail,
whenever he fails to access a directory with nginx, in order to access it.
For instance, the user would like to print some crap residing on his
computer from a cybercafé.
Yes, packet sniffing may enable some weirdo to be nasty. GPG signing is
not an option, as it's unlikely the user got his private key in the cybercafé
. I don't think it would be worth it anyway.
The provided password will be valid for only 60 minutes. Obviously no other
mail will be sent during this hour, to avoid to being spam.
CONTAINS
========
- one perl script supposed to run nginx error 401 for the given
directory, send mail and will update the relevant htpasswd accordingly
- one cronfile to empty the htpasswd when invalidated
- one nginx configuration example (to be edited)
INSTALL
=======
1) It assumes your nginx supports perl like in
http://nginxlibrary.com/perl-fastcgi/:
apt-get install nginx libfcgi-perl wget
wget http://nginxlibrary.com/downloads/perl-fcgi/fastcgi-wrapper -O /usr/bin/fastcgi-wrapper.pl
wget http://nginxlibrary.com/downloads/perl-fcgi/perl-fcgi -O /etc/init.d/perl-fcgi
chmod +x /usr/bin/fastcgi-wrapper.pl
chmod +x /etc/init.d/perl-fcgi
update-rc.d perl-fcgi defaults
insserv perl-fcgi
2) Copy and edit the nginx sample and crontab sample into the appropriate places:
- something like /etc/nginx/site-available symlinked to /etc/nginx/site-enabled
- /etc/cron.d/transit
3) Then you must create a group named transit and add to it users that
are entitled to use this.
4) You must also make sure nginx (www-data?) can write to the directory where
you store the .passwd file. In the default case here, it's /etc/nginx/passwd/
Jump to Line
Something went wrong with that request. Please try again.