Advertisement
scriptz-team

[SSH] iPTABLES RULES EXAMPLE

Apr 28th, 2012
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.79 KB | None | 0 0
  1. _____ _____ _ _____ _____ _____ _____ _____ _____
  2. ___| | __ |_| _ |_ _|___ ___|_ _| __| _ | |
  3. |_ -| --| -| | __| | | |- _|___| | | | __| | | | |
  4. |___|_____|__|__|_|__| |_| |___| |_| |_____|__|__|_|_|_|
  5. |s C R i P T z - T E A M . i N F O|████████████████████████████
  6.  
  7. - iNfO -
  8.  
  9. [SSH] iPTABLES RULES EXAMPLE
  10.  
  11. - NOtIcE -
  12.  
  13. Login to ssh and enter:
  14.  
  15. Block ip (aaa.bbb.ccc.ddd is IP):
  16. iptables -A INPUT -s aaa.bbb.ccc.ddd -j DROP
  17. service iptables save
  18.  
  19. View iptables:
  20. vi /etc/sysconfig/iptables
  21.  
  22. Locking ports:
  23. iptables -I INPUT -p tcp --dport 21 -j DROP
  24. iptables -I INPUT -p tcp --dport 443 -j DROP
  25. iptables -I INPUT -p tcp --dport 25 -j DROP
  26. iptables -I INPUT -p tcp --dport 143 -j DROP
  27. iptables -I INPUT -p tcp --dport 110 -j DROP
  28. iptables -I INPUT -p tcp --dport 22 -j DROP
  29. iptables -I INPUT -p tcp --dport 3306 -j DROP
  30. iptables -I INPUT -p tcp --dport 7777 -j DROP
  31. iptables -I INPUT -p tcp --dport 7778 -j DROP
  32. iptables -I INPUT -p tcp --dport 6666 -j DROP
  33. iptables -I INPUT -s aaa.bbb.ccc.ddd -p tcp --dport 21 -j ACCEPT
  34. iptables -I INPUT -s aaa.bbb.ccc.ddd -p tcp --dport 3306 -j ACCEPT
  35. iptables -I INPUT -s aaa.bbb.ccc.ddd -p tcp --dport 110 -j ACCEPT
  36. iptables -I INPUT -s aaa.bbb.ccc.ddd -p tcp --dport 25 -j ACCEPT
  37. iptables -I INPUT -s aaa.bbb.ccc.ddd -p tcp --dport 7777 -j ACCEPT
  38. iptables -I INPUT -s aaa.bbb.ccc.ddd -p tcp --dport 7778 -j ACCEPT
  39. iptables -I INPUT -s aaa.bbb.ccc.ddd -p tcp --dport 6666 -j ACCEPT
  40.  
  41. Where aaa.bbb.ccc.ddd is your IP address from which you are connecting to server.
  42. Important! After rebooting your server, you need to setup iptables rules again.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement