- サーバはdebian, ubuntu系のOSで、
- user : foobar
- pass : e8eb23ddf9245b6dbb309903e50f67c0
- port : 3128
#!/bin/sh
sudo apt-get update
sudo apt-get -y install squid apache2-utils
sudo cp /etc/squid/squid.conf /etc/squid/squid.conf.org
sudo sh -c "echo '' > /etc/squid/squid.conf"
sudo sh -c "echo 'auth_param basic program /usr/lib/squid/basic_ncsa_auth /etc/squid/.htpasswd' >> /etc/squid/squid.conf"
sudo sh -c "echo 'auth_param basic realm proxy' >> /etc/squid/squid.conf"
sudo sh -c "echo 'acl authenticated proxy_auth REQUIRED' >> /etc/squid/squid.conf"
sudo sh -c "echo 'http_access allow authenticated' >> /etc/squid/squid.conf"
sudo sh -c "echo 'http_port 3128' >> /etc/squid/squid.conf"
sudo sh -c "echo 'request_header_access X-Forwarded-For deny all' >> /etc/squid/squid.conf"
sudo sh -c "echo 'request_header_access Via deny all' >> /etc/squid/squid.conf"
sudo sh -c "echo 'request_header_access Cache-Control deny all' >> /etc/squid/squid.conf"
sudo sh -c "echo 'reply_header_access X-Forwarded-For deny all' >> /etc/squid/squid.conf"
sudo sh -c "echo 'reply_header_access Via deny all' >> /etc/squid/squid.conf"
sudo sh -c "echo 'reply_header_access Cache-Control deny all' >> /etc/squid/squid.conf"
sudo cat /etc/squid/squid.conf
sudo htpasswd -bc /etc/squid/.htpasswd foobar e8eb23ddf9245b6dbb309903e50f67c0
sudo systemctl reload squid