Advertisement
LightProgrammer000

Firewall [Rules of Security]

Jan 15th, 2019
339
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.61 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # Limpar todas as regras pré existentes
  4. iptables -F
  5. iptables -t nat -F
  6. iptables -t mangle -F
  7.  
  8. # A linha abaixo ativa o módulo do netfilter que evita ataques DoS
  9. echo 1 > /proc/sys/net/ipv4/tcp_syncookies
  10.  
  11. # Liberar portas dos serviços necessários
  12. iptables -A INPUT -p tcp --dport 22 -j ACCEPT
  13. iptables -A INPUT -p tcp --dport 80 -j ACCEPT
  14. iptables -A INPUT -p tcp --dport 443 -j ACCEPT
  15. iptables -A INPUT -p tcp --dport 3306 -j ACCEPT
  16.  
  17. # Bloqueio de PING
  18. iptables -I INPUT -p ICMP -j DROP
  19.  
  20. # A linha abaixo faz o bloqueio de conexões nas demais portas
  21. iptables -A INPUT -p tcp --syn -j DROP
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement