123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 |
- #!/bin/sh
- if [ -e /proc/sys/net/ipv4/conf/all/rp_filter ]
- then
- for filtre in /proc/sys/net/ipv4/conf/*/rp_filter
- do
- echo 1 > $filtre
- done
- fi
- echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_all
- echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts
- modprobe ip_tables
- modprobe ip_nat_ftp
- modprobe ip_nat_irc
- modprobe iptable_filter
- modprobe iptable_nat
- modprobe ip_conntrack_irc
- modprobe ip_conntrack_ftp
- iptables -F
- iptables -X
- iptables -P INPUT ACCEPT
- iptables -P OUTPUT ACCEPT
- iptables -P FORWARD ACCEPT
- iptables -N FIREWALL
- iptables -N TRUSTED
- iptables -A FIREWALL -i eth0 -m state --state ESTABLISHED,RELATED -j ACCEPT
- iptables -A FIREWALL -i eth0 -p tcp -m tcp --dport 9922 -m state --state NEW -j ACCEPT
- iptables -A FIREWALL -i eth0 -p tcp -m tcp --sport 9922 -m state --state NEW -j ACCEPT
- iptables -A FIREWALL -i eth0 -p udp -m udp --dport 9922 -m state --state NEW -j ACCEPT
- iptables -A FIREWALL -i eth0 -p udp -m udp --sport 9922 -m state --state NEW -j ACCEPT
- iptables -A FIREWALL -i eth0 -p tcp -m tcp --dport 8080 -m state --state NEW -j ACCEPT
- iptables -A FIREWALL -i eth0 -p tcp -m tcp --sport 8080 -m state --state NEW -j ACCEPT
- iptables -A FIREWALL -i eth0 -p udp -m udp --dport 8080 -m state --state NEW -j ACCEPT
- iptables -A FIREWALL -i eth0 -p udp -m udp --sport 8080 -m state --state NEW -j ACCEPT
- iptables -A FIREWALL -i lo -j ACCEPT
- iptables -A FIREWALL -j TRUSTED
- iptables -A FIREWALL -j DROP
- iptables -A INPUT -p tcp --tcp-flags ALL ALL -j DROP
- iptables -A INPUT -m state --state INVALID -j DROP
- iptables -A INPUT -p tcp --tcp-flags ALL NONE -j DROP
- iptables -A INPUT -j FIREWALL
- iptables -A FORWARD -j DROP
- iptables -A TRUSTED -i lo -j ACCEPT
- iptables -A TRUSTED -o lo -j ACCEPT
- iptables -A TRUSTED -p tcp -m tcp --dport 21 -m state --state NEW,ESTABLISHED -j ACCEPT
- iptables -A TRUSTED -p tcp -m tcp --dport 21 -m state --state NEW,ESTABLISHED -j ACCEPT
- iptables -A TRUSTED -p tcp -m tcp --sport 20 -m state --state ESTABLISHED,RELATED -j ACCEPT
- iptables -A TRUSTED -p tcp -m tcp --dport 22 -m state --state NEW,ESTABLISHED -j DROP
- iptables -A TRUSTED -p tcp -m tcp --dport 53 -m state --state NEW,ESTABLISHED -j DROP
- iptables -A TRUSTED -p udp -m udp --dport 53 -m state --state NEW,ESTABLISHED -j DROP
- iptables -A TRUSTED -p tcp -m tcp --dport 80 -m state --state NEW,ESTABLISHED -j ACCEPT
- iptables -A TRUSTED -p tcp -m tcp --sport 80 -m state --state NEW,ESTABLISHED -j ACCEPT
- iptables -A TRUSTED -p tcp -m tcp --dport 443 -m state --state NEW,ESTABLISHED -j ACCEPT
- iptables -A TRUSTED -p tcp -m tcp --sport 443 -m state --state NEW,ESTABLISHED -j ACCEPT
- iptables -A TRUSTED -p tcp -m tcp --dport 3306 -m state --state NEW,ESTABLISHED -j ACCEPT
- iptables -A TRUSTED -p tcp -m tcp --dport 110 -m state --state NEW,ESTABLISHED -j DROP
- iptables -A TRUSTED -p tcp -m tcp --dport 465 -m state --state NEW,ESTABLISHED -j DROP
- iptables -A TRUSTED -p tcp -m tcp --dport 485 -m state --state NEW,ESTABLISHED -j DROP
- iptables -A TRUSTED -p tcp -m tcp --dport 587 -m state --state NEW,ESTABLISHED -j DROP
- iptables -A TRUSTED -p tcp -m tcp --dport 995 -m state --state NEW,ESTABLISHED -j DROP
- iptables -A TRUSTED -p tcp -m tcp --dport 8443 -m state --state NEW,ESTABLISHED -j DROP
- iptables -A TRUSTED -p tcp -m tcp --dport 8447 -m state --state NEW,ESTABLISHED -j DROP
- iptables -A TRUSTED -p tcp -m tcp --dport 9922 -m state --state NEW,ESTABLISHED -j ACCEPT
- iptables -A TRUSTED -p tcp -m tcp --sport 9922 -m state --state NEW,ESTABLISHED -j ACCEPT
- iptables -A TRUSTED -p udp -m udp --dport 9922 -m state --state NEW,ESTABLISHED -j ACCEPT
- iptables -A TRUSTED -p udp -m udp --sport 9922 -m state --state NEW,ESTABLISHED -j ACCEPT
- iptables -A TRUSTED -p tcp -m tcp --dport 8080 -m state --state NEW,ESTABLISHED -j ACCEPT
- iptables -A TRUSTED -p tcp -m tcp --sport 8080 -m state --state NEW,ESTABLISHED -j ACCEPT
- iptables -A TRUSTED -p udp -m udp --dport 8080 -m state --state NEW,ESTABLISHED -j ACCEPT
- iptables -A TRUSTED -p udp -m udp --sport 8080 -m state --state NEW,ESTABLISHED -j ACCEPT
- echo " [End iptables rules setting]"
|