|
![]() |
EinführungDieses Crash Tutorial zeigt Dir wie man Squid und SquidGuard unter OpenBSD installert. Getestet wurde dieses Tutorial auf OpenBSD 3.6
Falls Du fragen oder anregungen hast kannst Du mir jederzeit ein Mail schreiben (tutorial@thetube.ch).
pkg_add squid-2.5.STABLE6-transparent
http_port 127.0.0.1:3128 hierarchy_stoplist cgi-bin ? acl QUERY urlpath_regex cgi-bin \? no_cache deny QUERY redirect_program /usr/local/bin/squidGuard -c /usr/local/squidGuard/squidGuard.conf auth_param basic children 5 auth_param basic realm Squid proxy-caching web server auth_param basic credentialsttl 2 hours refresh_pattern ^ftp: 1440 20% 10080 refresh_pattern ^gopher: 1440 0% 1440 refresh_pattern . 0 20% 4320 acl all src 0.0.0.0/0.0.0.0 acl manager proto cache_object acl localhost src 127.0.0.1/255.255.255.255 acl to_localhost dst 127.0.0.0/8 acl SSL_ports port 443 563 acl Safe_ports port 80 # http acl Safe_ports port 21 # ftp acl Safe_ports port 443 563 # https, snews 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 deny to_localhost http_access allow manager localhost http_access deny manager http_access deny !Safe_ports http_access deny CONNECT !SSL_ports acl our_networks src 192.168.1.0/24 192.168.0.0/24 http_access allow our_networks http_access deny all http_reply_access allow all icp_access allow all cache_mgr benny@thetube.ch httpd_accel_host virtual httpd_accel_port 80 httpd_accel_with_proxy on httpd_accel_uses_host_header onVoila, viele Parameter sind standartmässig. Nun wird squid zum erstan mal gestartet. Beim ersten starten von Squid müssen die Swap-Directorys eingerichtet werden (-z)
squid -zJetzt kann Squid gestartet werden :
squidJetzt hört squid auf der IP 127.0.0.1 (Localhost) und Port 3128. Wie bringen wir das LAN dazu das alle anfragen auf Port 80 kommen auf Squid umzuleiten? Wir konfigurieren den Paketfilter von OpenBSD (/etc/pf.conf) :
rdr pass on $int proto tcp to port www -> 127.0.0.1 port 3128 pass in on $int inet proto tcp from any to 127.0.0.1 port 3128 keep state pass out on $ext inet proto tcp from any to any port www keep stateNun mussen wir noch die Berechtigung von /dev/pf ändern :
chgrp squid /dev/pf chmod g+rw /dev/pfPaketfilter starten :
pfctl -r -F all -f /etc/pf.conf
tar xzvf db-3.2.9.tar.gz cd db-3.2.9/dist make all su (auf root wechseln) make installDie BerkeleyDB wird ins Verzeichniss /usr/local/BerkeleyDB.3.2 installert.
mkdir /usr/local/squidGuard cd /usr/local/squidGuard mkdir db chown squid.squid ../* cd /var/log mkdir squidGuard/logs chown squid.squid /squidGuard/* tar xzvf squidGuard-1.2.0.tar.gz cd squidGuard-1.2.0
#!/bin/sh ./configure \ --with-sg-config=/var/squidGuard/conf/squidGuard.conf \ --with-sg-logdir=/var/squidGuard/logs \ --with-sg-dbhome=/var/squidGuard/db \ --with-db=/usr/local/BerkeleyDB.3.2Ein chmod 700 aufs Script und mit
./makesquidGuard.shstarten
make all su (auf root wechseln) make install cd /var/squidGuard/confLadet die Blacklist runter (Aktuelle Version findet Ihr unter) :
cd /usr/local/squidGuard/db tar xzvf blacklists-20020504.tar.gzZur überprüfung wechselnt ins Verzeichniss : /usr/local/squidGuard/db/blacklists Nun solltet Ihr folgende Directorys sehen : br> ads , aggressive , audio-video , drugs , gambling , hacking , mail , porn , proxy , violence und warez
dbhome /var/squidGuard/db
logdir /var/squidGuard/logs
dest porn {
domainlist blacklists/porn/domains
urllist blacklists/porn/urls
expressionlist blacklists/porn/expressions
log porn.log
redirect
http://localhost:8080/cgi-bin/squidGuard.cgi?clientaddr=%a&clientname=%n&url=%u
}
dest proxy {
domainlist blacklists/proxy/domains
urllist blacklists/proxy/urls
log proxy.log
redirect
http://localhost:8080/cgi-bin/squidGuard.cgi?clientaddr=%a&clientname=%n&url=%u
}
src privileged {
ip 192.168.1.100
}
acl {
privileged {
pass all
}
default {
pass !porn !proxy all
}
}
Wichtig! Apache muss auf localhost (127.0.0.1) und Port 8080
horchen. Ich habe folgende änderungen in der httpd.conf vorgenommen:
Listen 127.0.0.1:8080