Squid im Intercept-Modus via TPROXY mit nftables: Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
| (Eine dazwischenliegende Version desselben Benutzers wird nicht angezeigt) | |||
| Zeile 1: | Zeile 1: | ||
| − | = Squid im Intercept-Modus | + | = Squid im Intercept-Modus per REDIRECT (lokal auf dem Proxy) = |
== Voraussetzungen == | == Voraussetzungen == | ||
| − | * | + | * Der Proxy hat eine eigene IP im LAN, z. B. 10.88.113.51 |
| − | * | + | * Squid läuft direkt auf diesem Host |
| − | * Der | + | * Der Traffic wird per iptables/nftables von Port 80/443 auf lokale Ports umgeleitet |
| − | + | * Keine TPROXY-Konfiguration nötig | |
| − | * | ||
| − | |||
| − | == | + | == Squid-Konfiguration == |
| − | ; | + | http_port 3128 intercept |
| + | https_port 3129 intercept ssl-bump cert=/etc/squid/certs/proxyCA.pem key=/etc/squid/certs/proxyCA.key | ||
| + | |||
| + | ;Optional: SSL-Bump | ||
| + | ssl_bump peek all | ||
| + | ssl_bump bump all | ||
| + | sslproxy_cert_error allow all | ||
| + | sslproxy_flags DONT_VERIFY_PEER | ||
| + | |||
| + | == nftables-Konfiguration (lokal auf dem Proxy) == | ||
*nft add table ip nat | *nft add table ip nat | ||
*nft add chain ip nat prerouting '{ type nat hook prerouting priority dstnat; policy accept; }' | *nft add chain ip nat prerouting '{ type nat hook prerouting priority dstnat; policy accept; }' | ||
| − | *nft add rule ip nat prerouting tcp dport 80 | + | *nft add rule ip nat prerouting tcp dport 80 redirect to :3128 |
| − | *nft add rule ip nat prerouting tcp dport 443 | + | *nft add rule ip nat prerouting tcp dport 443 redirect to :3129 |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | == | + | == Kernel-Module laden (falls nötig) == |
| − | + | *modprobe nf_nat | |
| − | |||
| − | |||
| − | |||
*modprobe nf_conntrack | *modprobe nf_conntrack | ||
| − | |||
| − | |||
| − | |||
| − | == Squid- | + | == Squid-Rechte (kein TPROXY nötig) == |
| − | + | Keine `setcap`-Anpassung notwendig – REDIRECT reicht. | |
| − | + | == Test & Logs == | |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | == Test & | ||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
*tail -f /var/log/squid/access.log | *tail -f /var/log/squid/access.log | ||
*tail -f /var/log/squid/cache.log | *tail -f /var/log/squid/cache.log | ||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
Aktuelle Version vom 24. April 2025, 05:19 Uhr
Squid im Intercept-Modus per REDIRECT (lokal auf dem Proxy)
Voraussetzungen
- Der Proxy hat eine eigene IP im LAN, z. B. 10.88.113.51
- Squid läuft direkt auf diesem Host
- Der Traffic wird per iptables/nftables von Port 80/443 auf lokale Ports umgeleitet
- Keine TPROXY-Konfiguration nötig
Squid-Konfiguration
http_port 3128 intercept https_port 3129 intercept ssl-bump cert=/etc/squid/certs/proxyCA.pem key=/etc/squid/certs/proxyCA.key
- Optional
- SSL-Bump
ssl_bump peek all ssl_bump bump all sslproxy_cert_error allow all sslproxy_flags DONT_VERIFY_PEER
nftables-Konfiguration (lokal auf dem Proxy)
- nft add table ip nat
- nft add chain ip nat prerouting '{ type nat hook prerouting priority dstnat; policy accept; }'
- nft add rule ip nat prerouting tcp dport 80 redirect to :3128
- nft add rule ip nat prerouting tcp dport 443 redirect to :3129
Kernel-Module laden (falls nötig)
- modprobe nf_nat
- modprobe nf_conntrack
Squid-Rechte (kein TPROXY nötig)
Keine `setcap`-Anpassung notwendig – REDIRECT reicht.
Test & Logs
- tail -f /var/log/squid/access.log
- tail -f /var/log/squid/cache.log