Share Pastebin
Guest
Public paste!

Untitled

By: a guest | Mar 19th, 2010 | Syntax: None | Size: 2.94 KB | Hits: 81 | Expires: Never
Copy text to clipboard
  1. #!/bin/bash
  2.  
  3. # Iptable  
  4.  
  5. # Vider les tables actuelles
  6. iptables -t filter -F
  7. iptables -t filter -X
  8. echo - Vidage : [OK]
  9.  
  10. # Autoriser SSH
  11. iptables -t filter -A INPUT -p tcp --dport 22 -j ACCEPT
  12. iptables -t filter -A OUTPUT -p tcp --dport 22 -j ACCEPT
  13. echo - Autoriser SSH : [OK]
  14.  
  15. # Ne pas casser les connexions etablies
  16. iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
  17. iptables -A OUTPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
  18. echo - Ne pas casser les connexions établies : [OK]
  19.  
  20. # Interdire toute connexion entrante
  21. iptables -t filter -P INPUT DROP
  22. iptables -t filter -P FORWARD DROP
  23. echo - Interdire toute connexion entrante : [OK]
  24.  
  25. # Interdire toute connexion sortante
  26. iptables -t filter -P OUTPUT DROP
  27. echo - Interdire toute connexion sortante : [OK]
  28.  
  29. # Autoriser les requetes DNS, FTP, HTTP, NTP
  30. iptables -t filter -A OUTPUT -p tcp --dport 21 -j ACCEPT
  31. iptables -t filter -A OUTPUT -p tcp --dport 80 -j ACCEPT
  32. iptables -t filter -A OUTPUT -p udp --dport 53 -j ACCEPT
  33. iptables -t filter -A OUTPUT -p udp --dport 123 -j ACCEPT
  34. echo - Autoriser les requetes DNS, FTP, HTTP, NTP : [OK]
  35.  
  36. # Autoriser loopback
  37. iptables -t filter -A INPUT -i lo -j ACCEPT
  38. iptables -t filter -A OUTPUT -o lo -j ACCEPT
  39. echo - Autoriser loopback : [OK]
  40.  
  41. # Autoriser ping pour OVH
  42. iptables -t filter -A INPUT -p icmp -j ACCEPT
  43. iptables -t filter -A OUTPUT -p icmp -j ACCEPT
  44.  
  45. echo - Autoriser ping : [OK]
  46.  
  47. # Syn Cookies
  48. echo 1 > /proc/sys/net/ipv4/tcp_syncookies
  49. echo - Syncookies : [OK]
  50.  
  51. # Syn-Flood
  52. iptables -A FORWARD -p tcp --syn -m limit --limit 1/second -j ACCEPT
  53. iptables -A FORWARD -p udp -m limit --limit 1/second -j ACCEPT
  54. echo - Limiter le Syn-Flood : [OK]
  55.  
  56. # Spoofing
  57. iptables -N SPOOFED
  58. iptables -A SPOOFED -s 127.0.0.0/8 -j DROP
  59. iptables -A SPOOFED -s 169.254.0.0/12 -j DROP
  60. iptables -A SPOOFED -s 172.16.0.0/12 -j DROP
  61. iptables -A SPOOFED -s 192.168.0.0/16 -j DROP
  62. iptables -A SPOOFED -s 10.0.0.0/8 -j DROP
  63. echo - Bloquer le Spoofing : [OK]
  64.  
  65. # HTTP
  66. iptables -t filter -A INPUT -p tcp --dport 80 -j ACCEPT
  67. iptables -t filter -A INPUT -p tcp --dport 443 -j ACCEPT
  68. iptables -t filter -A INPUT -p tcp --dport 8443 -j ACCEPT
  69. echo - Autoriser serveur Apache : [OK]
  70.  
  71. # TEAMSPEAK
  72. iptables -t filter -A INPUT -p tcp --dport 14534 -j ACCEPT
  73. iptables -t filter -A INPUT -p tcp --dport 51234 -j ACCEPT
  74. iptables -t filter -A INPUT -p udp --dport 8767 -j ACCEPT
  75. echo - Autoriser TeamSpeak : [OK]
  76.  
  77. # emulateur
  78. iptables -t filter -A INPUT -p tcp --dport 6900 -j ACCEPT
  79. iptables -t filter -A INPUT -p tcp --dport 6121 -j ACCEPT
  80. iptables -t filter -A INPUT -p tcp --dport 5121 -j ACCEPT
  81. iptables -t filter -A INPUT -p tcp --dport 3306 -j ACCEPT
  82. iptables -t filter -A OUTPUT -p tcp --dport 6900 -j ACCEPT
  83. iptables -t filter -A OUTPUT -p tcp --dport 6121 -j ACCEPT
  84. iptables -t filter -A OUTPUT -p tcp --dport 5121 -j ACCEPT
  85. iptables -t filter -A OUTPUT -p tcp --dport 3306 -j ACCEPT
  86. echo - Autoriser eAthena : [OK]