Squid Proxy Installer (IP WhiteList)

by hostonnet
205 deployments · 205 still active · last rev. 16 days ago

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

Compatible with: Ubuntu 16.04 LTS
						#!/bin/bash
# <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@hostonnet.com
# Blog: https://blog.hostonnet.com


/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

/sbin/iptables-save

service squid restart
update-rc.d squid defaults