Categories
Linux

Authenticate users in Squid

Few days a go we talk about how to ban sites with squid proxy and today I will make it a bit more complicated adding authentication for users.

This is really useful if you want to be sure that everybody that is using your Proxy is allowed, or is known. Imagine in a internet proxy, everybody could use it, no?

squid

To do this we need: (Be sure you have ncsa_auth and continue)

1. touch /etc/squid/squid_passwd

2. chmod o+r /etc/squid/squid_passwd

3. htpasswd /etc/squid/squid_passwd user

4.Add in squid.conf this auth_param section:

auth_param basic program /usr/lib/squid/ncsa_auth /etc/squid/squid_passwd

5. Add this line at the end of the ACL

acl ncsa_users proxy_auth REQUIRED

6. Add this line as first line in http_access section

http_access allow ncsa_users

8. Save the file

7. squid restart

Done, now every time you want to use the squid proxy user must be authenticated 😉