Squid Proxy Installer (IP WhiteList)

by hostonnet
1924 deployments · 1915 still active · last rev. 1 year ago

This allow you to run Squid Proxy with IP white list on Custom Port

Compatible with: Ubuntu 16.04 LTS
# <UDF name="squid_user" Label="Proxy Username" />
# <UDF name="squid_password" Label="Proxy Password" />
# <UDF name="squid_port" Label="Proxy Port" />
# <UDF name="ip_allow" Label="Allow from IP" />
# Squid Proxy Server
# Author: admin@serverok.in
# Blog: https://www.serverok.in

/usr/bin/apt update
/usr/bin/apt -y install apache2-utils squid3

/usr/bin/htpasswd -b -c /etc/squid/passwd $SQUID_USER $SQUID_PASSWORD

/bin/rm -f /etc/squid/squid.conf
/usr/bin/touch /etc/squid/blacklist.acl
/usr/bin/wget --no-check-certificate -O /etc/squid/squid.conf https://raw.githubusercontent.com/hostonnet/squid-proxy-installer/master/squid-2.conf

/bin/sed -i "s/http_port 3128/http_port $SQUID_PORT/g" /etc/squid/squid.conf
/sbin/iptables -I INPUT -p tcp --dport $SQUID_PORT -j ACCEPT

echo $IP_ALLOW > /etc/squid/ip.allow


service squid restart
update-rc.d squid defaults