Advertisement
Guest User

Untitled

a guest
Feb 24th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.98 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. ### BEGIN INIT INFO
  4. # Provides: Firewall maison
  5. # Required-Start: $local_fs $remote_fs $network $syslog
  6. # Required-Stop: $local_fs $remote_fs $network $syslog
  7. # Default-Start:
  8. # Default-Stop:
  9. # X-Interactive: false
  10. # Short-Description: Firewall maison
  11. ### END INIT INFO
  12.  
  13. # Mise à zero
  14.  
  15. iptables -t filter -F
  16. iptables -t filter -X
  17. echo "Mise à zero"
  18.  
  19. # Interdition de port
  20.  
  21. iptables -t filter -P INPUT DROP
  22. iptables -t filter -P FORWARD DROP
  23. iptables -t filter -P OUTPUT DROP
  24. echo "Interdition de port"
  25.  
  26. # Ne pas couper les connexions etablies
  27.  
  28. iptables -A INPUT -m state --state RELATE,ESTABLISHED -j ACCEPT
  29. iptables -A OUTPUT -m state --state RELATE,ESTABLISHED -j ACCEPT
  30. echo "Ne pas couper les connexions etablies"
  31.  
  32. # Autorise le loopback
  33.  
  34. iptables -t filter -A INPUT -i lo -j ACCEPT
  35. iptables -t filter -A OUTPUT -o lo -j ACCEPT
  36. echo "Autorise le loopback"
  37.  
  38. # ICMP
  39.  
  40. iptables -t filter -A INPUT -p icmp -j ACCEPT
  41. iptables -t filter -A OUTPUT -p icmp -j ACCEPT
  42. echo "Ping OK"
  43.  
  44. # SHH IN/OUT
  45.  
  46. iptables -t filter -A INPUT -p tcp --dport 22 -j ACCEPT
  47. iptables -t filter -A OUTPUT -p tcp --dport 22 -j ACCEPT
  48. echo "SHH IN/OUT OK"
  49.  
  50. # DNS IN/OUT
  51.  
  52. iptables -t filter -A INPUT -p udp --dport 53 -j ACCEPT
  53. iptables -t filter -A INPUT -p tcp --dport 53 -j ACCEPT
  54. iptables -t filter -A OUTPUT -p tcp --dport 53 -j ACCEPT
  55. iptables -t filter -A OUTPUT -p udp --dport 53 -j ACCEPT
  56. echo "DNS IN/OUT OK"
  57.  
  58. # NTP OUT
  59.  
  60. iptables -t filter -A OUTPUT -p udp --dport 123 -j ACCEPT
  61. echo "NTP OUT OK"
  62.  
  63. # HTTP / HTTPS OUT
  64.  
  65. iptables -t filter -A OUTPUT -p tcp --dport 80 -j ACCEPT
  66. iptables -t filter -A OUTPUT -p tcp --dport 443 -j ACCEPT
  67. echo "HTTP / HTTPS OUT OK"
  68.  
  69. # FTP OUT
  70.  
  71. iptables -t filter -A OUTPUT -p tcp --dport 21 -j ACCEPT
  72. iptables -t filter -A OUTPUT -p tcp --dport 20 -j ACCEPT
  73. echo "FTP OUT OK"
  74.  
  75. # FTP IN
  76.  
  77. iptables -t filter -A INPUT -p tcp --dport 21 -j ACCEPT
  78. iptables -t filter -A INPUT -p tcp --dport 20 -j ACCEPT
  79. iptables -t filter -A INPUT -m state --state ESTABLISHED,RELATE -j ACCEPT
  80. echo "FTP IN OK"
  81.  
  82. # TEAMSPEAK
  83.  
  84. iptables -t filter -A INPUT -p udp --dport 9987 -j ACCEPT
  85. iptables -t filter -A INPUT -p tcp --dport 10011 -j ACCEPT
  86. iptables -t filter -A INPUT -p tcp --dport 30033 -j ACCEPT
  87. iptables -t filter -A OUTPUT -p udp --dport 9987 -j ACCEPT
  88. iptables -t filter -A OUTPUT -p tcp --dport 10011 -j ACCEPT
  89. iptables -t filter -A OUTPUT -p tcp --dport 30033 -j ACCEPT
  90. echo "TEAMSPEAK OK"
  91.  
  92. # SINUSBOT
  93.  
  94. iptables -t filter -A INPUT -p udp --dport 8087 -j ACCEPT
  95. iptables -t filter -A INPUT -p tcp --dport 8087 -j ACCEPT
  96. iptables -t filter -A OUTPUT -p udp --dport 8087 -j ACCEPT
  97. iptables -t filter -A OUTPUT -p tcp --dport 8087 -j ACCEPT
  98. echo "SINUSBOT OK"
  99.  
  100. # MINECRAFT
  101.  
  102. iptables -t filter -A INPUT -p udp --dport 25565 -j ACCEPT
  103. iptables -t filter -A INPUT -p tcp --dport 10011 -j ACCEPT
  104. iptables -t filter -A OUTPUT -p udp --dport 25565 -j ACCEPT
  105. iptables -t filter -A OUTPUT -p tcp --dport 10011 -j ACCEPT
  106. echo "MINECRAFT OK"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement