Есть сервер на debian 10:root@NS1:~# uname -a
Linux NS1 4.19.0-6-amd64 #1 SMP Debian 4.19.67-2+deb10u2 (2019-11-11) x86_64 GNU/Linux
Установлен bind, настроено логирование:
logging {
channel "security" {
file "/home/named/log/security.log" versions 3 size 30m;
severity dynamic;
print-time yes;
};
category security {
security;
};
};
Права на лог файл открыты 'с запасом'
root@NS1:~# ls -la /home/named/log/security.log
-rwxrwxrwx 1 bind bind 584819 Mar 6 12:55 /home/named/log/security.log
Настройки jail.conf:
...
[named-refused-udp]
enabled = true
port = domain, 953
protocol = udp
filter = named-refused
logpath = /home/named/log/security.log
bantime = 86400
maxretry = 3
[named-refused-tcp]
enabled = true
port = domain, 953
protocol = tcp
filter = named-refused
logpath = /home/named/log/security.log
bantime = 86400
maxretry = 3
...
Настройки фильтра не менял со стандартных
Отключил apparmor на всякий пожарный
Лог пишет, но правил на блокировку в iptables не создаёт
в fail2ban.log никаких ошибок нету:
2020-03-06 12:50:39,155 fail2ban.server [5615]: INFO Starting Fail2ban v0.10.2
2020-03-06 12:50:39,160 fail2ban.database [5615]: INFO Connected to fail2ban persistent database '/var/lib/fail2ban/fail2ban.sqlite3'
2020-03-06 12:50:39,161 fail2ban.jail [5615]: INFO Creating new jail 'sshd'
2020-03-06 12:50:39,168 fail2ban.jail [5615]: INFO Jail 'sshd' uses pyinotify {}
2020-03-06 12:50:39,170 fail2ban.jail [5615]: INFO Initiated 'pyinotify' backend
2020-03-06 12:50:39,170 fail2ban.filter [5615]: INFO maxLines: 1
2020-03-06 12:50:39,187 fail2ban.server [5615]: INFO Jail sshd is not a JournalFilter instance
2020-03-06 12:50:39,188 fail2ban.filter [5615]: INFO Added logfile: '/var/log/auth.log' (pos = 32448, hash = 3b1c9218282b83e1eb3e8f4bbc1a638ec17c3ce2)
2020-03-06 12:50:39,188 fail2ban.filter [5615]: INFO encoding: UTF-8
2020-03-06 12:50:39,188 fail2ban.filter [5615]: INFO maxRetry: 3
2020-03-06 12:50:39,188 fail2ban.filter [5615]: INFO findtime: 600
2020-03-06 12:50:39,189 fail2ban.actions [5615]: INFO banTime: 86400
2020-03-06 12:50:39,189 fail2ban.jail [5615]: INFO Creating new jail 'named-refused-udp'
2020-03-06 12:50:39,189 fail2ban.jail [5615]: INFO Jail 'named-refused-udp' uses pyinotify {}
2020-03-06 12:50:39,191 fail2ban.jail [5615]: INFO Initiated 'pyinotify' backend
2020-03-06 12:50:39,192 fail2ban.filter [5615]: INFO Added logfile: '/home/named/log/security.log' (pos = 468534, hash = 10510ed969f773b6675138e3f1af57d148abc79c)
2020-03-06 12:50:39,195 fail2ban.filter [5615]: INFO encoding: UTF-8
2020-03-06 12:50:39,195 fail2ban.filter [5615]: INFO maxRetry: 3
2020-03-06 12:50:39,195 fail2ban.filter [5615]: INFO findtime: 600
2020-03-06 12:50:39,196 fail2ban.actions [5615]: INFO banTime: 86400
2020-03-06 12:50:39,196 fail2ban.jail [5615]: INFO Creating new jail 'named-refused-tcp'
2020-03-06 12:50:39,196 fail2ban.jail [5615]: INFO Jail 'named-refused-tcp' uses pyinotify {}
2020-03-06 12:50:39,198 fail2ban.jail [5615]: INFO Initiated 'pyinotify' backend
2020-03-06 12:50:39,198 fail2ban.filter [5615]: INFO Added logfile: '/home/named/log/security.log' (pos = 468534, hash = 10510ed969f773b6675138e3f1af57d148abc79c)
2020-03-06 12:50:39,199 fail2ban.filter [5615]: INFO encoding: UTF-8
2020-03-06 12:50:39,199 fail2ban.filter [5615]: INFO maxRetry: 3
2020-03-06 12:50:39,199 fail2ban.filter [5615]: INFO findtime: 600
2020-03-06 12:50:39,199 fail2ban.actions [5615]: INFO banTime: 86400
2020-03-06 12:50:39,399 fail2ban.jail [5615]: INFO Jail 'sshd' started
2020-03-06 12:50:39,400 fail2ban.jail [5615]: INFO Jail 'named-refused-udp' started
2020-03-06 12:50:39,401 fail2ban.jail [5615]: INFO Jail 'named-refused-tcp' started
Небольшая ырезка из /home/named/log/security.log
06-Mar-2020 12:59:42.141 client @0x7efbf00a2f60 141.101.239.58#51455 (ping.citrix.com): query (cache) 'ping.citrix.com/A/IN' denied
06-Mar-2020 12:59:44.174 client @0x7efbe40ce450 141.101.239.58#50168 (org.1-ofd.ru): query (cache) 'org.1-ofd.ru/A/IN' denied
06-Mar-2020 12:59:44.174 client @0x7efbf0068280 141.101.239.58#51340 (d.la3-c1-ph2.salesforceliveagent.com): query (cache) 'd.la3-c1-ph2.salesforceliveagent.com/A/IN' denied
06-Mar-2020 12:59:44.575 client @0x7efbf40e3b20 127.0.0.1#50330 (71.162.19.213.in-addr.arpa): query (cache) '71.162.19.213.in-addr.arpa/PTR/IN' denied
06-Mar-2020 12:59:44.575 client @0x7efbf40d5390 127.0.0.1#42703 (71.162.19.213.in-addr.arpa): query (cache) '71.162.19.213.in-addr.arpa/PTR/IN' denied
06-Mar-2020 12:59:45.183 client @0x7efbf410f720 141.101.239.58#49924 (pixel.rubiconproject.net.akadns.net): query (cache) 'pixel.rubiconproject.net.akadns.net/A/IN' denied
06-Mar-2020 12:59:45.183 client @0x7efbf462dc30 141.101.239.58#50015 (connectivitycheck.gstatic.com): query (cache) 'connectivitycheck.gstatic.com/A/IN' denied
06-Mar-2020 12:59:45.183 client @0x7efbf410f720 141.101.239.58#50832 (d.agkn.com): query (cache) 'd.agkn.com/A/IN' denied
06-Mar-2020 12:59:45.188 client @0x7efbf410f720 141.101.239.58#50647 (ib.anycast.adnxs.com): query (cache) 'ib.anycast.adnxs.com/A/IN' denied
06-Mar-2020 12:59:45.188 client @0x7efbf410f720 141.101.239.58#50819 (image6.pubmatic.com): query (cache) 'image6.pubmatic.com/A/IN' denied
06-Mar-2020 12:59:45.189 client @0x7efbf410f720 141.101.239.58#50851 (eu-u.openx.net): query (cache) 'eu-u.openx.net/A/IN' denied
06-Mar-2020 12:59:45.189 client @0x7efbe40ce450 141.101.239.58#49738 (pixel.rubiconproject.com): query (cache) 'pixel.rubiconproject.com/A/IN' denied
06-Mar-2020 12:59:46.206 client @0x7efbe40be850 141.101.239.58#51772 (mx2.hosting.reg.ru): query (cache) 'mx2.hosting.reg.ru/AAAA/IN' denied
06-Mar-2020 12:59:47.211 client @0x7efbec0d0bd0 141.101.239.58#49720 (local): query (cache) 'local/SOA/IN' denied
06-Mar-2020 12:59:47.217 client @0x7efbec0d0bd0 141.101.239.58#51889 (prod-w.nexus.live.com.akadns.net): query (cache) 'prod-w.nexus.live.com.akadns.net/A/IN' denied
По идее 141.101.239.58 должен быть уже заблокирован в iptables, но его там нету,
root@NS1:~# fail2ban-client status named-refused-tcp
Status for the jail: named-refused-tcp
|- Filter
| |- Currently failed: 0
| |- Total failed: 0
| `- File list: /home/named/log/security.log
`- Actions
|- Currently banned: 0
|- Total banned: 0
`- Banned IP list:
root@NS1:~# fail2ban-client status named-refused-udp
Status for the jail: named-refused-udp
|- Filter
| |- Currently failed: 0
| |- Total failed: 0
| `- File list: /home/named/log/security.log
`- Actions
|- Currently banned: 0
|- Total banned: 0
`- Banned IP list:
Кто знает куда копать ?
P.S. На другом серваке с этимже конфигом работает (Debian 7 + fail2ban тех лет)