3 |
- |
1 |
# Fail2Ban filter for asterisk authentication failures
|
|
|
2 |
#
|
|
|
3 |
|
6 |
- |
4 |
[INCLUDES]
|
|
|
5 |
|
|
|
6 |
# Read common prefixes. If any customizations available -- read them from
|
|
|
7 |
# common.local
|
|
|
8 |
before = common.conf
|
|
|
9 |
|
3 |
- |
10 |
[Definition]
|
|
|
11 |
|
6 |
- |
12 |
_daemon = asterisk
|
|
|
13 |
|
3 |
- |
14 |
__pid_re = (?:\[\d+\])
|
|
|
15 |
|
|
|
16 |
# All Asterisk log messages begin like this:
|
6 |
- |
17 |
log_prefix= (?:NOTICE|SECURITY)%(__pid_re)s:?(?:\[C-[\da-f]*\])? \S+:\d*( in \w+:)?
|
3 |
- |
18 |
|
6 |
- |
19 |
failregex = ^(%(__prefix_line)s|\[\]\s*)%(log_prefix)s Registration from '[^']*' failed for '<HOST>(:\d+)?' - (Wrong password|Username/auth name mismatch|No matching peer found|Not a local domain|Device does not match ACL|Peer is not supposed to register|ACL error \(permit/deny\)|Not a local domain)$
|
|
|
20 |
^(%(__prefix_line)s|\[\]\s*)%(log_prefix)s Call from '[^']*' \(<HOST>:\d+\) to extension '\d+' rejected because extension not found in context 'default'\.$
|
|
|
21 |
^(%(__prefix_line)s|\[\]\s*)%(log_prefix)s Host <HOST> failed to authenticate as '[^']*'$
|
|
|
22 |
^(%(__prefix_line)s|\[\]\s*)%(log_prefix)s No registration for peer '[^']*' \(from <HOST>\)$
|
|
|
23 |
^(%(__prefix_line)s|\[\]\s*)%(log_prefix)s Host <HOST> failed MD5 authentication for '[^']*' \([^)]+\)$
|
|
|
24 |
^(%(__prefix_line)s|\[\]\s*)%(log_prefix)s Failed to authenticate (user|device) [^@]+@<HOST>\S*$
|
33 |
- |
25 |
^(%(__prefix_line)s|\[\]\s*)%(log_prefix)s hacking attempt detected '<HOST>'$
|
6 |
- |
26 |
^(%(__prefix_line)s|\[\]\s*)%(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]+")?(,ACLName="\w+")?$
|
|
|
27 |
^(%(__prefix_line)s|\[\]\s*WARNING%(__pid_re)s:?(?:\[C-[\da-f]*\])? )Ext\. s: "Rejecting unknown SIP connection from <HOST>"$
|
3 |
- |
28 |
|
|
|
29 |
ignoreregex =
|
|
|
30 |
|
|
|
31 |
|
6 |
- |
32 |
# Author: Xavier Devlamynck / Daniel Black
|
|
|
33 |
#
|
|
|
34 |
# General log format - main/logger.c:ast_log
|
|
|
35 |
# Address format - ast_sockaddr_stringify
|
|
|
36 |
#
|
|
|
37 |
# First regex: channels/chan_sip.c
|
|
|
38 |
#
|
|
|
39 |
# main/logger.c:ast_log_vsyslog - "in {functionname}:" only occurs in syslog
|