From: Frank Brehm Date: Fri, 12 Apr 2024 14:33:08 +0000 (+0200) Subject: Masking many unnecessary error messages. X-Git-Url: https://git.uhu-banane.net/?a=commitdiff_plain;h=34453b4d1cbd41369e5cc6624d9862c55f32c790;p=pixelpark%2Fpp-admin-tools.git Masking many unnecessary error messages. --- diff --git a/lib/pp_admintools/app/get_from_addr.py b/lib/pp_admintools/app/get_from_addr.py index 91b4512..628ce2f 100644 --- a/lib/pp_admintools/app/get_from_addr.py +++ b/lib/pp_admintools/app/get_from_addr.py @@ -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)) diff --git a/lib/pp_admintools/handler/pflogparse.py b/lib/pp_admintools/handler/pflogparse.py index c6761a9..27eb0ba 100644 --- a/lib/pp_admintools/handler/pflogparse.py +++ b/lib/pp_admintools/handler/pflogparse.py @@ -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\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))