Simple authentication in Squid
I need to run a squid server in order to code and test another program against a proxy. So I downloaded Squid for Windows, configured for running without authentication and everything works. So far so good.
Now I need to setup authentication, and I just need a simple one. First I thought about using the MySQL authentication program - but! I can't find the squid_db_auth compiled for Windows. Does anyone know where to find it, or what other simple authentication do I have for Squid? If I could just configure a login and password that would do the trick.
I finally figured out this. Squid comes with build in basic authentication, and it is easily configured - when you know how to!
First, you need a htpasswd
file to use with ncsa authentication. On Windows, it can be easily created online with this page. I only needed one user called test
with the password test
, so no problem for me giving that to a third party.
Then I found out, googling different pages, that the following addition to squid.conf does the rest.
# In my squid.conf this is the very first uncommented line.
auth_param basic program c:/squid/libexec/ncsa_auth.exe c:/squid/etc/passwd
# The following needs to be in that order and I placed it right after
# the line 'acl CONNECT method CONNECT'
acl ncsa_users proxy_auth REQUIRED
http_access allow ncsa_users
I made no other changes to the default config file.