Squid-Kit-TLS-CA Debian: Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
(Die Seite wurde neu angelegt: „ =Content Scan= *Auf dem Client muss das CA Zertifikat des Proxy installiert sein. *Proxy generiert für jede Anfrage ein neues Zertifikat und schickt es dem…“) |
|||
| (7 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt) | |||
| Zeile 13: | Zeile 13: | ||
;Diese können wir selbst komplilieren oder das squid-openssl Paket von nutzen | ;Diese können wir selbst komplilieren oder das squid-openssl Paket von nutzen | ||
*apt install squid-openssl | *apt install squid-openssl | ||
| − | =Erstellen | + | =Erstellen einer Zertifizierungstelle= |
;Verzeichnis anlegen | ;Verzeichnis anlegen | ||
*mkdir /etc/squid/certs | *mkdir /etc/squid/certs | ||
| Zeile 26: | Zeile 26: | ||
*cp squid_proxyCA.crt /usr/local/share/ca-certificates | *cp squid_proxyCA.crt /usr/local/share/ca-certificates | ||
*update-ca-certificates | *update-ca-certificates | ||
| + | |||
| + | =Zertifikat zur Verfügung stellen= | ||
| + | *cp squid_proxyCA.crt /tmp | ||
| + | *cd /tmp/ | ||
| + | *python3 -m http.server | ||
=Zertifikat auf den Clients installieren= | =Zertifikat auf den Clients installieren= | ||
!!!'''Wichtig Wichtig Wichtig'''!!! | !!!'''Wichtig Wichtig Wichtig'''!!! | ||
| − | + | ;Zertifikate ziehen | |
| + | ;squid_proxyCA.crt auf die Clients kopieren. | ||
| + | *wget http://proxy.it2XX.int:8000/squid_proxyCA.crt | ||
;Firefox | ;Firefox | ||
*Burgermenu | *Burgermenu | ||
| Zeile 41: | Zeile 48: | ||
*sudo update-ca-certificates | *sudo update-ca-certificates | ||
| − | =Zertifikats Cache anlegen= | + | =Wir sind wieder auf dem Proxy - Zertifikats Cache anlegen= |
;security_file_certgen — SSL certificate generator for Squid. | ;security_file_certgen — SSL certificate generator for Squid. | ||
*Das Generieren und Signieren von SSL-Zertifikaten nimmt Zeit in Anspruch. | *Das Generieren und Signieren von SSL-Zertifikaten nimmt Zeit in Anspruch. | ||
| Zeile 54: | Zeile 61: | ||
*chown -R proxy:proxy /var/spool/squid | *chown -R proxy:proxy /var/spool/squid | ||
| − | =Einfügen in der | + | =Einfügen in der squid.conf= |
| − | ; | + | *cd /etc/squid |
| − | + | *mv squid.conf squid.conf.org | |
| − | http_port 3128 ssl-bump cert=/etc/squid/certs/squid_proxyCA.pem generate-host-certificates=on options=NO_SSLv3,NO_TLSv1,NO_TLSv1_1 | + | *grep "^[^#]" squid.conf.org > squid.conf |
| − | ssl_bump bump all | + | *nano /etc/squid/squid.conf |
| + | acl localnet src 0.0.0.1-0.255.255.255 | ||
| + | acl localnet src 10.0.0.0/8 | ||
| + | acl localnet src 100.64.0.0/10 | ||
| + | acl localnet src 169.254.0.0/16 | ||
| + | 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 | ||
| + | '''<span style="color:red;">acl it2XX src 10.88.2XX.0/24</span>''' | ||
| + | '''<span style="color:red;">acl it2XX src 172.26.2XX.0/24</span>''' | ||
| + | '''<span style="color:red;">acl it2XX src 10.2XX.1.0/24</span>''' | ||
| + | '''<span style="color:red;">http_access allow it2XX</span>''' | ||
| + | http_access deny !Safe_ports | ||
| + | http_access deny CONNECT !SSL_ports | ||
| + | http_access allow localhost manager | ||
| + | http_access deny manager | ||
| + | http_access allow localhost | ||
| + | http_access deny to_localhost | ||
| + | http_access deny all | ||
| + | '''<span style="color:red;">http_port 3128 ssl-bump cert=/etc/squid/certs/squid_proxyCA.pem generate-host-certificates=on options=NO_SSLv3,NO_TLSv1,NO_TLSv1_1</span>''' | ||
| + | '''<span style="color:red;">ssl_bump bump all</span>''' | ||
| + | coredump_dir /var/spool/squid | ||
| + | refresh_pattern ^ftp: 1440 20% 10080 | ||
| + | refresh_pattern -i (/cgi-bin/|\?) 0 0% 0 | ||
| + | refresh_pattern . 0 20% 4320 | ||
| + | |||
| + | |||
=Restart von Squid= | =Restart von Squid= | ||
*systemctl restart squid | *systemctl restart squid | ||
| + | =Kontrolle= | ||
| + | *ss -lntp | grep 3128 | ||
| + | |||
=Misc= | =Misc= | ||
;Hier ist ein Befehl, um die am häufigsten zwischengespeicherten Domänen anzuzeigen. | ;Hier ist ein Befehl, um die am häufigsten zwischengespeicherten Domänen anzuzeigen. | ||
*awk 'BEGIN {FS="[ ]+"}; {print $7}' < /var/log/squid/access.log | awk 'BEGIN {FS="/"}; {print $3}' | sort | uniq -c |sort -k1,1nr -k2,2 | head | *awk 'BEGIN {FS="[ ]+"}; {print $7}' < /var/log/squid/access.log | awk 'BEGIN {FS="/"}; {print $3}' | sort | uniq -c |sort -k1,1nr -k2,2 | head | ||
Aktuelle Version vom 21. Mai 2026, 12:37 Uhr
Content Scan
- Auf dem Client muss das CA Zertifikat des Proxy installiert sein.
- Proxy generiert für jede Anfrage ein neues Zertifikat und schickt es dem Client.
- Client denkt er kommuniziert mit dem Original Server
- Virenscan ist möglich
- Webserver denkt die Anfrage kommt von einem normalen Client
- Prinzip der Man in the Middle Attacke
Installation von squid
- Wir brauchen eine angepasste Version von squid
- Diese können wir selbst komplilieren oder das squid-openssl Paket von nutzen
- apt install squid-openssl
Erstellen einer Zertifizierungstelle
- Verzeichnis anlegen
- mkdir /etc/squid/certs
- cd /etc/squid/certs
- Generieren Sie ein lokales selbstsigniertes CA-Zertifikat und geheimen Schlüssel (in derselben Datei))
- openssl req -new -newkey rsa:4096 -sha256 -days 365 -nodes -x509 -keyout squid_proxyCA.pem -out squid_proxyCA.pem -subj "/CN=proxy-ca"
- chown -R proxy:proxy squid_proxyCA.pem
- chmod 0400 squid_proxyCA.pem
- Wir extrahieren das ca.crt aus dem Container
- openssl x509 -inform PEM -in squid_proxyCA.pem -out squid_proxyCA.crt
- füge das squid_proxyCA-Zertifikat zum System hinzu, damit es standardmäßig vertrauenswürdig ist
- cp squid_proxyCA.crt /usr/local/share/ca-certificates
- update-ca-certificates
Zertifikat zur Verfügung stellen
- cp squid_proxyCA.crt /tmp
- cd /tmp/
- python3 -m http.server
Zertifikat auf den Clients installieren
!!!Wichtig Wichtig Wichtig!!!
- Zertifikate ziehen
- squid_proxyCA.crt auf die Clients kopieren.
- Firefox
- Burgermenu
- Einstellungen
- Nach Zertifikaten suchen
- Zertifikate anzeigen
- Zertifizierungsstellen importieren
- Zertifikate anzeigen
- Nach Zertifikaten suchen
- Einstellungen
- füge das squid_proxyCA-Zertifikat zum System hinzu, damit es standardmäßig vertrauenswürdig ist
- sudo cp squid_proxyCA.crt /usr/local/share/ca-certificates
- sudo update-ca-certificates
Wir sind wieder auf dem Proxy - Zertifikats Cache anlegen
- security_file_certgen — SSL certificate generator for Squid.
- Das Generieren und Signieren von SSL-Zertifikaten nimmt Zeit in Anspruch.
- Squid kann diesen Helfer als externen Prozess verwenden, um die Arbeit zu erledigen.
- Die Kommunikation erfolgt über TCP-Sockets, die an die Loopback-Schnittstelle gebunden sind.
- Dieser Helfer kann einen Festplattencache mit Zertifikaten verwenden, um die Antwortzeiten bei wiederholten Anforderungen zu verbessern.
- Es kann auch ohne Cache arbeiten und generiert bei jeder Anfrage neue Zertifikate.
- /usr/lib/squid/security_file_certgen -c -s /var/spool/squid/ssl_db -M 4MB
- chown -R proxy:proxy /var/spool/squid
Einfügen in der squid.conf
- cd /etc/squid
- mv squid.conf squid.conf.org
- grep "^[^#]" squid.conf.org > squid.conf
- nano /etc/squid/squid.conf
acl localnet src 0.0.0.1-0.255.255.255 acl localnet src 10.0.0.0/8 acl localnet src 100.64.0.0/10 acl localnet src 169.254.0.0/16 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 it2XX src 10.88.2XX.0/24 acl it2XX src 172.26.2XX.0/24 acl it2XX src 10.2XX.1.0/24 http_access allow it2XX http_access deny !Safe_ports http_access deny CONNECT !SSL_ports http_access allow localhost manager http_access deny manager http_access allow localhost http_access deny to_localhost http_access deny all http_port 3128 ssl-bump cert=/etc/squid/certs/squid_proxyCA.pem generate-host-certificates=on options=NO_SSLv3,NO_TLSv1,NO_TLSv1_1 ssl_bump bump all coredump_dir /var/spool/squid refresh_pattern ^ftp: 1440 20% 10080 refresh_pattern -i (/cgi-bin/|\?) 0 0% 0 refresh_pattern . 0 20% 4320
Restart von Squid
- systemctl restart squid
Kontrolle
- ss -lntp | grep 3128
Misc
- Hier ist ein Befehl, um die am häufigsten zwischengespeicherten Domänen anzuzeigen.
- awk 'BEGIN {FS="[ ]+"}; {print $7}' < /var/log/squid/access.log | awk 'BEGIN {FS="/"}; {print $3}' | sort | uniq -c |sort -k1,1nr -k2,2 | head
