Guest User

Untitled

a guest
Feb 21st, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. #!/bin/sh
  2. # My system IP/set ip address of server
  3. SERVER_IP="xxxxxxxx"
  4. # Flushing all rules
  5. iptables -F
  6. iptables -X
  7. # Setting default filter policy
  8. iptables -P INPUT DROP
  9. iptables -P OUTPUT DROP
  10. iptables -P FORWARD DROP
  11. # Allow unlimited traffic on loopback
  12. iptables -A INPUT -i lo -j ACCEPT
  13. iptables -A OUTPUT -o lo -j ACCEPT
  14.  
  15. # Allow incoming ssh only
  16. for port in 22 80 443
  17. do
  18. iptables -A INPUT -p tcp -s 0/0 -d $SERVER_IP --sport 513:65535 --dport $port -m state --state NEW,ESTABLISHED -j ACCEPT
  19. iptables -A OUTPUT -p tcp -s $SERVER_IP -d 0/0 --sport $port --dport 513:65535 -m state --state ESTABLISHED -j ACCEPT
  20. done
  21.  
  22. # make sure nothing comes or goes out of this boxi
  23. iptables -A INPUT -j DROP
  24. #iptables -A OUTPUT -j DROP
Add Comment
Please, Sign In to add comment