Created
November 18, 2024 11:50
-
-
Save acomagu/d4710fde6964b68d43aa1fb8b6d59efe to your computer and use it in GitHub Desktop.
EC2(AmazonLinux) Userdata to setup Squid server
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
sudo yum update -y | |
sudo yum install -y squid | |
sudo cat <<EOL > /etc/squid/squid.conf | |
auth_param basic program /usr/lib64/squid/basic_ncsa_auth /etc/squid/passwd | |
auth_param basic realm proxy | |
auth_param basic children 5 | |
acl HTTP_ports port 443 | |
acl HTTP_ports port 80 | |
acl SSL_ports port 443 | |
acl auth proxy_auth REQUIRED | |
http_access deny !HTTP_ports | |
http_access deny CONNECT !SSL_ports | |
http_access deny to_localhost | |
http_access allow auth | |
http_port 3128 | |
cache deny all | |
EOL | |
sudo echo '<YOUR .htpasswd FORMAT PAYLOAD>' > /etc/squid/passwd | |
sudo systemctl enable squid | |
sudo systemctl restart squid |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment