// Ban hosts which knock on closed ports. // It needs this iptables chain to be used to drop packets: // ip46tables -N log-refuse // ip46tables -A log-refuse -p tcp --syn -j LOG --log-level info --log-prefix 'refused connection: ' // ip46tables -A log-refuse -m pkttype ! --pkt-type unicast -j nixos-fw-refuse // ip46tables -A log-refuse -j DROP { cmd: ['journalctl', '-fn0', '-k'], filters: { portscan: { regex: ['refused connection: .*SRC='], retry: 4, retryperiod: '6h', actions: banFor('720h') + sendmail('','"est banni un mois pour avoir fait un truc louche sur un port fermé"'), }, }, },