4 |
- |
1 |
# Fail2Ban filter for asterisk authentication failures
|
|
|
2 |
#
|
|
|
3 |
|
|
|
4 |
[Definition]
|
|
|
5 |
|
|
|
6 |
__pid_re = (?:\[\d+\])
|
|
|
7 |
|
|
|
8 |
# All Asterisk log messages begin like this:
|
|
|
9 |
log_prefix= \[\]\s*(?:NOTICE|SECURITY)%(__pid_re)s:?(?:\[C-[\da-f]*\])? \S+:\d*
|
|
|
10 |
|
|
|
11 |
failregex = ^%(log_prefix)s Registration from '[^']*' failed for '<HOST>(:\d+)?' - (Wrong password|No matching peer found|Username/auth name mismatch|Device does not match ACL|Peer is not supposed to register|ACL error \(permit/deny\)|Not a local domain)$
|
|
|
12 |
^%(log_prefix)s Call from '[^']*' \(<HOST>:\d+\) to extension '\d+' rejected because extension not found in context 'default'\.$
|
|
|
13 |
^%(log_prefix)s Host <HOST> failed to authenticate as '[^']*'$
|
|
|
14 |
^%(log_prefix)s No registration for peer '[^']*' \(from <HOST>\)$
|
|
|
15 |
^%(log_prefix)s Host <HOST> failed MD5 authentication for '[^']*' \([^)]+\)$
|
|
|
16 |
^%(log_prefix)s Failed to authenticate (user|device) [^@]+@<HOST>\S*$
|
|
|
17 |
^%(log_prefix)s (?:handle_request_subscribe: )?Sending fake auth rejection for (device|user) \d*<sip:[^@]+@<HOST>>;tag=\w+\S*$
|
|
|
18 |
^%(log_prefix)s SecurityEvent="(FailedACL|InvalidAccountID|ChallengeResponseFailed|InvalidPassword)",EventTV="[\d-]+",Severity="[\w]+",Service="[\w]+",EventVersion="\d+",AccountID="\d+",SessionID="0x[\da-f]+",LocalAddress="IPV[46]/(UD|TC)P/[\da-fA-F:.]+/\d+",RemoteAddress="IPV[46]/(UD|TC)P/<HOST>/\d+"(,Challenge="\w+",ReceivedChallenge="\w+")?(,ReceivedHash="[\da-f]+")?$
|
|
|
19 |
^\[\]\s*WARNING%(__pid_re)s:?(?:\[C-[\da-f]*\])? Ext\. s: "Rejecting unknown SIP connection from <HOST>"$
|
|
|
20 |
|
|
|
21 |
ignoreregex =
|
|
|
22 |
|
|
|
23 |
|
|
|
24 |
# Author: Xavier Devlamynck
|