Uploaded image for project: 'FreePBX'
  1. FreePBX
  2. FREEPBX-9222

fail2ban settings improvment

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 12
    • Component/s: Fail2Ban
    • Labels:
      None
    • ToDo:

      Description

      Hello,

      Please change the filter of the asterisk-security.conf to the following as it lacks a lot of new attacks:

      
      
      # Fail2Ban filter for asterisk authentication failures
      #
      
      [INCLUDES]
      
      # Read common prefixes. If any customizations available -- read them from
      # common.local
      before = common.conf
      
      [Definition]
      
      _daemon = asterisk
      
      __pid_re = (?:\[\d+\])
      
      # All Asterisk log messages begin like this:
      log_prefix= (?:NOTICE|SECURITY)%(__pid_re)s:?(?:\[C-[\da-f]*\])? \S+:\d*( in \w+:)?
      
      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)$
                  ^(%(__prefix_line)s|\[\]\s*)%(log_prefix)s Call from '[^']*' \(<HOST>:\d+\) to extension '\d+' rejected because extension not found in context 'default'\.$
                  ^(%(__prefix_line)s|\[\]\s*)%(log_prefix)s Host <HOST> failed to authenticate as '[^']*'$
                  ^(%(__prefix_line)s|\[\]\s*)%(log_prefix)s No registration for peer '[^']*' \(from <HOST>\)$
                  ^(%(__prefix_line)s|\[\]\s*)%(log_prefix)s Host <HOST> failed MD5 authentication for '[^']*' \([^)]+\)$
                  ^(%(__prefix_line)s|\[\]\s*)%(log_prefix)s Failed to authenticate (user|device) [^@]+@<HOST>\S*$
                  ^(%(__prefix_line)s|\[\]\s*)%(log_prefix)s (?:handle_request_subscribe: )?Sending fake auth rejection for (device|user) \d*<sip:[^@]+@<HOST>>;tag=\w+\S*$
                  ^(%(__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+")?$
                  ^(%(__prefix_line)s|\[\]\s*WARNING%(__pid_re)s:?(?:\[C-[\da-f]*\])? )Ext\. s: "Rejecting unknown SIP connection from <HOST>"$
      
                      WARNING.* .*: .*Rejecting unknown SIP connection from <HOST>.*
                      WARNING.* Ext. s: Friendly Scanner from <HOST>
      
      ignoreregex =
      
      
      # 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 syslog
      

      Thank you,

      Daniel Friedman
      Trixton LTD.

      Mobile: 972.50.6655579
      Email: dani@3xton.com

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                GameGamer43 Bryan Walters
                Reporter:
                danielf danielf
              • Votes:
                0 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  NextupJiraPlusStatus

                  Error rendering 'slack.nextup.jira:nextup-jira-plus-status'. Please contact your Jira administrators.