Squid-Kit-TLS-CA Rocky: Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
| (6 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt) | |||
| Zeile 11: | Zeile 11: | ||
;Bei Rocky Linux ist OpenSSL-Unterstützung bereits im Standard-Paket enthalten | ;Bei Rocky Linux ist OpenSSL-Unterstützung bereits im Standard-Paket enthalten | ||
*dnf install -y squid policycoreutils-python-utils | *dnf install -y squid policycoreutils-python-utils | ||
| + | =Firewall für squid freischalten= | ||
| + | *firewall-cmd --zone=public --add-service=squid --permanent | ||
| + | *firewall-cmd --reload | ||
=Erstellen eines Selbstsignierten Zertifikates= | =Erstellen eines Selbstsignierten Zertifikates= | ||
| Zeile 47: | Zeile 50: | ||
*Dieser Helfer kann einen Festplattencache mit Zertifikaten verwenden, um die Antwortzeiten bei wiederholten Anforderungen zu verbessern. | *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. | *Es kann auch ohne Cache arbeiten und generiert bei jeder Anfrage neue Zertifikate. | ||
| − | |||
| − | |||
| − | |||
;Cache initialisieren | ;Cache initialisieren | ||
| − | *chown squid:squid /var/ | + | *chown squid:squid /var/spool/squid |
| − | *sudo -u squid /usr/lib64/squid/security_file_certgen -c -s /var/ | + | *sudo -u squid /usr/lib64/squid/security_file_certgen -c -s /var/spool/squid/ssl_db -M 4MB |
=Einfügen in der squid.conf= | =Einfügen in der squid.conf= | ||
| − | ; | + | *cat /etc/squid/squid.conf |
| − | + | acl localnet src 0.0.0.1-0.255.255.255 | |
| − | http_port 3128 ssl-bump cert=/etc/squid/certs/squid_proxyCA.pem generate-host-certificates=on options=NO_SSLv3,NO_TLSv1,NO_TLSv1_1 | + | acl localnet src 10.0.0.0/8 |
| − | ssl_bump bump all | + | 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 it213 src 10.88.213.0/24</span>''' | ||
| + | '''<span style="color:red;">acl it213 src 172.26.213.0/24</span>''' | ||
| + | '''<span style="color:red;">acl it213 src 10.213.1.0/24</span>''' | ||
| + | http_access allow it213 | ||
| + | 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 to_linklocal | ||
| + | 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 | ||
| − | = | + | =Start von Squid= |
| − | *systemctl | + | *systemctl enable squid --now |
=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 28. April 2026, 10:30 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
- Bei Rocky Linux ist OpenSSL-Unterstützung bereits im Standard-Paket enthalten
- dnf install -y squid policycoreutils-python-utils
Firewall für squid freischalten
- firewall-cmd --zone=public --add-service=squid --permanent
- firewall-cmd --reload
Erstellen eines Selbstsignierten Zertifikates
- 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 squid:squid squid_proxyCA.pem
- chmod 0400 squid_proxyCA.pem
- Wir extrahieren das ca.crt aus der PEM-Datei
- openssl x509 -inform PEM -in squid_proxyCA.pem -out squid_proxyCA.crt
- Zertifikat dem System hinzufügen, damit es standardmäßig vertrauenswürdig ist
- cp squid_proxyCA.crt /etc/pki/ca-trust/source/anchors/
- update-ca-trust
Zertifikat auf den Clients installieren
!!!Wichtig Wichtig Wichtig!!!
- squid_proxyCA.crt auf die Clients kopieren.
- Firefox
- Burgermenu
- Einstellungen
- Nach Zertifikaten suchen
- Zertifikate anzeigen
- Zertifizierungsstellen importieren
- Zertifikate anzeigen
- Nach Zertifikaten suchen
- Einstellungen
- Zertifikat dem System hinzufügen, damit es standardmäßig vertrauenswürdig ist
- sudo cp squid_proxyCA.crt /etc/pki/ca-trust/source/anchors/
- sudo update-ca-trust
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.
- Cache initialisieren
- chown squid:squid /var/spool/squid
- sudo -u squid /usr/lib64/squid/security_file_certgen -c -s /var/spool/squid/ssl_db -M 4MB
Einfügen in der squid.conf
- cat /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 it213 src 10.88.213.0/24 acl it213 src 172.26.213.0/24 acl it213 src 10.213.1.0/24 http_access allow it213 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 to_linklocal 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
Start von Squid
- systemctl enable squid --now
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
