Na esperança de que isso possa ser útil, aqui está uma cópia de um conjunto de regras IPTABLES que deve ser razoavelmente seguro, mas ainda permitir acesso a serviços padrão e alguns não-padrão:
*filter
# Reject some specifics (picked up from logs & fail2ban)
# -A INPUT -s 213.239.213.102 -j LOG --log-prefix "iptables DROP: " --log-level 7
# -A INPUT -s 213.239.213.102 -j REJECT
# -A INPUT -s 208.76.245.135 -j LOG --log-prefix "iptables DROP: " --log-level 7
# -A INPUT -s 208.76.245.135 -j REJECT
-A INPUT -s 78.189.110.91 -j LOG --log-prefix "iptables DROP: " --log-level 7
-A INPUT -s 78.189.110.91 -j REJECT
# Allows all loopback (lo0) traffic and drop all traffic to 127/8 that doesn't use lo0
-A INPUT -i lo -j ACCEPT
-A INPUT ! -i lo -d 127.0.0.0/8 -j REJECT
# Accepts all established inbound connections
# This is best:
#-A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
# But the extension might not be available so may need to use this:
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
# Allows all outbound traffic
# You can modify this to only allow certain traffic
-A OUTPUT -j ACCEPT
# Allows HTTP and HTTPS connections from anywhere (the normal ports for websites)
-A INPUT -p tcp --dport 80 -j ACCEPT
-A INPUT -p tcp --dport 443 -j ACCEPT
# Allow non-standard http(s) connections for Node.js etc
-A INPUT -p tcp --dport 5050:5151 -j ACCEPT
# Allows SSH connections (on non-standard port <1024)
-A INPUT -p tcp -m state --state NEW --dport 444 -j ACCEPT
# Allows mail connections
-A INPUT -p tcp -m state --state NEW,ESTABLISHED --dport 25 -j ACCEPT
-A INPUT -p tcp -m state --state NEW,ESTABLISHED --dport 465 -j ACCEPT
-A INPUT -p tcp -m state --state NEW,ESTABLISHED --dport 585 -j ACCEPT
-A INPUT -p tcp -m state --state NEW,ESTABLISHED --dport 993 -j ACCEPT
-A INPUT -p tcp -m state --state NEW,ESTABLISHED --dport 995 -j ACCEPT
# Allow ping
-A INPUT -p icmp -m icmp --icmp-type 8 -j ACCEPT
# log iptables denied calls
-A INPUT -m limit --limit 5/min -j LOG --log-prefix "iptables DENY: " --log-level 7
# Reject all other inbound - default deny unless explicitly allowed policy
-A INPUT -j REJECT
-A FORWARD -j REJECT
COMMIT
# ----------------------------------------------------
# NAT Rules
# ----------------------------------------------------
*nat
:PREROUTING ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
COMMIT
*mangle
:FORWARD ACCEPT [0:0]
:INPUT ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:PREROUTING ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
COMMIT
# Completed
Note que esta versão não está bloqueando a saída, mas seria melhor fazê-lo. Além disso, se você não precisa que seu servidor tenha acesso a / de algumas dessas redes, simplesmente bloqueie-as 1.9. . , etc. Pelo menos por um tempo.