PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : Squid kriegt den ganzen Rechner klein



swzmephisto
29.07.06, 10:40
Hallo,

ich richte gerade für eine Schule einen Squid ein, damit die Kinder nicht mehr so viele Pornoseiten anschauen können. Leider stehe ich vor dem Problem, dass die ganze Installation genau einmal einmal funktioniert hat. Nach einem Neustart des Systems ist der Rechner nur noch mit auslagern beschäftigt und ich weiß nicht warum. Das geht soweit, dass er es nichtmal mehr schafft, sinch normal herunterzufahren.

Kurz zu dem System: PII 333MHz mit mittlerweile 384 MB SD RAM; eine Grafikkarte und 2x 3Com Netzwerkkarte. Ansonsten ist er leer. Ach eine 4 Gig Platte paritioniert mit ca. 300 MB Swap
Kernel 2.4.27 aber mit einem 2.6er Kernel passiert auch nichts anderes

Installiert ist ein Debian (ich habe es auch mit Ubuntu mal versucht; gleiche Symptome)
Auf dem Debian ist ein Apache, Squid und Squidguard installiert.
Die Filterregeln für squidguard habe ich über das "blacklist-update"-Skript von http://www.bn-paf.de/filter/ erstellt.
Wenn der Proxy läuft, werden 5 Squidguards mitgestartet die in der Prozessor bzw speicherauslastung nicht wirklich auffällig sind.

Im Leerlauf:


ps uax | grep squid
root 1163 0.0 0.3 4420 1200 ? Ss 11:36 0:00 /usr/sbin/squid -D -sYC
proxy 1166 0.4 1.2 7332 4660 ? S 11:36 0:00 (squid) -D -sYC
proxy 1167 5.5 0.5 6792 1948 ? Rs 11:36 0:01 (squidGuard) -c /etc/squid/squidGuard.conf
proxy 1168 5.4 0.5 6792 1948 ? Rs 11:36 0:01 (squidGuard) -c /etc/squid/squidGuard.conf
proxy 1169 5.2 0.5 6792 1948 ? Rs 11:36 0:01 (squidGuard) -c /etc/squid/squidGuard.conf
proxy 1170 5.4 0.5 6792 1948 ? Rs 11:36 0:01 (squidGuard) -c /etc/squid/squidGuard.conf
proxy 1171 5.4 0.5 6792 1948 ? Rs 11:36 0:01 (squidGuard) -c /etc/squid/squidGuard.conf


Bei Zugriff:


ps uax | grep squid
root 1163 0.0 0.3 4420 1200 ? Ss 11:36 0:00 /usr/sbin/squid -D -sYC
proxy 1166 0.1 1.2 7340 4704 ? S 11:36 0:00 (squid) -D -sYC
proxy 1167 9.2 0.5 6792 1948 ? Ds 11:36 0:10 (squidGuard) -c /etc/squid/squidGuard.conf
proxy 1168 10.5 0.5 6792 1948 ? Ds 11:36 0:11 (squidGuard) -c /etc/squid/squidGuard.conf
proxy 1169 10.7 0.5 6792 1948 ? Ds 11:36 0:11 (squidGuard) -c /etc/squid/squidGuard.conf
proxy 1170 13.9 0.5 6792 1948 ? Rs 11:36 0:15 (squidGuard) -c /etc/squid/squidGuard.conf
proxy 1171 9.2 0.5 6792 1948 ? Ds 11:36 0:10 (squidGuard) -c /etc/squid/squidGuard.conf




proxy:~# cat /etc/squid/squid.conf | egrep ^[^#]
hierarchy_stoplist cgi-bin ?
acl QUERY urlpath_regex cgi-bin \?
no_cache deny QUERY
hosts_file /etc/hosts
redirect_program /usr/bin/squidGuard -c /etc/squid/squidGuard.conf
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 # https, snews
acl SSL_ports port 873 # rsync
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 Safe_ports port 631 # cups
acl Safe_ports port 873 # rsync
acl Safe_ports port 901 # SWAT
acl purge method PURGE
acl CONNECT method CONNECT
http_access allow manager localhost
http_access deny manager
http_access allow purge localhost
http_access deny purge
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
acl our_networks src 10.0.10.0/24
http_access allow our_networks
http_access allow localhost
http_access deny all
http_reply_access allow all
icp_access allow all
coredump_dir /var/spool/squid




