DevOps Buzz
Search
K

Setup server

Install squid

apt update
apt install squid squid-common

Setup squid

Edit config file:
nano /etc/squid3/squid.conf
Find the following line:
http_access deny all
BEFORE this line add:
acl all src 0.0.0.0/0
http_access allow all

Basic auth

Edit config file:
nano /etc/squid3/squid.conf
Find the following line:
http_access deny all
BEFORE this line add:
acl all src 0.0.0.0/0
auth_param basic program /usr/lib/squid3/basic_ncsa_auth /etc/squid3/passwords
auth_param basic realm proxy
acl authenticated proxy_auth REQUIRED
http_access allow authenticated

Add user

Run:
htpasswd -c /etc/squid3/passwords YOUR-USER-NAME-HERE
Input your password twice.

Setup client

export http_proxy="http://USER:PASSWORD@PROXY-HOST:3128"
export https_proxy="http://USER:PASSWORD@PROXY-HOST:3128"
export ftp_proxy="http://USER:PASSWORD@PROXY-HOST:3128"
export no_proxy="localhost,127.0.0.1,::1"
curl http://www.google.com