What is Squid Proxy
Squid Proxy is an open-source proxy server renowned for enhancing web performance and security. Operating as an intermediary between client computers and the internet, Squid efficiently caches frequently requested web content, reducing latency by serving subsequent requests locally. Beyond caching, Squid acts as a proxy and forwarder, improving network security and performance. Administrators can enforce access controls through defined ACLs, implement authentication mechanisms, and employ content filtering to regulate internet access. Squid’s robust logging capabilities enable the monitoring and analysis of proxy server activity. Additionally, it serves as a reverse proxy, managing requests on behalf of servers to boost web server performance and security. Widely adopted in enterprises and ISPs, Squid Proxy offers a versatile solution with comprehensive configuration options to adapt to diverse network setups and enforce internet usage policies effectively.
Installing Squid
sudo apt update && apt upgrade -y
sudo apt install squid
systemctl status squid.service
sudo nano /etc/squid/squid.conf
#add line below(# Example rule allowing access from your local networks.)
#acl localnet src your_ip_address
#save and close
#Securing Squid
sudo apt install apache2-utils
#adding user
sudo htpasswd -c /etc/squid/passwords your_squid_username
verifying user
sudo cat /etc/squid/passwords
-----------------------------------------------------
sudo nano /etc/squid/squid.conf
add below (acl localhost src your_ip_address)
auth_param basic program /usr/lib/squid3/basic_ncsa_auth /etc/squid/passwords
auth_param basic realm proxy
acl authenticated proxy_auth REQUIRED
addbelow (http_access allow localhost)
http_access allow authenticated
sudo systemctl restart squid.service
allow port
sudo ufw allow 3128
Connecting through Squid
curl -v -x http://your_squid_username:your_squid_password@your_server_ip:3128 http://www.google.com/
curl -v -x http://your_squid_username:your_squid_password@your_server_ip:3128 https://www.google.com/