Squid-Kit-TLS-CA Rocky: Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
| (21 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt) | |||
| Zeile 1: | Zeile 1: | ||
=Squid Machine einrichten= | |||
*[[SQUID für das Labor einrichten - Linux - Security und Firewall Labor]] | |||
=Content Scan= | =Content Scan= | ||
*Auf dem Client muss das CA Zertifikat des Proxy installiert sein. | *Auf dem Client muss das CA Zertifikat des Proxy installiert sein. | ||
| Zeile 12: | Zeile 15: | ||
*dnf install -y squid policycoreutils-python-utils | *dnf install -y squid policycoreutils-python-utils | ||
=Firewall für squid freischalten= | =Firewall für squid freischalten= | ||
*firewall-cmd --list-all | |||
*firewall-cmd --zone=public --add-service=squid --permanent | *firewall-cmd --zone=public --add-service=squid --permanent | ||
*firewall-cmd --reload | *firewall-cmd --reload | ||
*firewall-cmd --list-all | |||
=Erstellen eines Selbstsignierten Zertifikates= | =Erstellen eines Selbstsignierten Zertifikates= | ||
| Zeile 28: | Zeile 33: | ||
*cp squid_proxyCA.crt /etc/pki/ca-trust/source/anchors/ | *cp squid_proxyCA.crt /etc/pki/ca-trust/source/anchors/ | ||
*update-ca-trust | *update-ca-trust | ||
;Um es auf die Clients | |||
*cp squid_proxyCA.crt /tmp | |||
=Zertifikat auf den Clients installieren= | =Zertifikat auf den Clients installieren= | ||
!!!'''Wichtig Wichtig Wichtig'''!!! | !!!'''Wichtig Wichtig Wichtig'''!!! | ||
*squid_proxyCA.crt auf die Clients kopieren. | *squid_proxyCA.crt auf die Clients kopieren. | ||
;Beispiel vom Client | |||
*scp kit@proxy:/tmp/squid_proxyCA.crt . | |||
;Firefox | ;Firefox | ||
*Burgermenu | *Burgermenu | ||
| Zeile 38: | Zeile 47: | ||
****Zertifikate anzeigen | ****Zertifikate anzeigen | ||
*****Zertifizierungsstellen importieren | *****Zertifizierungsstellen importieren | ||
==Zertifikat dem System hinzufügen, damit es standardmäßig vertrauenswürdig ist== | |||
;Rocky | |||
*sudo cp squid_proxyCA.crt /etc/pki/ca-trust/source/anchors/ | *sudo cp squid_proxyCA.crt /etc/pki/ca-trust/source/anchors/ | ||
*sudo update-ca-trust | *sudo update-ca-trust | ||
;Debian | |||
*sudo cp squid_proxyCA.crt /usr/local/share/ca-certificates/ | |||
*sudo update-ca-certificates | |||
=Zertifikats Cache anlegen= | =Zertifikats Cache anlegen= | ||
| Zeile 55: | Zeile 67: | ||
=Einfügen in der squid.conf= | =Einfügen in der squid.conf= | ||
; | *cd /etc/squid | ||
*nano /etc/squid/squid.conf | |||
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 0.0.0.1-0.255.255.255 | ||
ssl_bump bump all | 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 | |||
= | =Start von Squid= | ||
*systemctl enable squid --now | |||
oder wenn er schon läuft | |||
*systemctl restart squid | *systemctl restart squid | ||
=Checks= | |||
;Ist der Port offen? | |||
*ss -lntp | |||
;Status | |||
*systemctl status squid | |||
;Journal | |||
*journalctl -n 20 -fu squid | |||
;Access Log | |||
*tail -f /var/log/squid/access.log | |||
=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 | ||
=Auf dem Client= | |||
==Ohne Proxy== | |||
;Webseite öffen | |||
*https://xinux.de | |||
;Zertifikat untersuchen | |||
*Auf das Schloss gehen | |||
**Connection Secure | |||
***More Information | |||
****View Certificate | |||
;Wie ist der Issue Name? | |||
==Proxy manuell eintragen== | |||
*Burgermenu | |||
**Settings | |||
***Suche nach proxy | |||
****Manual proxy configuration | |||
HTTP Proxy proxy.it2XX.int Port 3128 | |||
HTTPS Proxy proxy.it2XX.int Port 3128 | |||
;Webseite öffen | |||
*https://xinux.de | |||
;Zertifikat untersuchen | |||
*Auf das Schloss gehen | |||
**Connection Secure | |||
***More Information | |||
****View Certificate | |||
;Wie ist der Issue Name? | |||
Aktuelle Version vom 10. Juni 2026, 06:39 Uhr
Squid Machine einrichten
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 --list-all
- firewall-cmd --zone=public --add-service=squid --permanent
- firewall-cmd --reload
- firewall-cmd --list-all
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
- Um es auf die Clients
- cp squid_proxyCA.crt /tmp
Zertifikat auf den Clients installieren
!!!Wichtig Wichtig Wichtig!!!
- squid_proxyCA.crt auf die Clients kopieren.
- Beispiel vom Client
- scp kit@proxy:/tmp/squid_proxyCA.crt .
- 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
- Rocky
- sudo cp squid_proxyCA.crt /etc/pki/ca-trust/source/anchors/
- sudo update-ca-trust
- Debian
- sudo cp squid_proxyCA.crt /usr/local/share/ca-certificates/
- sudo update-ca-certificates
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
- cd /etc/squid
- 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
Start von Squid
- systemctl enable squid --now
oder wenn er schon läuft
- systemctl restart squid
Checks
- Ist der Port offen?
- ss -lntp
- Status
- systemctl status squid
- Journal
- journalctl -n 20 -fu squid
- Access Log
- tail -f /var/log/squid/access.log
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
Auf dem Client
Ohne Proxy
- Webseite öffen
- Zertifikat untersuchen
- Auf das Schloss gehen
- Connection Secure
- More Information
- View Certificate
- More Information
- Connection Secure
- Wie ist der Issue Name?
Proxy manuell eintragen
- Burgermenu
- Settings
- Suche nach proxy
- Manual proxy configuration
- Suche nach proxy
- Settings
HTTP Proxy proxy.it2XX.int Port 3128 HTTPS Proxy proxy.it2XX.int Port 3128
- Webseite öffen
- Zertifikat untersuchen
- Auf das Schloss gehen
- Connection Secure
- More Information
- View Certificate
- More Information
- Connection Secure
- Wie ist der Issue Name?
