Advertisement
Guest User

Untitled

a guest
Dec 9th, 2016
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  1. iptables -t filter -F
  2. iptables -t filter -X
  3. iptables -t filter -P INPUT DROP
  4. iptables -t filter -P FORWARD DROP
  5. iptables -t filter -P OUTPUT DROP
  6. iptables -t filter -A INPUT -o lo -s 0.0.0.0/0 -d 0.0.0.0/0 -j ACCEPT
  7. or
  8. iptables -A INPUT ! -i lo -d 127.0.0.0/8 -j REJECT
  9. iptables -A INPUT -i lo -j ACCEPT
  10. iptables -A OUTPUT -p icmp -m conntrack --ctstate NEW,ESTABLISHED,RELATED -j ACCEPT
  11. iptables -A INPUT --protocol tcp --tcp-flags ALL SYN,ACK -j DROP
  12. iptables -A INPUT -m pkttype --pkt-type broadcast -j DROP
  13. iptables -A INPUT -m conntrack --ctstate ESTABLISHED -j ACCEPT
  14. iptables -A OUTPUT -m state ! --state INVALID -j ACCEPT
  15. #if I want to open a port:
  16. iptables -t filter -A INPUT -s 192.168.0.0/24 --dport 110 -j ACCEPT
  17. iptables -t filter -A OUTPUT -s 192.168.0.0/24 --sport 110 -j ACCEPT
  18. #
  19. iptables -A INPUT -m limit --limit 5/min -j LOG --log-prefix "iptables denied: " --log-level 7
  20. iptables -A FORWARD -p icmp --icmp-type echo-request -m limit --limit 1/s -j ACCEPT
  21. iptables -A FORWARD -p tcp --syn -m limit --limit 1/second -j ACCEPT
  22. iptables -A FORWARD -p udp -m limit --limit 1/second -j ACCEPT
  23. iptables -A FORWARD -p icmp --icmp-type echo-request -m limit --limit 1/second -j ACCEPT
  24. 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