Friday, November 29, 2013

How to Setup Squid 3 With Basic Authentication on Debian/Ubuntu

I just want to create a server for my personal proxy server, and I want to use it anywhere so my IP for web access will not change even I move to another place.

From the manual, Squid can be configured to require a user and password in order to use it. We will use digest http auth. First, I install Squid and apache2-utils (to generate htdigest) as root.
# sudo su -
# apt-get install squid3
# apt-get install apache2-utils
Edit /etc/squid3/squid.conf, and put these lines:
auth_param digest program /usr/lib/squid3/digest_pw_auth -c /etc/squid3/passwords
auth_param digest realm proxy
acl authenticated proxy_auth REQUIRED
http_access allow authenticated
Then, create user by type this command:
# htdigest -c /etc/squid3/passwords proxy user
All done, and I enjoy squid with authentication.