Hey Leute, ich hatte gestern schon mal bzgl. DNS und iptables gefragt, dabei ging es aber nur um das droppen des Input. Wollte nun aber mal testweise den Server ganz dicht machen, also auch den Output kontrollieren. Config sihet derzeit so aus:
# Delete all existing rules
iptables -F
# Stateless firewall
iptables -t raw -I PREROUTING -j NOTRACK
iptables -t raw -I OUTPUT -j NOTRACK
# Set default chain policies
iptables -P INPUT DROP
iptables -P FORWARD DROP
iptables -P OUTPUT DROP
# Allow loopback access
iptables -A INPUT -i lo -j ACCEPT
iptables -A OUTPUT -o lo -j ACCEPT
# Allow inbound/outbound SSH
iptables -A INPUT -p tcp --dport 22448 -j ACCEPT
iptables -A OUTPUT -p tcp --sport 22448 -j ACCEPT
iptables -A OUTPUT -p tcp --dport 22448 -j ACCEPT
iptables -A INPUT -p tcp --sport 22448 -j ACCEPT
# Allow inbound/outbound HTTP
iptables -A INPUT -p tcp --dport 80 -j ACCEPT
iptables -A OUTPUT -p tcp --sport 80 -j ACCEPT
iptables -A OUTPUT -p tcp --dport 80 -j ACCEPT
iptables -A INPUT -p tcp --sport 80 -j ACCEPT
# Allow inbound/outbound HTTPS
iptables -A INPUT -p tcp --dport 443 -j ACCEPT
iptables -A OUTPUT -p tcp --sport 443 -j ACCEPT
iptables -A OUTPUT -p tcp --dport 443 -j ACCEPT
iptables -A INPUT -p tcp --sport 443 -j ACCEPT
# Ping from inside to outside
iptables -A OUTPUT -p icmp --icmp-type echo-request -j ACCEPT
iptables -A INPUT -p icmp --icmp-type echo-reply -j ACCEPT
# Ping from outside to inside
iptables -A INPUT -p icmp --icmp-type echo-request -j ACCEPT
iptables -A OUTPUT -p icmp --icmp-type echo-reply -j ACCEPT
# Allow outbound DNS
iptables -A OUTPUT -p udp --dport 53 -j ACCEPT
iptables -A OUTPUT -p tcp --dport 53 -j ACCEPT
# Allow outbound NTP
iptables -A OUTPUT -p udp --dport 123 -j ACCEPT
iptables -A INPUT -p udp --sport 123 -j ACCEPT
# Allow certain types of ICMP signalling traffic
iptables -A INPUT -p icmp --icmp-type destination-unreachable -j ACCEPT
### VPN Settings ###
# Allow inbound/outbound OpenVPN
iptables -A INPUT -p tcp --dport 1194 -j ACCEPT
iptables -A INPUT -p udp --dport 1194 -j ACCEPT
iptables -A OUTPUT -p udp --sport 1194 -j ACCEPT
# Allow everything from within the VPN
iptables -I INPUT -i tun0 -j ACCEPT
iptables -I OUTPUT -o tun0 -j ACCEPT
# TCP/IP to do "three way handshakes":
iptables -I INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
Server läuft, zusätzliche Dienste laufen, VPN läuft, Pi-Hole läuft. Aber egal, ob ich Pi-Hole als DNS intern nutze, oder z.B. den google DNS, ... ich bekomme bei OpenVPN kein DNS Lookup
Droppe ich hingegen nur den Input für den Port 53 und greife per VPN darauf zu,
... funktioniert alles ohne Probleme. Scheint also irgendwo am gedropten Output zu liegen. Wäre für jede Idee oder Anregung dankbar!