Last active
April 23, 2020 23:37
-
-
Save thejsj/676f0327430d1d971e853022e9db42c1 to your computer and use it in GitHub Desktop.
Setting Up Squid
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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