Bonjour,
je viens de terminer ma première configuration iptables pour mon serveur web et j'aimerai avoir un avis extérieur



*filter
# 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
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT

# Allows all outbound traffic
# You could modify this to only allow certain traffic
-A OUTPUT -j ACCEPT

# Je cree une chaine pour les DROP

-N LOGGINGDROP

# Rejet de tous les appels sur le port 23
-A INPUT -p tcp -m tcp --dport 23 -m state --state NEW -j LOGGINGDROP

# Rejet de certaines IP
-A INPUT -s 1.160.110.84  -j LOGGINGDROP
-A INPUT -s 95.154.29.197  -j LOGGINGDROP

# log au maximum 2 fois / minutes les paquets recuent des IP DROP
-A LOGGINGDROP -m limit --limit 2/min -j LOG --log-prefix "IPTables-Dropped: " --log-level 7
# Drop les paquets des IP qui ont ete loggue
-A LOGGINGDROP -j DROP

# LOG connection on SSH port
-A INPUT -p tcp -m tcp --dport XXXX -m state --state NEW -j LOG --log-level 4 --log-prefix "SSHD_Connection: "
# Allows SSH connections
# The --dport number is the same as in /etc/ssh/sshd_config
-A INPUT -p tcp -m state --state NEW --dport XXXX -j ACCEPT

# Allow ping
#  note that blocking other types of icmp packets is considered a bad idea by some
#  remove -m icmp --icmp-type 8 from this line to allow all kinds of icmp:
#   https://security.stackexchange.com/questions/22711
 
-A INPUT -p icmp -m icmp --icmp-type 8 -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

# log iptables denied calls (access via 'dmesg' command)
-A INPUT -m limit --limit 5/min -j LOG --log-prefix "iptables denied: " --log-level 7

# Reject all other inbound - default deny unless explicitly allowed policy:
-A INPUT -j REJECT
-A FORWARD -j REJECT

COMMIT



A +