Какого думаю хрена не работает fail2ban (который исправно банил всю эту швать последние пол года).Открываю логи f2b там тишина никого не банят.Решил протестить как работает f2b
Код: Выделить всё
fail2ban-regex /var/log/asterisk/messages /etc/fail2ban/filter.d/asterisk.conf
Код: Выделить всё
>>
Traceback (most recent call last):
File "/usr/local/bin/fail2ban-regex", line 49, in <module>
from testcases.utils import FormatterWithTraceBack
ImportError: No module named testcases.utils
Гугл правильных ответов не дает.
В итоге грохнул f2b apt-get (remove autoremove purge) f2b и ставлю по новой .
Все равно не работает не fail2ban-regex и никого не банит.
Затем грохнул f2b и вручную удалить rm /usr/local/bin/fail2ban-*
Переставил f2b еще раз по новой bin-ари почему то раньше были в /usr/local/bin/ теперь стали в /usr/bin/
и при запуске fail2ban-regex он ругается что нет такого файла в каталоге /usr/local/bin/ пришлось скопировать все из /usr/bin/
Чудеса ей богу.
Но зато fail2ban-regex заработал
Дальше перезапускаю f2b смотрю консоль астера опять курочат
Код: Выделить всё
[2015-09-07 01:09:06] NOTICE[27597][C-0000000b]: chan_sip.c:25711 handle_request_invite: Failed to authenticate device 1006<sip:1006@217.65.209.38>;tag=04277a7c
[2015-09-07 01:09:07] NOTICE[27597][C-0000000c]: chan_sip.c:25711 handle_request_invite: Failed to authenticate device 1006<sip:1006@217.65.209.38>;tag=cf5210cd
[2015-09-07 01:09:07] NOTICE[27597][C-0000000d]: chan_sip.c:25711 handle_request_invite: Failed to authenticate device 1006<sip:1006@217.65.209.38>;tag=09b35513
[2015-09-07 01:09:08] NOTICE[27597][C-0000000e]: chan_sip.c:25711 handle_request_invite: Failed to authenticate device 1006<sip:1006@217.65.209.38>;tag=14d66a5f
[2015-09-07 01:09:08] NOTICE[27597][C-0000000f]: chan_sip.c:25711 handle_request_invite: Failed to authenticate device 1006<sip:1006@217.65.209.38>;tag=0a3eaa80
[2015-09-07 01:09:09] NOTICE[27597][C-00000010]: chan_sip.c:25711 handle_request_invite: Failed to authenticate device 1006<sip:1006@217.65.209.38>;tag=0b33f27f
[2015-09-07 01:09:10] NOTICE[27597][C-00000011]: chan_sip.c:25711 handle_request_invite: Failed to authenticate device 1006<sip:1006@217.65.209.38>;tag=6c99aef
Пинаю
Код: Выделить всё
/etc/fail2ban# fail2ban-regex /var/log/asterisk/messages /etc/fail2ban/filter.d/asterisk.conf
Running tests
=============
Use regex file : /etc/fail2ban/filter.d/asterisk.conf
Use log file : /var/log/asterisk/messages
Results
=======
Failregex
|- Regular expressions:
| [1] SECURITY.* SecurityEvent="FailedACL".*RemoteAddress=".+?/.+?/<HOST>/.+?".*
| [2] SECURITY.* SecurityEvent="InvalidAccountID".*RemoteAddress=".+?/.+?/<HOST>/.+?".*
| [3] SECURITY.* SecurityEvent="ChallengeResponseFailed".*RemoteAddress=".+?/.+?/<HOST>/.+?".*
| [4] SECURITY.* SecurityEvent="InvalidPassword".*RemoteAddress=".+?/.+?/<HOST>/.+?".*
| [5] .*NOTICE.* .*: Registration from '.*' failed for '<HOST>' - Wrong password
| [6] .*NOTICE.* .*: Registration from '.*' failed for '<HOST>' - Peer is not supposed to register
| [7] .*NOTICE.* .*: Registration from '.*' failed for '<HOST>:.*' - Wrong password
| [8] .*NOTICE.* .*: Registration from '.*' failed for '<HOST>' - No matching peer found
| [9] .*NOTICE.* .*: Registration from '.*' failed for '<HOST>:.*' - No matching peer found
| [10] .*NOTICE.* .*: Registration from '.*' failed for '<HOST>:.*' - Username/auth name mismatch
| [11] .*NOTICE.* .*: Registration from '.*' failed for '<HOST>:.*' - Device does not match ACL
| [12] .*NOTICE.* .*: Registration from '.*' failed for '<HOST>:.*' - Peer is not supposed to register
| [13] .*NOTICE.* .*: Registration from '.*' failed for '<HOST>:.*' - ACL error (permit/deny)
| [14] .*NOTICE.* .*: Registration from '.*' failed for '<HOST>:.*' - Device does not match ACL
| [15] .*NOTICE.* .*: Registration from '\".*\".*' failed for '<HOST>:.*' - No matching peer found
| [16] .*NOTICE.* .*: Registration from '\".*\".*' failed for '<HOST>:.*' - Wrong password
| [17] .*NOTICE.* <HOST> failed to authenticate as '.*'$
| [18] .*NOTICE.* .*: No registration for peer '.*' \(from <HOST>\)
| [19] .*NOTICE.* .*: Host <HOST> failed MD5 authentication for '.*' (.*)
| [20] .*NOTICE.* .*: Failed to authenticate user .*@<HOST>.*
| [21] .*NOTICE.* .*[logfiles]: <HOST> failed to authenticate as '.*'
| [22] .*NOTICE.* .*: <HOST> tried to authenticate with nonexistent user '.*'
| [23] .*VERBOSE.*SIP/<HOST>-.*Received incoming SIP connection from unknown peer
| [24] .*NOTICE.* .*: Sending fake auth rejection for device.* \[IP: <HOST>:.*\]
|
`- Number of matches:
[1] 0 match(es)
[2] 0 match(es)
[3] 0 match(es)
[4] 7 match(es)
[5] 0 match(es)
[6] 0 match(es)
[7] 0 match(es)
[8] 0 match(es)
[9] 0 match(es)
[10] 0 match(es)
[11] 0 match(es)
[12] 0 match(es)
[13] 0 match(es)
[14] 0 match(es)
[15] 0 match(es)
[16] 0 match(es)
[17] 0 match(es)
[18] 0 match(es)
[19] 0 match(es)
[20] 0 match(es)
[21] 0 match(es)
[22] 0 match(es)
[23] 0 match(es)
[24] 0 match(es)
Ignoreregex
|- Regular expressions:
|
`- Number of matches:
Summary
=======
Addresses found:
[1]
[2]
[3]
[4]
62.210.244.35 (Mon Sep 07 01:09:06 2015)
62.210.244.35 (Mon Sep 07 01:09:07 2015)
62.210.244.35 (Mon Sep 07 01:09:07 2015)
62.210.244.35 (Mon Sep 07 01:09:08 2015)
62.210.244.35 (Mon Sep 07 01:09:08 2015)
62.210.244.35 (Mon Sep 07 01:09:09 2015)
62.210.244.35 (Mon Sep 07 01:09:10 2015)
[5]
[6]
[7]
[8]
[9]
[10]
[11]
[12]
[13]
[14]
[15]
[16]
[17]
[18]
[19]
[20]
[21]
[22]
[23]
[24]
Date template hits:
0 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
5215 hit(s): Year-Month-Day 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 7
However, look at the above section 'Running tests' which could contain important
information.
62.210.244.35 (Mon Sep 07 01:09:06 2015)
62.210.244.35 (Mon Sep 07 01:09:07 2015)
62.210.244.35 (Mon Sep 07 01:09:07 2015)
62.210.244.35 (Mon Sep 07 01:09:08 2015)
62.210.244.35 (Mon Sep 07 01:09:08 2015)
62.210.244.35 (Mon Sep 07 01:09:09 2015)
62.210.244.35 (Mon Sep 07 01:09:10 2015)
Какого хератогда он не банит?
Время и дата правильные на сервере.