Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
52 lines (35 sloc) 1.71 KB
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.
- 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)
1) It assumes your nginx supports perl like in
apt-get install nginx libfcgi-perl wget
wget -O /usr/bin/
wget -O /etc/init.d/perl-fcgi
chmod +x /usr/bin/
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/
Something went wrong with that request. Please try again.