Имеется:
1. сервер Debian 6.0.6
2. Fail2Ban v0.8.4-SVN
cat /etc/fail2ban/jail.local
[ssh-iptables]
enabled = true
filter = sshd
findtime = 600
action = iptables-allports[name=SSH, protocol=all]
logpath = /var/log/auth.log
maxretry = 3
[asterisk-iptables]
enabled = true
filter = asterisk
action = iptables-allports[name=ASTERISK, protocol=all]
logpath = /var/log/asterisk/messages
maxretry = 5
bantime = 259200
SSHD работает на нестандартном порту —
cat /etc/services |grep ssh
ssh 10022/tcp
ssh 22/udp
Вывод iptables:
iptables -v -nL
Chain INPUT (policy ACCEPT 620 packets, 70755 bytes)
pkts bytes target prot opt in out source destination
620 70755 fail2ban-ASTERISK all -- * * 0.0.0.0/0 0.0.0.0/0
620 70755 fail2ban-SSH all -- * * 0.0.0.0/0 0.0.0.0/0
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 661 packets, 79310 bytes)
pkts bytes target prot opt in out source destination
Chain fail2ban-ASTERISK (1 references)
pkts bytes target prot opt in out source destination
620 70755 RETURN all -- * * 0.0.0.0/0 0.0.0.0/0
Chain fail2ban-SSH (1 references)
pkts bytes target prot opt in out source destination
620 70755 RETURN all -- * * 0.0.0.0/0 0.0.0.0/0
Итог: при переборе sip-аккаунтов — fail2ban срабатывает и ip банится
при неправильном вводе пароля по ssh — ничего не происходит.
Но:
fail2ban-regex /var/log/auth.log /etc/fail2ban/filter.d/sshd.conf
[SKIPPED]
Date template hits:
11246 hit(s): MONTH Day Hour:Minute:Second
0 hit(s): WEEKDAY MONTH Day Hour:Minute:Second Year
0 hit(s): WEEKDAY MONTH Day Hour:Minute:Second
0 hit(s): Year/Month/Day Hour:Minute:Second
0 hit(s): Day/Month/Year Hour:Minute:Second
0 hit(s): Day/Month/Year Hour:Minute:Second
0 hit(s): Day/MONTH/Year:Hour:Minute:Second
0 hit(s): Month/Day/Year:Hour:Minute:Second
0 hit(s): Year-Month-Day Hour:Minute:Second
0 hit(s): Day-MONTH-Year Hour:Minute:Second[.Millisecond]
0 hit(s): Day-Month-Year Hour:Minute:Second
0 hit(s): TAI64N
0 hit(s): Epoch
0 hit(s): ISO 8601
0 hit(s): Hour:Minute:Second
0 hit(s): <Month/Day/Year@Hour:Minute:Second>
Success, the total number of match is 296
Т.Е. совпадения есть, но тогда почему не срабатывает action?