In this post i'm going to show you how to set authentication for squid-proxy users. Because as a System Admin you should countrol the user's who use internet and the sites they browse. But now i show only Authenticating the proxy users using ncsa_auth helper. ofcourse few other ways but i choose ncsa_auth for this post. Let's start

After installing the squid check if you can able to browse using proxy on client machine.


Step 1

Create passwd file for ncsa using htpasswd.

# htpasswd -c /etc/squid/passwd  <username>

Enter password and reenter to confirm.

There will be no passwd file under squid dir, we are using -c switch to create it.

Step 2

After creating passwd file give read permission to it, so that squid can read it inorder to cross check passwd file to authenticate

# chmod o+r /etc/squid/passwd

Step 3

Now edit the squid.conf file to apply ncsa_auth for squid users

# vim /etc/squid/squid.conf

Enter the following lines in your squid.conf file. (don't forget to back  up the original squid.conf file)

# auth_param basic program  /usr/lib64/squid/ncsa_auth  /etc/squid/passwd
# auth_param basic children 5
# auth_param basic realm Squid proxy-caching web server
# auth_param basic credentialsttl 2 hours
# auth_param basic casesensitive off

In the first line i written /usr/lib64/squid/ncsa_auth its the ncsa_auth authentication helper file.

Step 4

Now apply acl in the squid.conf file to make squid propt for username and password for users.

Edit the ACL section of squid.conf file and add the following lines

acl ncsa_users proxy_auth REQUIRED
http_access allow ncsa_users

Finally Restart the squid serive and try loggin in as a user you'll be promted Authentication.

# services squid restart