C'est un gros SOS que je lance ici, avant de définitivement fermer un projet sur lequel je me suis investi depuis maintenant 2 ans.
J'ai besoin d'aide sur le FW IPTABLES. Cela fait maintenant 2 mois que mon serveur OVH se fait DDOS (classique).
Pour palier à ça, j'ai mis un système de whistlist IP sur un port (le 35987). Il suffit à un jouer de se connecter sur une interface web pour que son IP soit WL (via un script que j'ai dev en python).
Jusque la, aucun problème, tout est fonctionnel, SAUF QUE, le DDOS passe quand même car la connexion sur le port se fait quand même, même si l'IP n'est pas autorisée en IPTABLES.
Concrètement, quelques packets passent, alors qu'ils ne devraient pas... Puis, la connexion est interrompue.
Code : Tout sélectionner
Chain INPUT (policy DROP 49 packets, 2594 bytes)
num pkts bytes target prot opt in out source destination
1 61214 3398K REJECT tcp -- * * 0.0.0.0/0 0.0.0.0/0 limit: above 10/sec burst 5 mode srcip tcp dpt:35987 state RELATED,ESTABLISHED reject-with icmp-port-unreachable
2 18209 76M ACCEPT all -- lo * 0.0.0.0/0 0.0.0.0/0
3 2161 69152 REJECT icmp -- * * 0.0.0.0/0 0.0.0.0/0 icmptype 8 reject-with icmp-port-unreachable
4 0 0 REJECT icmp -- * * 0.0.0.0/0 0.0.0.0/0 icmptype 11 reject-with icmp-port-unreachable
5 0 0 REJECT icmp -- * * 0.0.0.0/0 0.0.0.0/0 icmptype 3 reject-with icmp-port-unreachable
6 0 0 REJECT tcp -- * * 0.0.0.0/0 0.0.0.0/0 multiport dports !2388,19905,13005 tcp flags:0x29/0x29 reject-with icmp-port-unreachable
7 0 0 REJECT tcp -- * * 0.0.0.0/0 0.0.0.0/0 multiport dports !2388,19905,13005 tcp flags:0x3F/0x3F reject-with icmp-port-unreachable
8 0 0 REJECT tcp -- * * 0.0.0.0/0 0.0.0.0/0 multiport dports !2388,19905,13005 tcp flags:0x3F/0x00 reject-with icmp-port-unreachable
9 0 0 REJECT tcp -- * * 0.0.0.0/0 0.0.0.0/0 multiport dports !2388,19905,13005 tcp flags:0x06/0x06 reject-with icmp-port-unreachable
10 0 0 REJECT tcp -- * * !127.0.0.1 0.0.0.0/0 tcp dpt:80 reject-with icmp-port-unreachable
11 0 0 REJECT all -- * * 0.0.0.0/0 0.0.0.0/0 PKTTYPE = broadcast reject-with icmp-port-unreachable
12 284K 39M ACCEPT all -- * * 0.0.0.0/0 0.0.0.0/0 ctstate RELATED,ESTABLISHED
13 2675 160K ACCEPT all -- * * 178.XX.XX.XX 0.0.0.0/0
14 0 0 ACCEPT all -- * * 193.XX.X.XX 0.0.0.0/0
15 0 0 ACCEPT all -- * * 0.0.0.0/0 0.0.0.0/0 state ESTABLISHED
--- PLEIN D'IP COMME LE SCHEMA CI DESSOUS ---
24 336 17472 ACCEPT tcp -- * * 91.172.169.XXX 0.0.0.0/0 multiport dports 35987 /* ip=91.172.169.XXX */
25 2 79 ACCEPT udp -- * * 91.172.169.XXX 0.0.0.0/0 multiport dports 35987 /* ip=91.172.169.XXX */
--- PLEIN D'IP COMME LE SCHEMA CI DESSUS ---
525 521 29120 REJECT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:35987 /* DROP35987TCP */ reject-with icmp-port-unreachable
526 4 172 REJECT udp -- * * 0.0.0.0/0 0.0.0.0/0 udp dpt:35987 /* DROP35987TCPUDP */ reject-with icmp-port-unreachable
527 0 0 DROP tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:35987 /* DROP35987TCP */
528 0 0 DROP udp -- * * 0.0.0.0/0 0.0.0.0/0 udp dpt:35987 /* DROP35987TCPUDP */
Chain FORWARD (policy DROP 0 packets, 0 bytes)
num pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 17 packets, 884 bytes)
num pkts bytes target prot opt in out source destination
1 0 0 REJECT icmp -- * * 0.0.0.0/0 0.0.0.0/0 icmptype 0 reject-with icmp-port-unreachable
2 525K 879M ACCEPT all -- * * 0.0.0.0/0 0.0.0.0/0 ! ctstate INVALID
En laissant passer les packets, nos attaquants arrivent donc à nous faire tomber en nous envoyant tout un tas de de petits paquets depuis des milliers d'IP.
Alors j'ai essayé de ruser, en faisant un script python qui compte le nombre de connexion / IP via NETSTAT, et si c'est dépassée, l'IP est automatiquement DROP / REJECT.
Sauf que même résultat, les premiers paquets passent ...
Comment faire via IPTABLES pour empêcher totalement un packet de passer ?
Si ce n'est pas possible, comment faire un pré filtrage en fonction des règles définies ? Redirection de ports en fonction d'une IP ?
Mon projet est à but non lucratif, nous sommes juste une communauté de joueurs qui faisons ça bénévolement. Sauf que nous avons des concurrents qui eux, ont assez de fonds pour se payer des botnets ...
Merci à vous !