Friday, July 19, 2013

User Authentication Using Squid

Prompting for username and password before allowing the user access to the Internet can be implemented in Squid by following the steps below:

1.  Create the password file for Squid users

# touch /etc/squid3/squid-passwd
# chmod o+r /etc/squid3/squid-passwd


2.  Add the Squid user

# htpasswd /etc/squid3/squid-passwd testuser

NEW PASSWORD:
RE-TYPE NEW PASSWORD:
Adding password for user testuser

3.  Edit the Squid configuration file and add the following lines:

# nano /etc/squid3/squid.conf

----------------------------------

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

acl ncsa_users  proxy_auth  REQUIRED

http_access allow ncsa_users

----------------------------------

Save the file by pressing CTLR+O


4.  Restart Squid

# /etc/init.d/squid3 restart


This procedure is tested on Ubuntu 11.04 and should work on most Linux distributions. 

NOTE:  User authentication does not work if the computer running Squid is configured as a transparent proxy.

No comments: