Squid - mwicat/personal GitHub Wiki

sudo apt install squid apache2-utils
lsof -i :3128

https://gist.github.com/jackblk/fdac4c744ddf2a0533278a38888f3caf

Config squid proxy

Add user and password

sudo touch /etc/squid/passwd
sudo chown proxy /etc/squid/passwd
sudo htpasswd /etc/squid/passwd proxyuser

Verify password

/usr/lib/squid/basic_ncsa_auth /etc/squid/passwd
proxyuser proxypass

Backup default config file:

sudo mv /etc/squid/squid.conf /etc/squid/squid.conf.original

Make a new configuration files

sudo vi /etc/squid/squid.conf

Enter this in the config file

auth_param basic program /usr/lib/squid/basic_ncsa_auth /etc/squid/passwords
auth_param basic realm Squid proxy-caching web server
auth_param basic credentialsttl 24 hours
auth_param basic casesensitive off
acl authenticated proxy_auth REQUIRED
http_access allow authenticated
http_access deny all
dns_v4_first on
forwarded_for delete
via off
http_port 8888
  • auth_param basic credentialsttl 24 hours: after 24 hours, user/pass will be asked again.
  • auth_param basic casesensitive off: case sensitive for user is off.
  • dns_v4_first on: use only IPv4 to speed up the proxy.
  • forwarded_for delete: remove the forwarded_for http header which would expose your source to the destination
  • via off: remove more headers to avoid exposing the source.
  • http_port 8888: port 8888 is used for proxy. You can choose any port.

Test

curl -U proxyuser:proxypass -x http://yourserver.com:8888/ -I ifconfig.me