]> Frank Brehm's Git Trees - pixelpark/pp-admin-tools.git/commitdiff
Masking many unnecessary error messages.
authorFrank Brehm <frank.brehm@pixelpark.com>
Fri, 12 Apr 2024 14:33:08 +0000 (16:33 +0200)
committerFrank Brehm <frank.brehm@pixelpark.com>
Fri, 12 Apr 2024 14:33:08 +0000 (16:33 +0200)
lib/pp_admintools/app/get_from_addr.py
lib/pp_admintools/handler/pflogparse.py

index 91b4512d4d9a5cc637d903ae501868ce344ea2b0..628ce2fa242e5599c3b491798333fb4c051de86a 100644 (file)
@@ -23,7 +23,7 @@ from . import BaseDPXApplication
 from ..handler.pflogparse import PostfixLogfileParser
 from ..xlate import XLATOR
 
-__version__ = '0.5.0'
+__version__ = '0.5.1'
 LOG = logging.getLogger(__name__)
 
 _ = XLATOR.gettext
@@ -311,7 +311,7 @@ class GetFromAddressesApp(BaseDPXApplication):
         self.pflogparser.evaluate_logfiles(self.logfiles)
 
         self._collect_results()
-        if self.verbose > 1:
+        if self.verbose > 0:
             LOG.debug(_('Results per domain:') + '\n' + pp(self.per_domain))
 
 
index c6761a9fd2410fb3de1709fab3e76b8dd1514d61..27eb0ba7e6e4e39ae1a452e64c88c26443832e92 100644 (file)
@@ -34,7 +34,7 @@ LOG = logging.getLogger(__name__)
 _ = XLATOR.gettext
 ngettext = XLATOR.ngettext
 
-__version__ = '0.6.1'
+__version__ = '0.6.3'
 
 
 # =============================================================================
@@ -57,6 +57,53 @@ class PostfixLogfileParser(HandlingObject):
         r'\s+with\s+cipher\s+(?P<tls_cipher>\S.*\S)', re.IGNORECASE)
     re_client = re.compile(r'^client=\S+\s*$', re.IGNORECASE)
 
+    smtpd_ignore_regexes = (
+        re.compile(r'^SSL_accept:', re.IGNORECASE),
+        re.compile(r'table\s+.*\s+has\s+changed\s+--\s+restarting', re.IGNORECASE),
+        re.compile(r'^auto_clnt_(?:open|close):', re.IGNORECASE),
+        re.compile(r'^connection\s+(?:closed|established)', re.IGNORECASE),
+        re.compile(r'^(?:master_notify|match_list_match|dict_cidr_lookup):', re.IGNORECASE),
+        re.compile(r'^match_host(?:addr|name):', re.IGNORECASE),
+        re.compile(
+            r'^(?:xsasl_dovecot_server_create|xsasl_dovecot_server_mech_filter|name_mask):',
+            re.IGNORECASE),
+        re.compile(r'^(?:send\s+attr|input\s+attribute)\s', re.IGNORECASE),
+        re.compile(r'^(?:[<>]|>>>)\s', re.IGNORECASE),
+        re.compile(r'^(?:private/tlsmgr|cfg_get_\S+|dict_open):', re.IGNORECASE),
+        re.compile(r'^error:\s+unsupported\s+dictionary\s+type', re.IGNORECASE),
+        re.compile(r'^(?:dict_cidr_open|match_string|been_here):', re.IGNORECASE),
+        re.compile(r'^(?:smtp_stream_setup|public/cleanup\s+socket):', re.IGNORECASE),
+        re.compile(r'^(?:(?:before|after)\s+input_transp_cleanup):', re.IGNORECASE),
+        re.compile(r'^connect\s+to\s+subsystem\s+\S+', re.IGNORECASE),
+        re.compile(r'^(?:mail_addr_find|maps_find|dict_ldap_lookup):', re.IGNORECASE),
+        re.compile(r'^(?:dict_ldap_open|dict_proxy_open):', re.IGNORECASE),
+        re.compile(r'^(?:dict_ldap_get_values\[\d+\]|dict_pcre_lookup):', re.IGNORECASE),
+        re.compile(r'^(?:dict_ldap_connect|ctable_locate|generic_checks):', re.IGNORECASE),
+        re.compile(
+            r'^(?:smtpd_acl_permit|permit_mynetworks|reject_non_fqdn_address):', re.IGNORECASE),
+        re.compile(
+            r'^(?:check_namadr_access|check_domain_access|check_addr_access):', re.IGNORECASE),
+        re.compile(
+            r'^(?:reject_invalid_hostname|check_mail_access|smtpd_check_addr):', re.IGNORECASE),
+        re.compile(
+            r'^(?:extract_addr|smtpd_check_queue|fsspace|permit_inet_interfaces):', re.IGNORECASE),
+        re.compile(
+            r'^(?:smtpd_check_rewrite|resolve_clnt|private/rewrite\s+socket):', re.IGNORECASE),
+        re.compile(r'^\S+\s+stream\s+disconnect', re.IGNORECASE),
+        re.compile(r'^(?:rewrite_clnt|xsasl_dovecot_server_connect):', re.IGNORECASE),
+        re.compile(r'^auto_clnt_create:', re.IGNORECASE),
+        re.compile(
+            r'^(?:unknown_address_tempfail_action|unknown_helo_hostname_tempfail_action)',
+            re.IGNORECASE),
+        re.compile(r'^unverified_sender_tempfail_action\s+', re.IGNORECASE),
+        re.compile(r'^unverified_recipient_tempfail_action\s+', re.IGNORECASE),
+        re.compile(r'^(?:Compiled|Run-time\s+linked)\s+against\s+', re.IGNORECASE),
+        re.compile(r'^private/proxymap\s+socket:', re.IGNORECASE),
+        re.compile(r'^(?:inet_addr_local|mynetworks_core|process\s+generation):', re.IGNORECASE),
+        re.compile(r'^warning:\s+SASL:\s+', re.IGNORECASE),
+        re.compile(r'^fatal:\s+no\s+SASL\s+authentication\s+mechanisms', re.IGNORECASE),
+    )
+
     re_dis_ehlo = re.compile(r'\sehlo=(\d+)', re.IGNORECASE)
     re_dis_starttls = re.compile(r'\sstarttls=(\d+)', re.IGNORECASE)
     re_dis_quit = re.compile(r'\squit=(\d+)', re.IGNORECASE)
@@ -244,6 +291,11 @@ class PostfixLogfileParser(HandlingObject):
         pid = entry['pid']
         message = entry['message']
         timestamp = entry['timestamp']
+
+        for regex in self.smtpd_ignore_regexes:
+            if not entry['postfix_id'] and regex.search(message):
+                return False
+
         m_conn = self.re_connect.search(message)
 
         if m_conn:
@@ -301,6 +353,9 @@ class PostfixLogfileParser(HandlingObject):
         if self.re_client.match(message):
             return True
 
+        if not entry['postfix_id']:
+            return False
+
         if self.verbose > 1:
             LOG.debug('Evaluating further smtpd entry:\n' + pp(entry))