Hi,
könnte sich mal jemand meine iptables anschaun und mir sagen ob das so taugt für einen Homeserver? Der Rechner hängt direkt am Netz, da bin ich manchmal etwas paranoid und da meine iptables skills noch nicht so gut sind hol dich da lieber mal Drittmeinungen ein
cu
serow
könnte sich mal jemand meine iptables anschaun und mir sagen ob das so taugt für einen Homeserver? Der Rechner hängt direkt am Netz, da bin ich manchmal etwas paranoid und da meine iptables skills noch nicht so gut sind hol dich da lieber mal Drittmeinungen ein
Code:
#!/bin/bash
###################################
# SETUP
###################################
modprobe ip_conntrack
echo "1" > /proc/sys/net/ipv4/ip_forward
echo "0" > /proc/sys/net/ipv4/ip_dynaddr
###################################
# CLEAR ALL AND SET DEFAULTS
###################################
# clear all
iptables -F INPUT
iptables -F OUTPUT
iptables -F FORWARD
iptables -t nat -F
# set policies
iptables -P INPUT DROP
iptables -P OUTPUT ACCEPT
iptables -P FORWARD DROP
###################################
# ALLOW ALL TRAFFIC ON LOOPBACK
###################################
iptables -A INPUT -i lo -j ACCEPT
iptables -A OUTPUT -o lo -j ACCEPT
###################################
# EXCEPTIONS OF THE INPUT POLICY
###################################
# allow all traffic from the inside
iptables -A INPUT -i eth0 -j ACCEPT
# allow port 22 from the outside
iptables -A INPUT -i ppp0 -p tcp --dport 22 -j ACCEPT
# allow port 80 from the outside
iptables -A INPUT -i ppp0 -p tcp --dport 80 -j ACCEPT
# allow related
iptables -A INPUT -i ppp0 -m state --state RELATED,ESTABLISHED -j ACCEPT
# log all tcp traffic that will be dropped
iptables -A INPUT -i ppp0 -p tcp -j LOG
###################################
# EXCEPTIONS OF THE FORWARD POLICY
###################################
# allow all traffic to pass from the inside to the outside
iptables -A FORWARD -i eth0 -o ppp0 -j ACCEPT
# and allow related traffic to be forwarded to the inside
iptables -A FORWARD -i ppp0 -o eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT
# enable source nat
iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE
cu
serow