«

»

Nis 27 2011

Transparan squid kurulumu

Bir güvenlik duvarı arkasındaki transparan squid kurulumu için, “kendime” yazdığım notlardır.

Squid kurulumu:
apt-get install squid3

Sarg ve Calamaris (raporlama arabirimi) kurulumu:
Sarg için; /etc/apt/sources.list dosyasına şu satırı ekle:
deb http://backports.debian.org/debian-backports squeeze-backports main
apt-get update
apt-get install calamaris sarg apache2

/etc/squid3/squid.conf dosyasının düzenlenmesi (benim özellikle eklediğim veya düzenlediğim kısımları koyu yaptım):

refresh_pattern windowsupdate.com/.*\.(cab|exe) 4320 100% 43200 reload-into-ims
refresh_pattern download.microsoft.com/.*\.(cab|exe) 4320 100% 43200 reload-into-ims
refresh_pattern au.download.windowsupdate.com/.*\.(cab|exe) 4320 100% 43200 reload-into-ims

acl manager proto cache_object
acl localhost src 127.0.0.1/32
acl to_localhost dst 127.0.0.0/8 0.0.0.0/32

acl SSL_ports port 443
acl Safe_ports port 80          # http
acl Safe_ports port 21          # ftp
acl Safe_ports port 443         # https
acl Safe_ports port 70          # gopher
acl Safe_ports port 210         # wais
acl Safe_ports port 1025-65535  # unregistered ports
acl Safe_ports port 280         # http-mgmt
acl Safe_ports port 488         # gss-http
acl Safe_ports port 591         # filemaker
acl Safe_ports port 777         # multiling http

acl CONNECT method CONNECT
http_access allow manager localhost
http_access deny manager
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access allow localhost
http_access allow all

http_port 3128 transparent
hierarchy_stoplist cgi-bin ?
cache_dir ufs /var/spool/squid3 30000 16 256
maximum_object_size 100 MB

## Sanal makine üzerinde; cache.log dosyasına çok fazla log bastığı için
## alttaki satırları yazmıştım.
buffered_logs on
debug_options ALL,0

coredump_dir /var/spool/squid3
refresh_pattern ^ftp:           1440    20%     10080
refresh_pattern ^gopher:        1440    0%      1440
refresh_pattern -i (/cgi-bin/|\?) 0     0%      0
refresh_pattern .               0       20%     4320

Squid cache klasörlerini oluştur:
#squid3 -z

Iptables üzerindeki komutlar:
#$IPT -t nat -A PREROUTING -i eth0 -p tcp –dport 80 -j DNAT –to $SquidIP:3128
#$IPT -t nat -A POSTROUTING -o eth0 -s $LAN_IP -d
$SquidIP -j SNAT –to $SquidGateway
/etc/sarg.conf dosyasının düzenlenecek ayarları
access_log /var/log/squid3/access.log

crontab listesi
*/5 * * * * /usr/bin/sarg >/dev/null 2>&1

Bir Cevap Yazın

Bad Behavior has blocked 26 access attempts in the last 7 days.