Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- iptables -F
- iptables -X
- iptables -t nat -F
- iptables -P INPUT DROP
- iptables -P OUTPUT DROP
- iptables -P FORWARD DROP
- #autorisation ICMP
- iptables -A INPUT -p icmp --icmp-type echo-reply -j ACCEPT
- iptables -A OUTPUT -p icmp --icmp-type echo-reply -j ACCEPT
- #SSH
- iptables -A INPUT -s 192.168.1.0/24 -p tcp --dport 22 -m state --state NEW,RELATED,ESTABLISHED -j ACCEPT
- iptables -A OUTPUT -d 192.168.1.0/24 -p tcp --sport 22 -m state --state RELATED,ESTABLISHED -j ACCEPT
- #HTTPS iface
- iptables -A INPUT -p tcp --dport 443 -m state --state NEW,RELATED,ESTABLISHED -j ACCEPT
- iptables -A OUTPUT -p tcp --sport 443 -m state --state RELATED,ESTABLISHED -j ACCEPT
- #video Salon
- iptables -A INPUT -s 192.168.1.50 -p tcp --sport 80 -m state --state RELATED,ESTABLISHED -j ACCEPT
- iptables -A OUTPUT -d 192.168.1.50 -p tcp --dport 80 -m state --state NEW,RELATED,ESTABLISHED -j ACCEPT
- #DNS
- iptables -A INPUT -p udp --sport 53 -m state --state RELATED,ESTABLISHED -j ACCEPT
- iptables -A OUTPUT -p udp --dport 53 -m state --state NEW,RELATED,ESTABLISHED -j ACCEPT
- #HTTP iface
- iptables -A INPUT -s 192.168.1.0/24 -p tcp --dport 8765 -m state --state NEW,RELATED,ESTABLISHED -j ACCEPT
- iptables -A OUTPUT -d 192.168.1.0/24 -p tcp --sport 8765 -m state --state RELATED,ESTABLISHED -j ACCEPT
- #loopback
- iptables -A INPUT -i lo -j ACCEPT
- iptables -A OUTPUT -o lo -j ACCEPT
- #samba
- iptables -A OUTPUT -p udp -m udp --dport 137 -m state --state NEW,RELATED,ESTABLISHED -j ACCEPT
- iptables -A OUTPUT -p udp -m udp --dport 138 -m state --state NEW,RELATED,ESTABLISHED -j ACCEPT
- iptables -A OUTPUT -p tcp -m tcp --dport 139 -m state --state NEW,RELATED,ESTABLISHED -j ACCEPT
- iptables -A OUTPUT -p tcp -m tcp --dport 445 -m state --state NEW,RELATED,ESTABLISHED -j ACCEPT
- iptables -A INPUT -p udp -m udp --sport 137 -m state --state RELATED,ESTABLISHED -j ACCEPT
- iptables -A INPUT -p udp -m udp --sport 138 -m state --state RELATED,ESTABLISHED -j ACCEPT
- iptables -A INPUT -p tcp -m tcp --sport 139 -m state --state RELATED,ESTABLISHED -j ACCEPT
- iptables -A INPUT -p tcp -m tcp --sport 445 -m state --state RELATED,ESTABLISHED -j ACCEPT
- #DHCP + NTP
- iptables -A INPUT -p udp --match multiport --dports 67,68 -j ACCEPT
- iptables -A OUTPUT -p udp --match multiport --dports 67,68 -j ACCEPT
- iptables -A OUTPUT -p udp --dport 123 -j ACCEPT
- iptables -A INPUT -p udp --sport 123 -j ACCEPT
- #LOGGING
- iptables -N LOGGING
- iptables -A INPUT -j LOGGING
- iptables -A OUTPUT -j LOGGING
- iptables -A LOGGING -m limit --limit 2/min -j LOG --log-prefix "IPTables-Dropped: " --log-level 4
- iptables -A LOGGING -j DROP
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement