Iptables, scans et logs
Bonjour à tous,
Je suis en train d'essayer de configurer le firewall d'un serveur sous
Debian. J'essaye de faire un LOG + DROP pour les scans TCP.
Voici un extrait (le début "problématique") de "iptables -L -n -v" :
Chain INPUT (policy DROP 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
0 0 DROP all -- * * 0.0.0.0/0 0.0.0.0/0 PKTTYPE = broadcast
1 40 DROP all -- * * 0.0.0.0/0 0.0.0.0/0 state INVALID
2551 172K check-flags all -- * * 0.0.0.0/0 0.0.0.0/0
2551 172K TCP_FLAGS all -- * * 0.0.0.0/0 0.0.0.0/0
2551 172K last-check all -- * * 0.0.0.0/0 0.0.0.0/0
1496 129K ACCEPT all -- * * 0.0.0.0/0 0.0.0.0/0 state
RELATED,ESTABLISHED
0 0 DROP tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp option=!2
flags:0x02/0x02
Chain BADFLAGS (5 references)
pkts bytes target prot opt in out source destination
0 0 LOG all -- * * 0.0.0.0/0 0.0.0.0/0 LOG flags 0 level 4
prefix `IPT-BADFLAGS:'
0 0 DROP all -- * * 0.0.0.0/0 0.0.0.0/0
Chain LOG_DROP (0 references)
pkts bytes target prot opt in out source destination
0 0 LOG all -- * * 0.0.0.0/0 0.0.0.0/0 limit: avg 6/hour burst
1 LOG flags 2 level 4 prefix `Drop-Ban-IP:'
0 0 DROP all -- * * 0.0.0.0/0 0.0.0.0/0
Chain TCP_FLAGS (2 references)
pkts bytes target prot opt in out source destination
0 0 BADFLAGS tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp flags:0x11/0x01
0 0 BADFLAGS tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp flags:0x18/0x08
0 0 BADFLAGS tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp flags:0x30/0x20
0 0 BADFLAGS tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp flags:0x05/0x05
0 0 BADFLAGS tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp flags:0x3F/0x2B
Chain check-flags (2 references)
pkts bytes target prot opt in out source destination
0 0 LOG tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp flags:0x3F/0x29
limit: avg 3/min burst 5 LOG flags 0 level 4 prefix `NMAP-XMAS:'
0 0 DROP tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp flags:0x3F/0x29
0 0 LOG tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp flags:0x3F/0x3F
limit: avg 3/min burst 5 LOG flags 0 level 4 prefix `XMAS:'
0 0 DROP tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp flags:0x3F/0x3F
0 0 LOG tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp flags:0x3F/0x37
limit: avg 3/min burst 5 LOG flags 0 level 4 prefix `XMAS-PSH:'
0 0 DROP tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp flags:0x3F/0x37
0 0 LOG tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp flags:0x3F/0x00
limit: avg 3/min burst 5 LOG flags 0 level 4 prefix `NULL-SCAN:'
0 0 DROP tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp flags:0x3F/0x00
0 0 LOG tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp flags:0x06/0x06
limit: avg 3/min burst 5 LOG flags 0 level 4 prefix `SYN/RST:'
0 0 DROP tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp flags:0x06/0x06
0 0 LOG tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp flags:0x03/0x03
limit: avg 3/min burst 5 LOG flags 0 level 4 prefix `SYN/FIN:'
0 0 DROP tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp flags:0x03/0x03
Chain last-check (2 references)
pkts bytes target prot opt in out source destination
21 1052 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp
flags:0x17/0x02 limit: avg 5/sec burst 5
9 360 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp flags:0x17/0x04
limit: avg 1/sec burst 5
9 252 ACCEPT icmp -- * * 0.0.0.0/0 0.0.0.0/0 icmp type 8 limit:
avg 1/sec burst 5
(Je sais, il est un peu "excessif" sur certains points, mais c'est pour
apprendre/comprendre...)
Je lance un/des scans avec nmap (nmap -sN mon.serveur.tld && nmap -sF
mon.serveur.tld && nmap -sXmon.serveur.tld) depuis mon desktop, et
aucune inscription n'apparaît dans les fichiers de log (ni iptables.log,
ni kern.log...). Et pour cause, aucun paquet n'est matché par les règles
"anti-scan".
Je ne comprends pas pourquoi, et je ne sais pas où chercher (pas
d'erreur apparaissant dans les logs...). Auriez-vous une piste ?
Cdt
Reply to: