Advertisement
rafaelsnsa

Firewall

Nov 8th, 2018
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.65 KB | None | 0 0
  1. #!/bin/bash
  2. #Criar o presente script no diretório /mnt/config com o nome firewall.sh e executa-lo com o comando "bash /mnt/config/firewall.sh
  3.  
  4. LOCALNET=192.168.1.10/24
  5. SIPSERVER=192.168.1.0
  6.  
  7. iptables -F
  8. iptables -X
  9. iptables -P INPUT DROP
  10.  
  11. # SSH
  12. iptables -A INPUT -p tcp --dport 22 -s $LOCALNET -j ACCEPT
  13.  
  14. # Rede Interna
  15. iptables -A INPUT -s $LOCALNET -j ACCEPT
  16.  
  17. # SIP Server
  18. iptables -A INPUT -p udp -s $SIPSERVER -j ACCEPT
  19.  
  20. # Libera ping
  21. iptables -A INPUT -p icmp -j ACCEPT
  22.  
  23. iptables -P OUTPUT ACCEPT
  24.  
  25. echo "Executar o comando 'iptables-save > /etc/iptables.conf'"
  26. echo "Logo após, executar o comando 'cp /etc/iptables.conf /mnt/config/'"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement