Squid-Kit-1: Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
| (7 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt) | |||
| Zeile 152: | Zeile 152: | ||
=First run= | =First run= | ||
| + | '''Hinweis Rocky Linux:''' Einmalig vor dem ersten Start – Cache initialisieren und Firewall öffnen: | ||
| + | *squid -z | ||
| + | *firewall-cmd --permanent --add-port=3128/tcp | ||
| + | *firewall-cmd --reload | ||
| + | |||
==Handling== | ==Handling== | ||
| + | ;Restart (Vorsicht dauert eine Zeit) | ||
*systemctl restart squid | *systemctl restart squid | ||
| + | ;Reload (Besser da schneller) | ||
*systemctl reload squid | *systemctl reload squid | ||
| + | ;Start | ||
*systemctl start squid | *systemctl start squid | ||
| + | ;Stop | ||
*systemctl stop squid | *systemctl stop squid | ||
| + | ;Enable | ||
*systemctl enable squid | *systemctl enable squid | ||
| + | ;Disable | ||
*systemctl disable squid | *systemctl disable squid | ||
| + | ;Status | ||
| + | *systemctl status squid | ||
==läuft squid?== | ==läuft squid?== | ||
| Zeile 165: | Zeile 178: | ||
*ss -lntp | grep 3128 | *ss -lntp | grep 3128 | ||
| − | == | + | ==Logs== |
| − | |||
;Fehler können im Journal eingesehen werden. | ;Fehler können im Journal eingesehen werden. | ||
*journalctl -fu squid | *journalctl -fu squid | ||
*journalctl -xu squid | *journalctl -xu squid | ||
| + | |||
| + | ==Proxy eintragen im Firefox== | ||
| + | *Burgermenu | ||
| + | **Settings | ||
| + | ***Suchen nach Proxy | ||
| + | ****Settings | ||
| + | *****Manual Proxy Configuration | ||
| + | http proxy: proxy.it2XX.int 3128 | ||
| + | https proxy: proxy.it2XX.int 3128 | ||
==Kontrolle== | ==Kontrolle== | ||
| Zeile 184: | Zeile 205: | ||
*HTTPS wird nur getunnelt (CONNECT) | *HTTPS wird nur getunnelt (CONNECT) | ||
*Caching ist heute meist irrelevant | *Caching ist heute meist irrelevant | ||
| + | ==Tips für Konsole== | ||
| + | ;curl über eine Proxy | ||
| + | *curl --proxy http://proxy.it213.int:3128 https://server.it201.int | ||
| + | ;Proxy von Hand setzen | ||
| + | *export http_proxy="http://proxy.it213.int:3128" | ||
| + | *export https_proxy="http://proxy.it213.int:3128" | ||
| + | *curl https://xinux.de | ||
| + | ;Der Konsolenbrowser w3m | ||
| + | *sudo apt install w3m | ||
| + | *w3m https://xinux.net | ||
Aktuelle Version vom 9. Juni 2026, 13:19 Uhr
Installation
- Installiert den Squid Proxy inkl. HTTPS-Unterstützung.
- Ohne SSL-Unterstützung funktioniert SSL-BUMP nicht.
| Distribution | Befehl |
|---|---|
| Debian / Ubuntu | apt install squid-openssl
|
| Rocky Linux | dnf install squid
|
Hinweis: Unter Rocky Linux ist SSL-Unterstützung bereits im Standard-Paket enthalten.
Erste Schritte
Configdir
- Hier liegt die zentrale Konfigurationsdatei squid.conf.
- Alle Anpassungen erfolgen in diesem Verzeichnis.
- cd /etc/squid
Default Konfiguration sichern
- Sichert die Originalkonfiguration.
- Ermöglicht schnelles Zurücksetzen bei Fehlern.
- cp squid.conf squid.conf.org
Kommentare entfernen
- Entfernt Kommentare für bessere Übersicht.
- Zeigt nur aktive Konfiguration.
- grep "^[^#]" squid.conf.org > squid.conf
Bereinigte squid.conf
- Erlaubt allen internen Netzen Zugriff auf den Proxy.
- Am Ende blockiert "deny all" alles nicht explizit Erlaubte.
acl localnet src 10.0.0.0/8 acl localnet src 172.16.0.0/12 acl localnet src 192.168.0.0/16 acl localnet src fc00::/7 acl localnet src fe80::/10 acl SSL_ports port 443 acl Safe_ports port 80 acl Safe_ports port 21 acl Safe_ports port 443 acl Safe_ports port 70 acl Safe_ports port 210 acl Safe_ports port 1025-65535 acl Safe_ports port 280 acl Safe_ports port 488 acl Safe_ports port 591 acl Safe_ports port 777 acl CONNECT method CONNECT http_access deny !Safe_ports http_access deny CONNECT !SSL_ports http_access allow localhost manager http_access deny manager http_access allow localnet http_access allow localhost http_access deny all http_port 3128 coredump_dir /var/cache/squid 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
Grundlegende Schlüsselwörter
acl
- Definiert eine Access Control List (ACL), also einen Filter.
- ACLs beschreiben Bedingungen (z. B. Netz, Port, Methode), die später ausgewertet werden.
http_access
- Legt fest, ob eine Anfrage erlaubt oder blockiert wird.
- Die Regeln werden von oben nach unten geprüft – die erste passende Regel gewinnt.
http_port
- Definiert den Port, auf dem Squid auf eingehende Verbindungen wartet.
- Clients verbinden sich zu diesem Port, um den Proxy zu nutzen.
coredump_dir
- Verzeichnis, in dem Speicherabbilder bei Abstürzen abgelegt werden.
- Wird hauptsächlich für Debugging und Fehleranalyse verwendet.
refresh_pattern
- Steuert, wie lange Inhalte im Cache als gültig gelten.
- Ist heute meist weniger relevant, da viele Inhalte dynamisch oder verschlüsselt sind.
Prinzip der ACL
- Squid arbeitet von oben nach unten – erste passende Regel gewinnt.
- Falsche Reihenfolge führt häufig zu unerwartetem Verhalten.
- Squid arbeitet von oben nach unten – die erste passende Regel gewinnt.
Konfiguration anpassen (eigene Netze)
- Ziel ist es, Zugriff gezielt zu steuern.
- Die Default-Konfiguration ist zu offen.
Neue squid.conf
- RFC1918 wurde entfernt, damit nicht jeder Zugriff bekommt.
- Nur definierte Netze dürfen den Proxy nutzen.
# acl localnet src 10.0.0.0/8 # acl localnet src 172.16.0.0/12 # acl localnet src 192.168.0.0/16 acl localnet src fc00::/7 acl localnet src fe80::/10 acl SSL_ports port 443 acl Safe_ports port 80 acl Safe_ports port 21 acl Safe_ports port 443 acl Safe_ports port 70 acl Safe_ports port 210 acl Safe_ports port 1025-65535 acl Safe_ports port 280 acl Safe_ports port 488 acl Safe_ports port 591 acl Safe_ports port 777 acl CONNECT method CONNECT acl it-dmz src 10.88.213.0/24 acl it-lan src 172.26.213.0/24 http_access deny !Safe_ports http_access deny CONNECT !SSL_ports http_access allow localhost manager http_access deny manager http_access allow it-dmz http_access allow it-lan http_access allow localhost http_access deny all http_port 3128 coredump_dir /var/cache/squid 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
First run
Hinweis Rocky Linux: Einmalig vor dem ersten Start – Cache initialisieren und Firewall öffnen:
- squid -z
- firewall-cmd --permanent --add-port=3128/tcp
- firewall-cmd --reload
Handling
- Restart (Vorsicht dauert eine Zeit)
- systemctl restart squid
- Reload (Besser da schneller)
- systemctl reload squid
- Start
- systemctl start squid
- Stop
- systemctl stop squid
- Enable
- systemctl enable squid
- Disable
- systemctl disable squid
- Status
- systemctl status squid
läuft squid?
- Zeigt ob Squid auf Port 3128 lauscht.
- Kein Output bedeutet, der Dienst läuft nicht.
- ss -lntp | grep 3128
Logs
- Fehler können im Journal eingesehen werden.
- journalctl -fu squid
- journalctl -xu squid
Proxy eintragen im Firefox
- Burgermenu
- Settings
- Suchen nach Proxy
- Settings
- Manual Proxy Configuration
- Settings
- Suchen nach Proxy
- Settings
http proxy: proxy.it2XX.int 3128 https proxy: proxy.it2XX.int 3128
Kontrolle
- Zeigt Live-Traffic durch den Proxy.
- Wichtig zum Debuggen und Verständnis.
- tail -f /var/log/squid/access.log
- TCP_MISS bedeutet kein Cache wurde genutzt.
- CONNECT zeigt HTTPS-Tunnelverkehr.
Hinweis
- HTTPS wird nur getunnelt und nicht analysiert.
- Caching spielt heute kaum noch eine Rolle.
- HTTPS wird nur getunnelt (CONNECT)
- Caching ist heute meist irrelevant
Tips für Konsole
- curl über eine Proxy
- curl --proxy http://proxy.it213.int:3128 https://server.it201.int
- Proxy von Hand setzen
- export http_proxy="http://proxy.it213.int:3128"
- export https_proxy="http://proxy.it213.int:3128"
- curl https://xinux.de
- Der Konsolenbrowser w3m
- sudo apt install w3m
- w3m https://xinux.net
