Skip to content

Instantly share code, notes, and snippets.

@thejsj
Last active April 23, 2020 23:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thejsj/676f0327430d1d971e853022e9db42c1 to your computer and use it in GitHub Desktop.
Save thejsj/676f0327430d1d971e853022e9db42c1 to your computer and use it in GitHub Desktop.
Setting Up Squid
apt-get --only-upgrade install squid
apt -y install squid apache-utils
systemctl start squid
systemctl enable squid
mv /etc/squid/squid.conf /etc/squid/squid.conf.backup
echo "PASSWORD" | htpasswd -b -i -c /var/spool/squid/passwords squid_username
GATEWAY=$(curl -s http://169.254.169.254/metadata/v1/interfaces/public/0/anchor_ipv4/address)
cat <<EOT > /etc/squid/squid.conf
cache deny all
acl ev src 0.0.0.0/0
tcp_outgoing_address $GATEWAY ev
auth_param basic program /usr/lib/squid3/basic_ncsa_auth /var/spool/squid/passwords
auth_param basic realm proxy
acl authenticated proxy_auth REQUIRED
http_access allow authenticated
http_port 3128
coredump_dir /var/spool/squid
EOT
systemctl restart squid
systemctl status squid
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment