Last active
July 4, 2020 03:46
-
-
Save weibeu/5db03dc19528a6ecafed3f2fe567e6c1 to your computer and use it in GitHub Desktop.
Script to automatically install and configure squid proxy server with basic NCSA authorization.
This file contains 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
echo "--- Installing squid ---" | |
sudo apt update | |
sudo apt install squid -y | |
sudo apt install apache2-utils -y | |
echo "--- Creating default user surepass ---" | |
sudo htpasswd -b -c /etc/squid/users yourUsername yourPassword@Secret | |
echo "--- Performing configurations ---" | |
cp /etc/squid/squid.conf /etc/squid/squid.conf.original | |
sed -i '1s|^|\n\n\n\n|' /etc/squid/squid.conf | |
sed -i '1s|^|http_access allow auth_users\n|' /etc/squid/squid.conf | |
sed -i '1s|^|acl auth_users proxy_auth REQUIRED\n|' /etc/squid/squid.conf | |
sed -i '1s|^|auth_param basic realm proxy\n|' /etc/squid/squid.conf | |
sed -i '1s|^|auth_param basic program /usr/lib/squid/basic_ncsa_auth /etc/squid/users\n|' /etc/squid/squid.conf | |
echo "--- Restarting Squid service ---" | |
sudo systemctl restart squid | |
echo "--- Squid setup done with default credentials - | yourUsername | yourPassword@Secret ---" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment