#!/bin/sh
# Erstellt die Squid-Config /etc/squid.conf
#Trage Secserver als einzigen DNS in resolv.conf ein
rm -f /etc/resolv.conf /etc/squid.conf
echo "nameserver 192.168.216.254" > /etc/resolv.conf
echo "domain secp.nm.informatik.uni-muenchen.de" >> /etc/resolv.conf
set $(cat /tmp/ipsub_intern.txt | tr "/" " ")
IP_INT=$1
SUB_INT=$2
set $(cat /tmp/ipsub_extern.txt | tr "/" " ")
IP_EXT=$1
SUB_EXT=$2
set $(echo $IP_INT | tr "." " ")
IP_INT_LAST=$4
IP_INT_LAST_P=`expr $4 + 1` IP_PARTNER=$1.$2.$3.$IP_INT_LAST_P
if [ $IP_INT_LAST -eq 1 ];
then HOST=pcsec1 HOST_P=pcsec2
elif [ $IP_INT_LAST -eq 23 ];
then HOST=pcsec3 HOST_P=pcsec4
elif [ $IP_INT_LAST -eq 45 ];
then HOST=pcsec5 HOST_P=pcsec6
elif [ $IP_INT_LAST -eq 67 ];
then HOST=pcsec7 HOST_P=pcsec8
elif [ $IP_INT_LAST -eq 109 ];
then HOST=pcsec9 HOST_P=pcsec10
fi
echo "http_port 8888" > /etc/squid.conf
echo "icp_port 3130" >> /etc/squid.conf
echo "cache_log /tmp/squid.log" >> /etc/squid.conf
echo "debug_options ALL,2" >> /etc/squid.conf
echo "cache_peer 192.168.216.254 parent 3128 3130 proxy-only no-query default" >> /etc/squid.conf
echo "hierarchy_stoplist cgi-bin ?" >> /etc/squid.conf
echo "acl QUERY urlpath_regex cgi-bin \?" >> /etc/squid.conf
echo "no_cache deny QUERY " >> /etc/squid.conf
echo "acl all src 0.0.0.0/0.0.0.0" >> /etc/squid.conf
echo "acl manager proto cache_object" >> /etc/squid.conf
echo "acl localhost src 127.0.0.1/255.255.255.255" >> /etc/squid.conf
echo "acl SSL_ports port 443 563" >> /etc/squid.conf
echo "acl Safe_ports port 80 # http" >> /etc/squid.conf
echo "acl Safe_ports port 21 # ftp" >> /etc/squid.conf
echo "acl Safe_ports port 443 563 # https, snews" >> /etc/squid.conf
echo "acl Safe_ports port 70 # gopher" >> /etc/squid.conf
echo "acl Safe_ports port 210 # wais" >> /etc/squid.conf
echo "acl Safe_ports port 1025-65535 # unregistered ports" >> /etc/squid.conf
echo "acl Safe_ports port 280 # http-mgmt" >> /etc/squid.conf
echo "acl Safe_ports port 488 # gss-http" >> /etc/squid.conf
echo "acl Safe_ports port 591 # filemaker" >> /etc/squid.conf
echo "acl Safe_ports port 631 # cups" >> /etc/squid.conf
echo "acl Safe_ports port 777 # multiling http" >> /etc/squid.conf echo "acl Safe_ports port 901 # SWAT" >> /etc/squid.conf
echo "acl purge method PURGE" >> /etc/squid.conf
echo "acl CONNECT method CONNECT" >> /etc/squid.conf
echo "acl direkt dstdomain $HOST_P.secp.nm.informatik.uni-muenchen.de \\
$HOST.secp.nm.informatik.uni-muenchen.de $HOST-switch.secp.nm.informatik.uni-muenchen.de" >> /etc/squid.conf
echo "acl erlaubte-domains dstdomain .de .org" >> /etc/squid.conf
echo "acl intern src $IP_PARTNER $IP_INT $IP_EXT" >> /etc/squid.conf
echo "acl intranet dstdomain .secp.nm.informatik.uni-muenchen.de" >> /etc/squid.conf
echo "acl lokal src 192.168.216.192/255.255.255.192" >> /etc/squid.conf
echo " " >> /etc/squid.conf
echo "http_access allow manager localhost" >> /etc/squid.conf
echo "http_access deny manager" >> /etc/squid.conf
echo "http_access allow purge localhost " >> /etc/squid.conf
echo "http_access deny purge" >> /etc/squid.conf
echo "http_access deny !Safe_ports" >> /etc/squid.conf
echo "http_access deny CONNECT !SSL_ports" >> /etc/squid.conf
echo "http_access allow localhost" >> /etc/squid.conf
echo "http_access allow intern erlaubte-domains" >> /etc/squid.conf echo "http_access allow lokal direkt" >> /etc/squid.conf
echo "http_access deny all" >> /etc/squid.conf
echo "icp_access allow all" >> /etc/squid.conf
echo "cache_peer_access 192.168.216.254 allow !direkt" >> /etc/squid.conf
echo "cache_peer_access 192.168.216.254 allow all" >> /etc/squid.conf
echo "cache_mgr root@localhost" >> /etc/squid.conf
echo "visible_hostname $HOST" >> /etc/squid.conf
echo "always_direct allow direkt" >> /etc/squid.conf
echo "never_direct deny direkt" >> /etc/squid.conf
echo "never_direct allow intranet" >> /etc/squid.conf
echo "always_direct deny all" >> /etc/squid.conf echo "never_direct allow all" >> /etc/squid.conf