Änderungsstand: 2022-05-29
Ich verwende in meinem eigenen Netzwerk einen Traefik-Reverse-Proxy und einen eigenen DNS-Server. Wer nicht so viel Energie in seinem System stecken möchte, könnte es für den Anfang auch mit einem normalen Proxy versuchen. Wer die Unterschiede zwischen einen Proxy und einen Reverse-Proxy noch nicht kennt, sollte sich vorher, bei einem Suchanbieter seines Vertrauens, informieren 🙂
Squid- und Polipo Proxy.
Ich verwende dafür Raspian-Lite, ohne weitere Zusätze. Hier ist der Guide dafür.
apt update
apt upgrade -y
apt autoremove -y
rpi-update
Squid-Proxy
Hier wird ein einfacher Proxy-Server erstellt, ohne weiterer besonderen Einstellungen. Einfach nur, um die Arbeitsweise zu lernen. Kein SSl, keine Blacklist oder Whitelist.
Jetzt den Proxyserver Squid installieren:
sudo apt install squid
Jetzt die Squid-Config Sichern, löschen und neu erstellen:
sudo cp /etc/squid/squid.conf /etc/squid/squid.conf.bak
sudo rm /etc/squid/squid.conf
Jetzt die Neu erstellte Config beschreiben:
sudo nano /etc/squid/squid.conf
http_port 3128
acl localnet src 192.168.1.0/24 # mynetwork
acl SSL_ports port 443
acl Safe_ports port 80 # http
acl Safe_ports port 21 # ftp
acl Safe_ports port 443 # https
acl Safe_ports port 70 # gopher
acl Safe_ports port 210 # wais
acl Safe_ports port 1025-65535 # unregistered ports
acl Safe_ports port 280 # http-mgmt
acl Safe_ports port 488 # gss-http
acl Safe_ports port 591 # filemaker
acl Safe_ports port 777 # multiling http
acl CONNECT method CONNECT
http_access allow localnet
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
include /etc/squid/conf.d/*
http_access allow localhost
http_access allow all
coredump_dir /var/spool/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
STRG-x, y, Enter
sudo systemctl restart squid.service
sudo systemctl enable squid
Die Standardkonfiguration des Proxy steht. Am Windows 10-Rechner z.B. kann man jetzt diesen Proxy, mit der IP-Adresse des Raspi und Port 3128 hinzufügen.
Eine sehr ausführliche Beschreibung, inkl. SSL gibt es in der Quelle-Angabe.
Quelle: https://www.bytebee.de/raspberry-proxy-server/
Da der Squid-Proxy aber nicht besonders ressourcenschonend ist, hier ein weiteres Beispiel eines Proxy mit polipo.
Polipo Proxy
Paket ist nun nicht mehr in den Pros vorhanden. Ich lasse meine Aufzeichnungen trotzdem drin.
sudo apt install polipo
proxyName ist bei mir der Name des Raspi. Nicht verwirren lassen. Meiner heißt reverse-proxy und das ist Zufall. Die IP meines Raspi ist in diesem Fall die 192.168.252.225.
sudo nano /etc/polipo/config
proxyAddress = "192.168.252.225"
allowedClients = 127.0.0.1, 192.168.252.0/24
allowedPorts = 1-65535
tunnelAllowedPorts = 1-65535
proxyName = "reverse-proxy"
localDocumentRoot = "192.168.252.225/usr/share/polipo/www/"
STRG-x, y, Enter
sudo service polipo start
Als Proxy-Port wird 8123 verwendet.
Folgender Befehl startet den Proxy automatisch, wenn der Raspi gestartet wird:
sudo update-rc.d polipo defaults
In folgender Config-Datei können Websites permanent geblockt werden.
sudo nano /etc/polipo/forbidden
# Sample forbidden URLs file for polipo. -*-sh-*-
# Put this in /etc/polipo/forbidden or in ~/.polipo-forbidden.
# Forbid all hosts belonging to a given domain name:
counter.com
hitbox.com
doubleclick.net
www.cashcount.com
mackeeperapp3.mackeeper.com
# Forbid all hosts contaning a string matching a given regex. Note
# that you need to quote dots, so that a regex is not misinterpreted
# as a domain name.
#^http://[^/]*counter\.com
#/ads/
#/phpAdsNew
#counting\.php
STRG-x, y, Enter
Nach Änderungen an der Config, folgenden Befehl anwenden:
sudo service polipo restart
Die Standardkonfiguration des Proxy steht. Am Windows 10-Rechner z.B. kann man jetzt diesen Proxy, mit der IP-Adresse des Raspi und Port 8123 hinzufügen.
.
Quelle(n):
https://www.poftut.com/how-to-install-and-config-polipo-caching-web-proxy-on-linux