ludo1c2 a écrit :
#!/bin/bash iptables -t filter -F iptables -t filter -X # Interdire toute connexion entrante iptables -t filter -P INPUT DROP iptables -t filter -P FORWARD DROP iptables -t filter -P OUTPUT DROP # Autoriser SSH iptables -t filter -A INPUT -p tcp --dport 22 -j DROP iptables -t filter -A OUTPUT -p tcp --dport 22 -j ACCEPT # Ne pas casser les connexions etablies #iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT #iptables -A OUTPUT -m state --state RELATED,ESTABLISHED -j ACCEPT # Autoriser les requetes FTP iptables -t filter -A OUTPUT -p tcp --dport 21 -j ACCEPT # DNS iptables -t filter -A OUTPUT -p tcp --dport 53 -j ACCEPT iptables -t filter -A OUTPUT -p udp --dport 53 -j ACCEPT iptables -t filter -A INPUT -p udp --dport 53 -j ACCEPT iptables -t filter -A INPUT -p tcp --dport 53 -j ACCEPT # Serveur NTP iptables -t filter -A OUTPUT -p udp --dport 123 -j ACCEPT # Autoriser loopback iptables -t filter -A INPUT -i lo -j ACCEPT iptables -t filter -A OUTPUT -o lo -j ACCEPT # Interdire ping iptables -t filter -A INPUT -p icmp -j DROP iptables -t filter -A OUTPUT -p icmp -j DROP # HTTP et HTTPS iptables -t filter -A INPUT -p tcp --dport 80 -j ACCEPT iptables -t filter -A OUTPUT -p tcp --dport 80 -j ACCEPT iptables -t filter -A INPUT -p tcp --dport 443 -j ACCEPT iptables -t filter -A OUTPUT -p tcp --dport 443 -j ACCEPT iptables -t filter -A INPUT -p tcp --dport 8443 -j ACCEPT # FTP modprobe ip_conntrack_ftp iptables -t filter -A INPUT -p tcp --dport 20 -j ACCEPT iptables -t filter -A INPUT -p tcp --dport 21 -j ACCEPT iptables -t filter -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT # SMTP iptables -t filter -A INPUT -p tcp --dport 25 -j ACCEPT iptables -t filter -A OUTPUT -p tcp --dport 25 -j ACCEPT # POP3 iptables -t filter -A INPUT -p tcp --dport 110 -j ACCEPT iptables -t filter -A OUTPUT -p tcp --dport 110 -j ACCEPT # IMAP iptables -t filter -A INPUT -p tcp --dport 143 -j ACCEPT iptables -t filter -A OUTPUT -p tcp --dport 143 -j ACCEPT # SMTPS iptables -t filter -A INPUT -p tcp --dport 465 -j ACCEPT iptables -t filter -A OUTPUT -p tcp --dport 465 -j ACCEPT # IMAPS iptables -t filter -A INPUT -p tcp --dport 993 -j ACCEPT iptables -t filter -A OUTPUT -p tcp --dport 993 -j ACCEPT
|