proxy_squid
Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
| proxy_squid [2016-04-12 22:50:00] – Externe Bearbeitung 127.0.0.1 | proxy_squid [2020-12-29 21:26:06] (aktuell) – [Proxy squid] manfred | ||
|---|---|---|---|
| Zeile 1: | Zeile 1: | ||
| + | ====== Proxy squid ====== | ||
| + | |||
| + | [[http:// | ||
| + | |||
| + | Eine Beispielhafte Minimal-Konfiguration, | ||
| + | |||
| + | Unter Ubuntu liegt die Konfigurationsdatei hier: "/ | ||
| + | |||
| + | |||
| + | ===== Beschreibung ===== | ||
| + | |||
| + | |||
| + | ==== Proxy steht hinter Proxy ==== | ||
| + | |||
| + | Wenn unser Proxy hinter einem oder mehreren anderen Proxy' | ||
| + | dann muss der oder die Proxy' | ||
| + | Jeder nutzbare Proxy bekommt eine eigene Zeile: | ||
| + | ### dieser Proxy steht auch nur hinter Proxy' | ||
| + | cache_peer 192.168.1.1 parent 3128 3130 | ||
| + | cache_peer 192.168.1.2 parent 3128 3130 | ||
| + | cache_peer 192.168.1.3 parent 3128 3130 | ||
| + | |||
| + | |||
| + | ==== Zugriffsrechte ==== | ||
| + | |||
| + | Die Zugriffsrechte werden als '' | ||
| + | Den einzelnen '' | ||
| + | |||
| + | |||
| + | === allgemeine ACLs === | ||
| + | |||
| + | Diese braucht man praktisch immer. | ||
| + | |||
| + | acl all src all | ||
| + | acl manager proto cache_object | ||
| + | acl localhost src 127.0.0.1/ | ||
| + | acl to_localhost dst 127.0.0.0/8 | ||
| + | acl SSL_ports port 443 # https | ||
| + | acl SSL_ports port 873 # rsync | ||
| + | acl Safe_ports port 21 # ftp | ||
| + | acl Safe_ports port 80 # http | ||
| + | acl Safe_ports port 443 # https | ||
| + | acl Safe_ports port 873 # rsync | ||
| + | acl purge method PURGE | ||
| + | acl CONNECT method CONNECT | ||
| + | |||
| + | |||
| + | === Definitionen === | ||
| + | |||
| + | Auf diese Weise kann man recht komplexe Konfigurationen sehr übersichtlich halten. | ||
| + | |||
| + | |||
| + | == Quellen werden definiert == | ||
| + | |||
| + | acl hosts.allow src "/ | ||
| + | acl hosts.deny src "/ | ||
| + | acl hosts.admin src "/ | ||
| + | acl localnet src "/ | ||
| + | acl kinder.allow src "/ | ||
| + | |||
| + | |||
| + | == Ziele werden definiert == | ||
| + | |||
| + | acl whitelist.ip dst "/ | ||
| + | acl whitelist.url url_regex "/ | ||
| + | acl blacklist.ip dst "/ | ||
| + | acl blacklist.url url_regex "/ | ||
| + | acl kinder.url url_regex "/ | ||
| + | |||
| + | |||
| + | ==== Zugriffsregeln ==== | ||
| + | |||
| + | Hier werden entsprechend, | ||
| + | erlaubt oder verboten. | ||
| + | |||
| + | Die Regel-Zeilen werden von oben nach unten abgearbeitet und mit einem | ||
| + | logischen '' | ||
| + | Regeln in einer Zeile dagegen werden mit einem logischen '' | ||
| + | |||
| + | |||
| + | === allgemeine Regeln === | ||
| + | |||
| + | Diese braucht man praktisch immer. | ||
| + | |||
| + | 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 | ||
| + | http_access allow localhost | ||
| + | |||
| + | |||
| + | === spezielle Regeln === | ||
| + | |||
| + | http_access deny hosts.deny | ||
| + | http_access allow hosts.admin | ||
| + | http_access deny blacklist.ip | ||
| + | http_access deny blacklist.url | ||
| + | http_access deny hosts.allow !whitelist.ip | ||
| + | http_access allow hosts.allow | ||
| + | http_access allow kinder.allow kinder.url | ||
| + | http_access deny all | ||
| + | |||
| + | |||
| + | ==== allgemeiner Block ==== | ||
| + | |||
| + | Dieses braucht man praktisch immer. | ||
| + | |||
| + | icp_access allow localnet | ||
| + | icp_access deny all | ||
| + | http_port 3128 | ||
| + | hierarchy_stoplist cgi-bin ? | ||
| + | access_log / | ||
| + | refresh_pattern ^ftp: | ||
| + | refresh_pattern ^gopher: | ||
| + | refresh_pattern -i (/ | ||
| + | refresh_pattern (Release|Package(.gz)*)$ | ||
| + | refresh_pattern . | ||
| + | acl shoutcast rep_header X-HTTP09-First-Line ^ICY\s[0-9] | ||
| + | upgrade_http0.9 deny shoutcast | ||
| + | acl apache rep_header Server ^Apache | ||
| + | broken_vary_encoding allow apache | ||
| + | coredump_dir / | ||
| + | |||
| + | |||
| + | ==== Speichernutzung ==== | ||
| + | |||
| + | |||
| + | === für den Squid nutzbarer Arbeitsspeicher ==== | ||
| + | |||
| + | ### soviel RAM darf der Proxy nutzen | ||
| + | cache_mem 256 MB | ||
| + | |||
| + | |||
| + | === für den Squid nutzbarer Plattenplatz ==== | ||
| + | |||
| + | ### soviel Speicherplatz darf der Proxy auf der Platte nutzen | ||
| + | # 512: gesammter Plattenplatz in MB für den Cache | ||
| + | # 64: Anzahl der Verzeichnisse, | ||
| + | # 256: Anzahl der Verzeichnisse, | ||
| + | cache_dir ufs / | ||
| + | |||
| + | |||
| + | === der Squid nutzt keinen Plattenplatz ==== | ||
| + | |||
| + | # ohne Cache, er darf keinen Speicherplatz auf der Platte nutzen | ||
| + | cache_dir null / | ||
| + | |||
| + | |||
| + | ===== Dateien des Regelwerkes ===== | ||
| + | |||
| + | Als erstes müssen wir das Verzeichnis anlegen, in dem die Dateien des Regelwerkes abgelegt werden können: | ||
| + | # mkdir -p / | ||
| + | |||
| + | |||
| + | ==== / | ||
| + | |||
| + | 192.168.1.0/ | ||
| + | |||
| + | |||
| + | ==== / | ||
| + | |||
| + | 192.168.1.13 | ||
| + | |||
| + | |||
| + | ==== / | ||
| + | |||
| + | 10.0.0.0/8 | ||
| + | 192.168.0.0/ | ||
| + | |||
| + | |||
| + | ==== / | ||
| + | |||
| + | 192.168.1.100 | ||
| + | | ||
| + | |||
| + | ==== / | ||
| + | |||
| + | http:// | ||
| + | http:// | ||
| + | http:// | ||
| + | http:// | ||
| + | |||
| + | |||
| + | ==== / | ||
| + | |||
| + | 192.168.1.200 | ||
| + | |||
| + | ==== / | ||
| + | |||
| + | http:// | ||
| + | |||
| + | |||
| + | ==== / | ||
| + | |||
| + | Diese Rechner dürfen über all hin: | ||
| + | |||
| + | 192.168.25.8 # Laptop | ||
| + | 192.168.25.18 # | ||
| + | |||
| + | |||
| + | ==== / | ||
| + | |||
| + | Diese Rechner werden von Kindern verwendet. | ||
| + | |||
| + | 192.168.30.100 # | ||
| + | 192.168.30.101 # | ||
| + | |||
| + | |||
| + | ==== / | ||
| + | |||
| + | Auf diese Web-Seiten dürfen die Kinder zugreifen. | ||
| + | |||
| + | http:// | ||
| + | http:// | ||
| + | http:// | ||
| + | http:// | ||
| + | |||