proxy:~# cat /etc/squid/squidGuard.conf | egrep ^[^#]
dbhome /var/lib/squidguard/db
logdir /var/log/squid
time workhours {
weekly mtwhf 08:00 - 16:30
date *-*-01 08:00 - 16:30
}
dest eigene {
domainlist eigene/domains
urllist eigene/urls
log blocked.log
}
dest ads {
domainlist ads/domains
urllist ads/urls
redirect 302:http://127.0.0.1/1x1.gif
}
dest aggressive {
domainlist aggressive/domains
urllist aggressive/urls
log blocked.log
}
dest audio-video {
domainlist audio-video/domains
urllist audio-video/urls
log blocked.log
}
dest drugs {
domainlist drugs/domains
urllist drugs/urls
log blocked.log
}
dest gambling {
domainlist gambling/domains
urllist gambling/urls
log blocked.log
}
dest hacking {
domainlist hacking/domains
urllist hacking/urls
log blocked.log
}
dest mail {
domainlist mail/domains
urllist mail/urls
log blocked.log
}
dest porn {
domainlist porn/domains
urllist porn/urls
log blocked.log
}
dest violence {
domainlist violence/domains
urllist violence/urls
log blocked.log
}
dest warez {
domainlist warez/domains
urllist warez/urls
log blocked.log
}
dest local-ok {
domainlist custom/local-ok/domains
urllist custom/local-ok/urls
}
destination local-block {
domainlist custom/local-block/domains
urllist custom/local-block/urls
log blocked.log
}
acl {
default {
pass local-ok !local-block !eigene !ads !aggressive !audio-video !drugs !gambling !hacking !porn !violence !warez all
redirect 302:http://10.0.10.113/forbidden/redirect.php?site=%u&class=%t
}
}



