proyScript

by godotsoftware
16 deployments · 30 still active · last rev. 8 days ago

proxy script

Compatible with: Debian 8, Debian 9
						#! /bin/bash 
 # <UDF name="proxy_username" Label="Proxy Username" example=" Username for the proxy Server" /> 
 # <UDF name="proxy_password" Label="Proxy Password" example="Password for the proxy server" /> 
 export DEBIAN_FRONTEND=noninteractive 
 apt -y update &>> /dev/null 
 apt -y upgrade &>> /dev/null 
 apt -y install squid apache2-utils &>> /dev/null 
 echo "auth_param basic program /usr/lib/squid3/basic_ncsa_auth /etc/squid/auth_file" > /etc/squid/squid.conf 
 echo "auth_param basic realm proxy" >> /etc/squid/squid.conf 
 echo "acl authenticated proxy_auth REQUIRED" >> /etc/squid/squid.conf 
 echo "http_access allow authenticated" >> /etc/squid/squid.conf 
 echo "http_port 65000" >> /etc/squid/squid.conf 
 /etc/init.d/squid restart 
 touch /etc/squid/auth_file 
 htpasswd -b /etc/squid/auth_file $PROXY_USERNAME $PROXY_PASSWORD 
 iptables -P INPUT DROP 
 iptables -P FORWARD ACCEPT 
 iptables -P OUTPUT ACCEPT 
 iptables -A INPUT -i lo -j ACCEPT 
 iptables -A INPUT -p tcp -m tcp ! --tcp-flags FIN,SYN,RST,ACK SYN -m state --state NEW -j DROP 
 iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT 
 iptables -A INPUT -p icmp -m icmp --icmp-type 0 -j ACCEPT 
 iptables -A INPUT -p icmp -m icmp --icmp-type 8 -j ACCEPT 
 iptables -A INPUT -p tcp -m tcp --dport 22 -j ACCEPT 
 iptables -A INPUT -p tcp -m tcp --dport 65000 -j ACCEPT