Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # Vider les tables actuelles
- iptables -t filter -F
- # Vider les règles personnelles
- iptables -t filter -X
- # Interdire toute connexion entrante et sortante
- iptables -t filter -P INPUT DROP
- iptables -t filter -P FORWARD DROP
- iptables -t filter -P OUTPUT ACCEPT # On va autoriser toutes les requetes sortantes
- # ---
- # 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 loopback
- iptables -t filter -A INPUT -i lo -j ACCEPT
- iptables -t filter -A OUTPUT -o lo -j ACCEPT
- # ICMP (Ping)
- iptables -t filter -A INPUT -p icmp -j ACCEPT
- iptables -t filter -A OUTPUT -p icmp -j ACCEPT
- # ---
- # SSH In
- iptables -t filter -A INPUT -p tcp --dport 666 -j ACCEPT
- # SSH Out
- iptables -t filter -A OUTPUT -p tcp --dport 666 -j ACCEPT
- # DNS In/Out
- 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 tcp --dport 53 -j ACCEPT
- iptables -t filter -A INPUT -p udp --dport 53 -j ACCEPT
- # NTP
- iptables -t filter -A OUTPUT -p udp --dport 123 -j ACCEPT
- # Mail SMTP:25
- iptables -t filter -A INPUT -p tcp --dport 25 -j ACCEPT
- iptables -t filter -A OUTPUT -p tcp --dport 25 -j ACCEPT
- # Banlist
- iptables -t filter -A INPUT -p udp --dport 1311 -j ACCEPT
- iptables -t filter -A OUTPUT -p udp --dport 1311 -j ACCEPT
- # FTP Out
- iptables -t filter -A OUTPUT -p tcp --dport 20:21 -j ACCEPT
- # FTP In
- modprobe ip_conntrack_ftp # ligne facultative avec les serveurs OVH
- iptables -t filter -A INPUT -p tcp --dport 20:21 -j ACCEPT
- iptables -t filter -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
- # DDoS
- iptables -A FORWARD -p tcp --syn -m limit --limit 1/second -j ACCEPT
- iptables -A FORWARD -p udp -m limit --limit 1/second -j ACCEPT
- iptables -A FORWARD -p icmp --icmp-type echo-request -m limit --limit 1/second -j ACCEPT
- # Scan de ports
- iptables -A FORWARD -p tcp --tcp-flags SYN,ACK,FIN,RST RST -m limit --limit 1/s -j ACCEPT
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement