Bonjour à tous,
Voilà plusieurs années que je suis chez online.net et je n’ai rencontré jusqu’à ce jour aucun véritable problème.
J’ai une dédibox pro sous debian 64 bits avec openpanel d’installé.
Or depuis 3 jours, mon serveur commence à saturer avec une importante consommation de paquets (voir le screenshot).
Après quelques reboots et de re-configuration apache le problème est toujours présent, la mémoire utilisée est bonne.
Je me suis donc penché vers un problème de SYN/DDOS, j’ai contacté le support d’online.net qui m’a dit que mon serveur était en train de télécharger (alors que non.)
J’ai executé
for i in ` netstat -tanpu | grep "SYN_RECV" | awk {'print $5'} | cut -f 1 -d ":" | sort | uniq -c | sort -n | awk {'if ($1 > 3) print $2'}` ; do echo $i; done
Qui m’a retourné une dizaine de lignes
Qui me retourne entre 250 et 300.
J’ai donc configuré mon IPTABLE comme cela :
#!/bin/sh
#
IPTABLES="/sbin/iptables"
IP6TABLES="/sbin/ip6tables"
# Flush and Delete existing chains
$IPTABLES -F openpanel || /bin/true
$IPTABLES -F openpanel-allow || /bin/true
$IPTABLES -F openpanel-deny || /bin/true
$IPTABLES -F openpanel-fwd || /bin/true
$IPTABLES -F INPUT
$IPTABLES -t nat -F PREROUTING
$IPTABLES -t nat -F POSTROUTING
$IPTABLES -F FORWARD
$IPTABLES -X openpanel || /bin/true
$IPTABLES -X openpanel-allow || /bin/true
$IPTABLES -X openpanel-deny || /bin/true
$IPTABLES -X openpanel-fwd || /bin/true
$IP6TABLES -F openpanel || /bin/true
$IP6TABLES -F openpanel-fwd || /bin/true
$IP6TABLES -F openpanel-allow || /bin/true
$IP6TABLES -F openpanel-deny || /bin/true
$IP6TABLES -F INPUT
$IP6TABLES -F FORWARD
$IP6TABLES -X openpanel || /bin/true
$IP6TABLES -X openpanel-fwd || /bin/true
$IP6TABLES -X openpanel-allow || /bin/true
$IP6TABLES -X openpanel-deny || /bin/true
# Create new chains
$IPTABLES -N openpanel
$IPTABLES -N openpanel-fwd
$IPTABLES -N openpanel-allow
$IPTABLES -N openpanel-deny
$IP6TABLES -N openpanel
$IP6TABLES -N openpanel-fwd
$IP6TABLES -N openpanel-allow
$IP6TABLES -N openpanel-deny
# Configure openpanel accept/deny behaviour
$IPTABLES -A openpanel-allow -j ACCEPT
$IP6TABLES -A openpanel-allow -j ACCEPT
$IPTABLES -A openpanel-deny -j DROP
$IP6TABLES -A openpanel-deny -j DROP
# Sysadmin defined policies through openpanel
$IPTABLES -A openpanel -p tcp -s 0.0.0.0/0 --dport 110 -j openpanel-allow
$IP6TABLES -A openpanel -p tcp --dport 110 -j openpanel-allow
$IPTABLES -A openpanel -p tcp -s 0.0.0.0/0 --dport 111 -j openpanel-deny
$IP6TABLES -A openpanel -p tcp --dport 111 -j openpanel-deny
$IPTABLES -A openpanel -p udp -s 0.0.0.0/0 --dport 111 -j openpanel-deny
$IP6TABLES -A openpanel -p udp --dport 111 -j openpanel-deny
$IPTABLES -A openpanel -p tcp -s MON.IP./255.255.255.255 --dport 1337 -j openpanel-allow
$IPTABLES -A openpanel -p tcp -s 0.0.0.0/0 --dport 1337 -j openpanel-deny
$IP6TABLES -A openpanel -p tcp --dport 1337 -j openpanel-deny
$IPTABLES -A openpanel -p tcp -s 0.0.0.0/0 --dport 143 -j openpanel-allow
$IP6TABLES -A openpanel -p tcp --dport 143 -j openpanel-allow
$IPTABLES -A openpanel -p tcp -s 0.0.0.0/0 --dport 21 -j openpanel-allow
$IP6TABLES -A openpanel -p tcp --dport 21 -j openpanel-allow
$IPTABLES -A openpanel -p tcp -s 0.0.0.0/0 --dport 22 -j openpanel-deny
$IP6TABLES -A openpanel -p tcp --dport 22 -j openpanel-deny
$IPTABLES -A openpanel -p tcp -s 0.0.0.0/0 --dport 25 -j openpanel-allow
$IP6TABLES -A openpanel -p tcp --dport 25 -j openpanel-allow
$IPTABLES -A openpanel -p tcp -s 0.0.0.0/0 --dport 4089 -j openpanel-allow
$IP6TABLES -A openpanel -p tcp --dport 4089 -j openpanel-allow
$IPTABLES -A openpanel -p tcp -s 0.0.0.0/0 --dport 443 -j openpanel-allow
$IP6TABLES -A openpanel -p tcp --dport 443 -j openpanel-allow
$IPTABLES -A openpanel -p tcp -s 0.0.0.0/0 --dport 53 -j openpanel-allow
$IP6TABLES -A openpanel -p tcp --dport 53 -j openpanel-allow
$IPTABLES -A openpanel -p udp -s 0.0.0.0/0 --dport 53 -j openpanel-allow
$IP6TABLES -A openpanel -p udp --dport 53 -j openpanel-allow
$IPTABLES -A openpanel -p tcp -s 0.0.0.0/0 --dport 80 -j openpanel-allow
$IP6TABLES -A openpanel -p tcp --dport 80 -j openpanel-allow
$IPTABLES -I INPUT -p icmp -j ACCEPT
$IP6TABLES -I INPUT -p icmp -j ACCEPT
$IPTABLES -I INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
$IP6TABLES -I INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
$IPTABLES -A INPUT -i lo -j openpanel-allow
$IPTABLES -A INPUT -j openpanel
$IPTABLES -A FORWARD -j openpanel-fwd
$IP6TABLES -A INPUT -i lo -j openpanel-allow
$IP6TABLES -A INPUT -j openpanel
$IP6TABLES -A FORWARD -j openpanel-fwd
$IPTABLES -P INPUT ACCEPT
$IP6TABLES -P INPUT ACCEPT
$IPTABLES -P FORWARD ACCEPT
$IP6TABLES -P FORWARD ACCEPT
# Rajout 18.04.2012 #
$IPTABLES -A FORWARD -p tcp --syn -m limit --limit 1/second -j ACCEPT
$IP6TABLES -A FORWARD -p udp -m limit --limit 1/second -j ACCEPT
J’ai aussi exécuté ces lignes :
echo "1" > /proc/sys/net/ipv4/tcp_syncookies
echo "1024" > /proc/sys/net/ipv4/tcp_max_syn_backlog
echo "1" > /proc/sys/net/ipv4/conf/all/rp_filter
Qui sont aussi présentes dans /etc/sysctl.conf
Voici mon top:
Tasks: 470 total, 1 running, 469 sleeping, 0 stopped, 0 zombie
Cpu(s): 1.0%us, 0.4%sy, 0.0%ni, 97.2%id, 0.0%wa, 0.0%hi, 1.4%si, 0.0%st
Mem: 16428152k total, 2689596k used, 13738556k free, 41472k buffers
Swap: 1044216k total, 0k used, 1044216k free, 450268k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
1693 root 20 0 109m 3320 1612 S 1 0.0 0:04.07 logax
2249 www-data 20 0 278m 13m 3948 S 1 0.1 0:00.20 apache2
2309 www-data 20 0 278m 13m 3948 S 1 0.1 0:00.19 apache2
2729 root 20 0 19336 1684 1016 R 1 0.0 0:00.06 top
2130 www-data 20 0 278m 13m 3964 S 0 0.1 0:00.31 apache2
2424 www-data 20 0 278m 13m 3952 S 0 0.1 0:00.25 apache2
2425 www-data 20 0 278m 13m 4100 S 0 0.1 0:00.33 apache2
2445 www-data 20 0 300m 36m 4720 S 0 0.2 0:00.48 apache2
2461 www-data 20 0 278m 13m 3952 S 0 0.1 0:00.26 apache2
2471 www-data 20 0 278m 13m 3936 S 0 0.1 0:00.17 apache2
2480 www-data 20 0 278m 13m 3940 S 0 0.1 0:00.28 apache2
2493 www-data 20 0 278m 13m 3936 S 0 0.1 0:00.15 apache2
1 root 20 0 8356 804 676 S 0 0.0 0:00.66 init
2 root 20 0 0 0 0 S 0 0.0 0:00.00 kthreadd
3 root RT 0 0 0 0 S 0 0.0 0:00.00 migration/0
4 root 20 0 0 0 0 S 0 0.0 0:00.00 ksoftirqd/0
5 root RT 0 0 0 0 S 0 0.0 0:00.00 watchdog/0
6 root RT 0 0 0 0 S 0 0.0 0:00.00 migration/1
7 root 20 0 0 0 0 S 0 0.0 0:00.00 ksoftirqd/1
8 root RT 0 0 0 0 S 0 0.0 0:00.00 watchdog/1
9 root RT 0 0 0 0 S 0 0.0 0:00.00 migration/2
10 root 20 0 0 0 0 S 0 0.0 0:00.00 ksoftirqd/2
11 root RT 0 0 0 0 S 0 0.0 0:00.00 watchdog/2
12 root RT 0 0 0 0 S 0 0.0 0:00.00 migration/3
13 root 20 0 0 0 0 S 0 0.0 0:00.00 ksoftirqd/3
14 root RT 0 0 0 0 S 0 0.0 0:00.00 watchdog/3
15 root 20 0 0 0 0 S 0 0.0 0:00.02 events/0
16 root 20 0 0 0 0 S 0 0.0 0:00.08 events/1
17 root 20 0 0 0 0 S 0 0.0 0:00.00 events/2
18 root 20 0 0 0 0 S 0 0.0 0:00.00 events/3
19 root 20 0 0 0 0 S 0 0.0 0:00.00 cpuset
20 root 20 0 0 0 0 S 0 0.0 0:00.00 khelper
21 root 20 0 0 0 0 S 0 0.0 0:00.00 netns
22 root 20 0 0 0 0 S 0 0.0 0:00.00 async/mgr
23 root 20 0 0 0 0 S 0 0.0 0:00.00 pm
24 root 20 0 0 0 0 S 0 0.0 0:00.00 sync_supers
25 root 20 0 0 0 0 S 0 0.0 0:00.00 bdi-default
26 root 20 0 0 0 0 S 0 0.0 0:00.00 kintegrityd/0
27 root 20 0 0 0 0 S 0 0.0 0:00.00 kintegrityd/1
28 root 20 0 0 0 0 S 0 0.0 0:00.00 kintegrityd/2
29 root 20 0 0 0 0 S 0 0.0 0:00.00 kintegrityd/3
30 root 20 0 0 0 0 S 0 0.0 0:00.00 kblockd/0
31 root 20 0 0 0 0 S 0 0.0 0:00.00 kblockd/1
32 root 20 0 0 0 0 S 0 0.0 0:00.00 kblockd/2
33 root 20 0 0 0 0 S 0 0.0 0:00.00 kblockd/3
34 root 20 0 0 0 0 S 0 0.0 0:00.00 kacpid
35 root 20 0 0 0 0 S 0 0.0 0:00.00 kacpi_notify
36 root 20 0 0 0 0 S 0 0.0 0:00.00 kacpi_hotplug
37 root 20 0 0 0 0 S 0 0.0 0:00.00 kseriod
42 root 20 0 0 0 0 S 0 0.0 0:00.00 kondemand/0
43 root 20 0 0 0 0 S 0 0.0 0:00.00 kondemand/1
44 root 20 0 0 0 0 S 0 0.0 0:00.00 kondemand/2
45 root 20 0 0 0 0 S 0 0.0 0:00.00 kondemand/3
46 root 20 0 0 0 0 S 0 0.0 0:00.00 khungtaskd
47 root 20 0 0 0 0 S 0 0.0 0:00.00 kswapd0
48 root 25 5 0 0 0 S 0 0.0 0:00.00 ksmd
49 root 20 0 0 0 0 S 0 0.0 0:00.00 aio/0
50 root 20 0 0 0 0 S 0 0.0 0:00.00 aio/1
51 root 20 0 0 0 0 S 0 0.0 0:00.00 aio/2
52 root 20 0 0 0 0 S 0 0.0 0:00.00 aio/3
53 root 20 0 0 0 0 S 0 0.0 0:00.00 crypto/0
54 root 20 0 0 0 0 S 0 0.0 0:00.00 crypto/1
55 root 20 0 0 0 0 S 0 0.0 0:00.00 crypto/2
56 root 20 0 0 0 0 S 0 0.0 0:00.00 crypto/3
281 root 20 0 0 0 0 S 0 0.0 0:00.00 ksuspend_usbd
282 root 20 0 0 0 0 S 0 0.0 0:00.00 khubd
Ce qui est étrange c’est qu’aux alentours de 19h30/20h ça revient à la normale…
Si vous avez une solution à mon problème je suis preneur, merci de m’avoir lu 





[/quote]