How to Set Up Squid Proxy for Private Connections on Ubuntu 20.04
Step 1 — Installing Squid Proxy
sudo apt update
sudo apt install squid
systemctl status squid.service
sudo nano /etc/squid/squid.conf
http_port 3128
# INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS
include /etc/squid/conf.d/*
auth_param basic program /usr/lib/squid3/basic_ncsa_auth /etc/squid/passwords
auth_param basic realm proxy
acl authenticated proxy_auth REQUIRED
# Example rule allowing access from your local networks.
acl localnet src 192.168.11.0/24
Adapt localnet in the ACL section to list your (internal) IP networks
from where browsing should be allowed
http_access allow localhost
http_access allow authenticated
And finally deny all other access to this proxy
http_access deny all
Example rule allowing access from your local networks.
Adapt localnet in the ACL section to list your (internal) IP networks
from where browsing should be allowed
http_access allow localhost
Step 2 — Securing Squid
sudo apt install apache2-utils
sudo htpasswd -c /etc/squid/passwords your_squid_username
EX: sudo htpasswd -c /etc/squid/passwords u1
sudo cat /etc/squid/passwords
sudo nano /etc/squid/squid.conf
sudo systemctl restart squid.service
sudo ufw allow 3128
Step 3 — Connecting through Squid
curl -v -x http://your_squid_username:your_squid_password@your_server_ip:3128 http://www.google.com/
Step 4 - Check log
cd /var/log/
sudo tail -f access.log