du -sh /var/lib/squidguard/db/*
40K /var/lib/squidguard/db/ads
12K /var/lib/squidguard/db/aggressive
12K /var/lib/squidguard/db/audio-video
60K /var/lib/squidguard/db/drugs
8,0K /var/lib/squidguard/db/eigene
32K /var/lib/squidguard/db/gambling
16K /var/lib/squidguard/db/hacking
16K /var/lib/squidguard/db/mail
16M /var/lib/squidguard/db/porn
8,0K /var/lib/squidguard/db/violence
12K /var/lib/squidguard/db/warez

bla!zilla
29.07.06, 11:01
Hast du mal mittels "top" geprüft was da so eine Last verursacht? Ist es wirklich der Squid Prozess? Was sagt "ps ax"? Was sagen die Squid Logs?

swzmephisto
29.07.06, 11:37
Top zeigt keine Auffälligkeiten. Der Speicherverbrauch ist minimal. Und das da unten zeigt auch nur wirklich den peak an. Die meiste Zeit dümpelt der Server vor sich hin, lagert aber trotzdem wie ein wilder aus, oder rödelt woanders auf der Platte rum.
Beim Squidguard weiß ich nicht, wie man den Loglevel hochdreht, der sagt (wie übrigens der Squid) nach dem Start gar nix mehr.



PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
1170 proxy 14 0 1952 1948 844 D 17.8 0.5 1:32.81 squidGuard
1169 proxy 14 0 1952 1948 844 D 17.5 0.5 1:30.84 squidGuard
1167 proxy 13 0 1952 1948 844 D 17.2 0.5 1:43.93 squidGuard
1168 proxy 14 0 1952 1948 844 D 16.5 0.5 1:36.02 squidGuard
1171 proxy 14 0 1952 1948 844 D 15.8 0.5 1:41.45 squidGuard
99 root 10 0 0 0 0 D 0.7 0.0 0:10.38 kjournald
1218 root 11 0 1048 1048 844 R 0.7 0.3 0:00.23 top
1047 root 9 0 2244 2236 1940 R 0.3 0.6 0:00.70 sshd
1 root 8 0 500 500 448 S 0.0 0.1 0:00.29 init
2 root 8 0 0 0 0 S 0.0 0.0 0:00.00 keventd
3 root 18 19 0 0 0 S 0.0 0.0 0:00.00 ksoftirqd_CPU0
4 root 9 0 0 0 0 S 0.0 0.0 0:00.00 kswapd
5 root 9 0 0 0 0 S 0.0 0.0 0:00.00 bdflush
6 root 9 0 0 0 0 S 0.0 0.0 0:00.01 kupdated
442 root 9 0 0 0 0 S 0.0 0.0 0:00.00 khubd
727 root 9 0 860 860 732 S 0.0 0.2 0:00.01 dhclient
732 daemon 9 0 452 452 384 S 0.0 0.1 0:00.00 portmap
895 root 9 0 808 808 704 S 0.0 0.2 0:00.10 syslogd
898 root 9 0 1380 1376 480 S 0.0 0.4 0:00.31 klogd
933 Debian-e 8 0 1720 1716 1476 S 0.0 0.4 0:00.00 exim4
939 root 9 0 720 720 652 S 0.0 0.2 0:00.00 inetd
943 lp 9 0 864 864 752 S 0.0 0.2 0:00.00 lpd
950 root 9 0 1548 1544 1392 S 0.0 0.4 0:00.01 sshd
955 root 9 0 932 932 836 S 0.0 0.2 0:00.00 rpc.statd
979 daemon 9 0 636 636 560 S 0.0 0.2 0:00.01 atd
983 root 8 0 808 808 672 S 0.0 0.2 0:00.02 cron
989 root 9 0 7928 7924 7800 S 0.0 2.0 0:00.37 apache2
997 www-data 9 0 7948 7944 7820 S 0.0 2.1 0:00.00 apache2
998 www-data 9 0 7948 7944 7820 S 0.0 2.1 0:00.00 apache2
999 www-data 9 0 7948 7944 7820 S 0.0 2.1 0:00.01 apache2
1000 www-data 9 0 7948 7944 7820 S 0.0 2.1 0:00.00 apache2
1001 www-data 9 0 7948 7944 7820 S 0.0 2.1 0:00.00 apache2
1002 root 9 0 5440 5436 1984 S 0.0 1.4 0:00.03 miniserv.pl
1003 root 8 0 1668 1668 1240 S 0.0 0.4 0:00.10 bash
1004 root 9 0 472 472 420 S 0.0 0.1 0:00.01 getty
1005 root 9 0 472 472 420 S 0.0 0.1 0:00.00 getty
1006 root 9 0 472 472 420 S 0.0 0.1 0:00.00 getty
1007 root 9 0 472 472 420 S 0.0 0.1 0:00.01 getty
1008 root 9 0 472 472 420 S 0.0 0.1 0:00.00 getty
1049 root 8 0 2244 2236 1940 S 0.0 0.6 0:00.00 sshd
1051 root 9 0 1676 1676 1264 S 0.0 0.4 0:00.18 bash
1163 root 9 0 1204 1200 1012 S 0.0 0.3 0:00.01 squid
1166 proxy 9 0 4748 4740 1660 S 0.0 1.2 0:00.15 squid
1172 proxy 9 0 284 280 240 S 0.0 0.1 0:00.01 unlinkd

bla!zilla
29.07.06, 11:44
Hast du dir die Ausgabe von "top" überhaupt angesehen und versucht zu interpretieren?



1170 proxy 14 0 1952 1948 844 D 17.8 0.5 1:32.81 squidGuard
1169 proxy 14 0 1952 1948 844 D 17.5 0.5 1:30.84 squidGuard
1167 proxy 13 0 1952 1948 844 D 17.2 0.5 1:43.93 squidGuard
1168 proxy 14 0 1952 1948 844 D 16.5 0.5 1:36.02 squidGuard
1171 proxy 14 0 1952 1948 844 D 15.8 0.5 1:41.45 squidGuard


Diese Prozesse fressen fast die gesamte CPU Leistung, und deswegen ist deine Kiste so lahm.

swzmephisto
29.07.06, 11:53
Wie gesagt, das war der Peak. Das hat stolze 2 sekunden angehalten und ist dann auf einen "normalen" Wert zurückgegangen. Jener schwankt zwischen 5 SquidGuards mit je ca. 4% - 7% Auslastung und einem Squidguard mit 1 - 6%. Interessanter sollte doch bei Problemen mit dem Speicher, der Speicherverbrauch sein, oder hab ich da nen Denkfehler?

grüße Nico

bla!zilla
29.07.06, 11:55
Warum? Speicher der vorhanden ist, wird verbraucht (als Cache genutzt).

swzmephisto
29.07.06, 12:06
Ich formulier nochmal kurz meine Frage von oben neu:

Ich starte meinen Server, mache mit meinem einen Client eine Anfrage auf den Proxy und von da an lagert er sich bis zum Sankt-Nimmerleinstag zu Tode aus. Das geht soweit, dass man den Server nichtmal mehr herunterfahren kann. "ps aux" und "top" zeigen an, das der Server eher gelangweilt ist, aber trotzdem lagert er aus. Vielleicht sieht es auch nur aus, als wenn er auslagert, aber ich wüßte nicht, was er sonst auf der Festplatte machen sollte. Die Anzahl der gestarteten Dienste ist doch recht übersichtlich.

bla!zilla
29.07.06, 12:15
Moment?! Du siehst das die HDD LED blinkt und gehst davon aus er auslagert, habe ich das richtig verstanden? Du weißt das du einen Proxy betreibst, der seinen Cache auf der Platte hat? Check doch einfach mal mittels "free -s 1 -m" ob er wirklich in den Swapspace auslagert.

swzmephisto
29.07.06, 12:23
Oh ... Wie... Peinlich... :ugly:
Da bin ich jetzt 2 Tage einem Phantom hinterher gerannt. Bleibt nur noch die Frage, warum sich der Rechner verhuddelt und seine Dienste nicht tut. Zumal er es direkt nach der installation getan hatte. Das letzte, was ich geändert hatte, war einen Regelblock "eigene" in die squidguard.conf hinzuzufügen, der durch die automatischen Updates unberührt bleibt. Seit dem passiert nichts mehr.

Nur mal zur allgemeinen Belustigung:

total used free
Swap: 203 0 203