dib-lab / farm-notes

notes on the farm cluster
16 stars 9 forks source link

setting up authentication for static files on farm #48

Open ctb opened 2 years ago

ctb commented 2 years ago

farm supports static file hosting per #43, and it also supports Apache style auth:

https://httpd.apache.org/docs/2.4/howto/auth.html

so you can set up authentication for static file hosting!

important note: the way I've set it up below, anyone with an account on farm will be able to see your stuff. so this is really only useful for things you want to keep secret through obscurity and/or from people outside of UC Davis who won't have farm accounts

I've put an example in /home/ctbrown/public_html/auth; the file .htaccess there contains:

AuthType Basic
AuthName "Restricted Files"
# (Following line optional)
AuthBasicProvider file
AuthUserFile "/home/ctbrown/.apache/passwd.txt"
Require user titus

The file /home/ctbrown/.apache/passwd.txt was created with:

htpasswd -c /home/ctbrown/.apache/passwd.txt titus

et voila! When you go to http://farm.cse.ucdavis.edu/~ctbrown/auth/ you get asked to enter a username and password! (the password is titus - super secure!)

other notes

I don't think it will be possible to support kerberos style UC Davis authentication but could look into it!