Blame | Last modification | View Log | RSS feed
# Fail2Ban filter for asterisk authentication failures#[INCLUDES]# Read common prefixes. If any customizations available -- read them from# common.localbefore = common.conf[Definition]_daemon = asterisk__pid_re = (?:\s*\[\d+\])iso8601 = \d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d+[+-]\d{4}# All Asterisk log messages begin like this:log_prefix= (?:NOTICE|SECURITY|WARNING)%(__pid_re)s:?(?:\[C-[\da-f]*\])?:? [^:]+:\d*(?:(?: in)? [^:]+:)?prefregex = ^%(__prefix_line)s%(log_prefix)s <F-CONTENT>.+</F-CONTENT>$failregex = ^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)$^Call from '[^']*' \(<HOST>:\d+\) to extension '[^']*' rejected because extension not found in context^(?:Host )?<HOST> (?:failed (?:to authenticate\b|MD5 authentication\b)|tried to authenticate with nonexistent user\b)^No registration for peer '[^']*' \(from <HOST>\)$^hacking attempt detected '<HOST>'$^SecurityEvent="(?:FailedACL|InvalidAccountID|ChallengeResponseFailed|InvalidPassword)"(?:(?:,(?!RemoteAddress=)\w+="[^"]*")*|.*?),RemoteAddress="IPV[46]/[^/"]+/<HOST>/\d+"(?:,(?!RemoteAddress=)\w+="[^"]*")*$^"Rejecting unknown SIP connection from <HOST>(?::\d+)?"$^Request (?:'[^']*' )?from '(?:[^']*|.*?)' failed for '<HOST>(?::\d+)?'\s\(callid: [^\)]*\) - (?:No matching endpoint found|Not match Endpoint(?: Contact)? ACL|(?:Failed|Error) to authenticate)\s*$# FreePBX (todo: make optional in v.0.10):# ^(%(__prefix_line)s|\[\]\s*WARNING%(__pid_re)s:?(?:\[C-[\da-f]*\])? )[^:]+: Friendly Scanner from <HOST>$ignoreregex =datepattern = {^LN-BEG}# Author: Xavier Devlamynck / Daniel Black## General log format - main/logger.c:ast_log# Address format - ast_sockaddr_stringify## First regex: channels/chan_sip.c## main/logger.c:ast_log_vsyslog - "in {functionname}:" only occurs in syslogjournalmatch = _SYSTEMD_UNIT=asterisk.service[lt_journal]# asterisk can log timestamp if logs into systemd-journal (optional part matching this timestamp, gh-2383):__extra_timestamp = (?:\[[^\]]+\]\s+)?__prefix_line = %(known/__prefix_line)s%(__extra_timestamp)s