Squid Proxy

Install Squid proxy on Ubuntu

Squid is a famous solution for content delivery. There are many purposes for using it could be. Popular aims are improving privacy and making connections more secure or faster. Proxy could be useful to avoid geographical restrictions or research “target” host behavior depending on client location.

Preparing

Before starting the process you should ensure you have a Machine under Ubuntu, root privileges, or sudo group membership for your account. “External” access via FQDN is optional, but IP only is possible too.

Service setup

Firstly, please authorize as root and update the system package cache

sudo –s
apt-get update

Squid was included in the Ubuntu base repository a long time ago, so maintainers made a pre-built release of this package, and you can install it in “just one click”

apt-get install squid

To make the daemon that autostarts every machine reboot, just run

systemctl enable squid

Settings update

Squid will “read” its service parameters from the file /etc/squid/squid.conf. So, edit it via nano, look for the parameter http_port option, and change the pre-defined value to the unused port number above 1024

nano /etc/squid/squid.conf

Then find “http_access deny all” words. Further doings depend on the expected result. To pass everyone access, just set this to “allow all”. More secure is accepting data for some “trusted” IPs only. To include this option put directive acl whitelist src “/etc/squid/whitelist” before “http_access deny all

Don’t forget to pass squid traffic through the system firewall.

Then put your IP address to the /etc/squid/whitelist file and reload the service

curl ifconfig.me >> /etc/squid/whitelist
service squid restart


Posted

in

by