Advertisement
Guest User

Gestion de iptables y script

a guest
Mar 28th, 2014
275
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.52 KB | None | 0 0
  1. #!/bin/bash
  2. # -- UTF 8 --
  3. # Simple script to manage iptables
  4. # Un script simple para gestionar iptables
  5.  
  6. OPTIONS="Exit See Edit Launch Save Enable"
  7. select opt in $OPTIONS; do
  8. if [ "$opt" = "Exit" ]; then
  9. echo done
  10. exit
  11. #2
  12. elif [ "$opt" = "See" ]; then
  13. echo "Te voy a mostrar las reglas que están vigentes"
  14. iptables -nvL
  15.  
  16. #3
  17. elif [ "$opt" = "Edit" ]; then
  18. echo "Editando el script que gestiona iptables"
  19. kdesu kate /home/user/ruta_al_script.sh
  20.  
  21. #4
  22. elif [ "$opt" = "Launch" ]; then
  23. echo "Ejecutando el script que gestiona iptables"
  24. sh /home/user/ruta_al_script.sh
  25.  
  26. #5
  27. elif [ "$opt" = "Save" ]; then
  28. echo "Guardando las reglas actuales para próximos reinicios"
  29. # Descomentar lo que corresponda o editar según necesidades
  30. # En Arch sería:
  31. # iptables-save > /etc/iptables/iptables.rules
  32. # En Debian sería:
  33. # iptables-save > /etc/iptables.up.rules
  34.  
  35. #6
  36. elif [ "$opt" = "Enable" ]; then
  37. echo "Activando el servicio iptables"
  38. # En Arch:
  39. systemctl enable iptables && systemctl start iptables
  40.  
  41. else
  42. clear
  43. echo bad option
  44. fi
  45. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement