#!/bin/bash if [ "$1" == "ppp1" ]; then /etc/ppp/fire-ppp1 $1 $4 T1 # Squid oldip1=`cat /var/log/myoldip1` ip41=$4 if [ "$ip41" != `cat /var/log/myoldip1` ]; then /usr/bin/sed s/$oldip1/$ip41/ /etc/squid/squid.conf > /etc/squid/squid.conf.c /bin/cp /etc/squid/squid.conf.c /etc/squid/squid.conf /bin/echo "$ip41" > /var/log/myoldip1 /etc/init.d/squid reload fi # End Squid exit; fi if [ "$1" == "ppp2" ]; then /etc/ppp/fire-ppp1 $1 $4 T2 #Squid oldip2=`cat /var/log/myoldip2` ip42=$4 if [ "$ip42" != `cat /var/log/myoldip2` ]; then /usr/bin/sed s/$oldip2/$ip42/ /etc/squid/squid.conf > /etc/squid/squid.conf.c /bin/cp /etc/squid/squid.conf.c /etc/squid/squid.conf /bin/echo "$ip42" > /var/log/myoldip2 /etc/init.d/squid reload fi #Regole per routing Server Windows #iptables -t filter -D FORWARD -o ppp2 -i eth2 -j ACCEPT #iptables -t filter -D FORWARD -o eth2 -i ppp2 -j ACCEPT #iptables -t filter -A FORWARD -o ppp2 -i eth2 -j ACCEPT #iptables -t filter -A FORWARD -o eth2 -i ppp2 -j ACCEPT #Regole per routing verso VPN iptables -t filter -D FORWARD -o ppp2 -i tun0 -j ACCEPT iptables -t filter -D FORWARD -o tun0 -i ppp2 -j ACCEPT iptables -t filter -A FORWARD -o ppp2 -i tun0 -j ACCEPT iptables -t filter -A FORWARD -o tun0 -i ppp2 -j ACCEPT iptables -t nat -D POSTROUTING -o ppp2 -j MASQUERADE iptables -t nat -A POSTROUTING -o ppp2 -j MASQUERADE ip rule del from 192.168.6.101 table T2 ip rule add from 192.168.6.101 table T2 #iptables -t nat -D PREROUTING -i ppp2 -p tcp --dport 80 -j DNAT --to-destination 192.168.6.7:80 #iptables -t nat -A PREROUTING -i ppp2 -p tcp --dport 80 -j DNAT --to-destination 192.168.6.7:80 #iptables -t nat -D PREROUTING -i ppp2 -p tcp --dport 5800 -j DNAT --to-destination 192.168.6.7:5800 #iptables -t nat -A PREROUTING -i ppp2 -p tcp --dport 5800 -j DNAT --to-destination 192.168.6.7:5800 #iptables -t nat -D PREROUTING -i ppp2 -p tcp --dport 5900 -j DNAT --to-destination 192.168.6.7:5900 #iptables -t nat -A PREROUTING -i ppp2 -p tcp --dport 5900 -j DNAT --to-destination 192.168.6.7:5900 #iptables -t nat -D PREROUTING -i ppp2 -p tcp --dport 20 -j DNAT --to-destination 192.168.6.7:20 #iptables -t nat -A PREROUTING -i ppp2 -p tcp --dport 20 -j DNAT --to-destination 192.168.6.7:20 #iptables -t nat -D PREROUTING -i ppp2 -p tcp --dport 21 -j DNAT --to-destination 192.168.6.7:21 #iptables -t nat -A PREROUTING -i ppp2 -p tcp --dport 21 -j DNAT --to-destination 192.168.6.7:21 #iptables -t nat -D PREROUTING -i ppp2 -p tcp --dport 15697 -j DNAT --to-destination 192.168.6.7:15697 #iptables -t nat -A PREROUTING -i ppp2 -p tcp --dport 15697 -j DNAT --to-destination 192.168.6.7:15697 #ssh traforo iptables -D INPUT -i ppp2 -p tcp --dport 22 -j ACCEPT iptables -A INPUT -i ppp2 -p tcp --dport 22 -j ACCEPT iptables -t nat -D PREROUTING -i ppp2 -p tcp --dport 443 -j REDIRECT --to-port 22 iptables -t nat -A PREROUTING -i ppp2 -p tcp --dport 443 -j REDIRECT --to-port 22 #Exit exit; fi if [ "$1" == "ppp3" ]; then /etc/ppp/fire-ppp1 $1 $4 T3 #Squid oldip3=`cat /var/log/myoldip3` ip43=$4 if [ "$ip43" != `cat /var/log/myoldip3` ]; then /usr/bin/sed s/$oldip3/$ip43/ /etc/squid/squid.conf > /etc/squid/squid.conf.c /bin/cp /etc/squid/squid.conf.c /etc/squid/squid.conf /bin/echo "$ip43" > /var/log/myoldip3 /etc/init.d/squid reload fi exit; fi if [ "$1" == "ppp4" ]; then /etc/ppp/fire-ppp1 $1 $4 T4 exit; fi