User Tools

Site Tools


ubuntu:squid:authenticate_users

Ubuntu - Squid - Authenticate Users

You can force your users to authenticate before they use your Linux proxy server using Apache authentication.


Create a file that will store the users

sudo touch /etc/squid/passwd

Change the ownership of the file

Change the ownership to squid daemon so it can access the file

sudo chown squid /etc/squid/passwd

Create a new user

Create a new user using the htpasswd command:

sudo htpasswd /etc/squid/passwd testuser

It will prompt you for the password twice.

If you open the created file, you will see the user and the hashed password.


Specify the Authentication to be used

Change the squid configuration to tell it about the authentication that it should use.

Add the following lines below the ACL ports and nowhere else to enable authentication:

/etc/squid/squid.conf
....
auth_param basic program /usr/lib64/squid/basic_ncsa_auth /etc/squid/passwd
 
auth_param basic children 5
 
auth_param basic realm Squid Basic Authentication
 
auth_param basic credentialsttl 3 hours
 
acl auth_users proxy_auth REQUIRED
 
http_access allow auth_users

Restart Squid

sudo systemctl restart squid

Try to open the browser again.

It will prompt you for the username and the password.

ubuntu/squid/authenticate_users.txt · Last modified: 2020/07/15 09:30 by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki