Hier werden die Unterschiede zwischen zwei Versionen gezeigt.
Beide Seiten, vorherige Überarbeitung Vorherige Überarbeitung Nächste Überarbeitung | Vorherige Überarbeitung | ||
lpi2:squid [2013/12/30 02:42] ingo_wichmann [Squid starten und testen] |
lpi2:squid [2024/08/07 10:39] (aktuell) |
||
---|---|---|---|
Zeile 1: | Zeile 1: | ||
====== Squid Out of the Box ====== | ====== Squid Out of the Box ====== | ||
===== Benötigte Pakete ===== | ===== Benötigte Pakete ===== | ||
- | Fedora, Debian, SuSE: | + | Fedora, Debian (ab 12), SuSE: |
squid | squid | ||
+ | Debian (bis 11): | ||
+ | squid3 | ||
===== Squid starten und testen ===== | ===== Squid starten und testen ===== | ||
- | /etc/init.d/squid start | + | service squid start |
netcat -v localhost 3128 | netcat -v localhost 3128 | ||
GET http://www.heise.de/ HTTP/1.1 | GET http://www.heise.de/ HTTP/1.1 | ||
Zeile 14: | Zeile 16: | ||
Konfigurationsdatei vor Neustart testen: | Konfigurationsdatei vor Neustart testen: | ||
- | squid -k parse | + | squid -k check |
- | ===== Eintrag aus Cache Löschen ===== | + | ====== Squid für das lokale Netzwerk ====== |
- | ==== PURGE Zugriff erlauben ==== | + | ''/etc/squid/squid.conf'': |
+ | <file> | ||
+ | acl our_networks src 192.168.1.0/24 | ||
+ | http_access allow our_networks | ||
+ | </file> | ||
+ | |||
+ | ====== mehr RAM ====== | ||
+ | cache_mem 256 MB | ||
+ | |||
+ | ====== mehr Plattenplatz ====== | ||
+ | cache_dir | ||
+ | |||
+ | danach mit | ||
+ | squid -z -N | ||
+ | das Cache-Verzeichnis neu aufbauen. | ||
+ | |||
+ | ====== Eintrag aus Cache Löschen ====== | ||
+ | (( Details siehe: http://wiki.squid-cache.org/SquidFaq/OperatingSquid )) | ||
+ | ===== PURGE Zugriff erlauben ===== | ||
''/etc/squid3/squid.conf'' : | ''/etc/squid3/squid.conf'' : | ||
<file> | <file> | ||
acl PURGE method PURGE | acl PURGE method PURGE | ||
- | acl localhost src 127.0.0.1 | ||
http_access allow PURGE localhost | http_access allow PURGE localhost | ||
http_access deny PURGE | http_access deny PURGE | ||
</file> | </file> | ||
- | ==== testen ==== | + | ===== testen ===== |
Seite laden: | Seite laden: | ||
http_proxy='localhost:3128' wget -q -O - http://www.linuxhotel.de/index.html | wc -l | http_proxy='localhost:3128' wget -q -O - http://www.linuxhotel.de/index.html | wc -l | ||
Zeile 33: | Zeile 52: | ||
Seite löschen: | Seite löschen: | ||
squidclient -m PURGE http://www.linuxhotel.de/index.html | squidclient -m PURGE http://www.linuxhotel.de/index.html | ||
- | |||
- | ====== Squid für das lokale Netzwerk ====== | ||
- | ''/etc/squid/squid.conf'': | ||
- | <file> | ||
- | acl our_networks src 192.168.1.0/24 | ||
- | http_access allow our_networks | ||
- | </file> | ||
====== Benutzerauthentifizierung gegen PAM / /etc/shadow ====== | ====== Benutzerauthentifizierung gegen PAM / /etc/shadow ====== | ||
''/etc/squid/squid.conf'': | ''/etc/squid/squid.conf'': | ||
- | <file> | + | <file txt /etc/squid/conf.d/pam_auth> |
- | auth_param basic program /usr/lib/squid/pam_auth | + | auth_param basic program /usr/lib/squid/basic_pam_auth |
- | # in älteren squid-Versionen heißt es ''authenticate_program /usr/lib/squid/pam_auth'' statt auth_param ... | + | |
acl password proxy_auth REQUIRED | acl password proxy_auth REQUIRED | ||
- | acl our_networks src 192.168.1.0/24 | + | acl homenet src 192.168.231.0/24 |
- | http_access allow our_networks password | + | http_access allow homenet password |
</file> | </file> | ||
- | Bei Fedora müssen noch die Dateisystem-Rechte angepasst werden: | + | chmod g+s /usr/lib/squid/basic_pam_auth |
- | groupadd shadow | + | service squid reload |
- | chgrp shadow /etc/shadow | + | |
- | chmod g+r /etc/shadow | + | |
- | chgrp shadow /usr/lib/squid/pam_auth | + | |
- | chmod g+s /usr/lib/squid/pam_auth | + | |
- | /etc/init.d/squid restart | + | |
Kleiner Test: | Kleiner Test: |