Thursday, June 14, 2007

Squid with ncsa_auth authentification

To use Squid with authentication, we need:

A user and their password. We can create it with:
htpasswd -c /etc/squid/users user

and type the password. To add a new user, we must use:

htpasswd /etc/squid/users newuser

Edit /etc/squid/squid.conf and add:

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

And finally, in the same file (/etc/squid/squid.conf), in ACLs section, create a proxy_auth acl:

acl authenticated_users proxy_auth REQUIRED

And the http_access rule to this acl:

http_access allow authenticated_users

Finally, restart Squid and voilá, when you are going to enter the web your browser asks you about a user and password.

0 comments: