From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 8A107EA3F for ; Wed, 19 Jul 2023 17:13:57 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 732BF9FB3 for ; Wed, 19 Jul 2023 17:13:57 +0200 (CEST) Received: from nena.proxmox.com (unknown [94.136.29.99]) by firstgate.proxmox.com (Proxmox) with ESMTP for ; Wed, 19 Jul 2023 17:13:53 +0200 (CEST) Received: by nena.proxmox.com (Postfix, from userid 1000) id 885972F0DF1; Wed, 19 Jul 2023 17:13:53 +0200 (CEST) From: Mira Limbeck To: pmg-devel@lists.proxmox.com Date: Wed, 19 Jul 2023 17:13:51 +0200 Message-Id: <20230719151352.1438974-1-m.limbeck@proxmox.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL -0.636 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment KAM_LAZY_DOMAIN_SECURITY 1 Sending domain does not have any anti-forgery methods RDNS_NONE 0.793 Delivered to internal network by a host with no rDNS SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_NONE 0.001 SPF: sender does not publish an SPF Record T_SCC_BODY_TEXT_LINE -0.01 - URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [main.rs] Subject: [pmg-devel] [PATCH log-tracker 1/2] add clamd signature found messages to log output X-BeenThere: pmg-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Mail Gateway development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Jul 2023 15:13:57 -0000 clamd reports found signatures in the log which can be matched by the same Queue ID pmg-smtp-filter uses. This QID makes it possible to add those messages to the log output. Signed-off-by: Mira Limbeck --- src/main.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/main.rs b/src/main.rs index e55f17b..dbcd7bc 100644 --- a/src/main.rs +++ b/src/main.rs @@ -777,6 +777,20 @@ fn handle_cleanup_message(msg: &[u8], parser: &mut Parser, complete_line: &[u8]) } } +fn handle_clamd_message(msg: &[u8], parser: &mut Parser, complete_line: &[u8]) { + let data = match msg.strip_prefix(b"/var/spool/pmg/active/") { + Some(data) => data, + None => return, + }; + let (qid, _data) = match parse_qid(data, 25) { + Some(t) => t, + None => return, + }; + + let fe = get_or_create_fentry(&mut parser.fentries, qid); + fe.borrow_mut().log.push((complete_line.into(), parser.lines)); +} + #[derive(Default, Debug)] struct NoqueueEntry { from: Box<[u8]>, @@ -1904,6 +1918,8 @@ impl Parser { handle_smtpd_message(line, self, complete_line); } else if service == b"postfix/cleanup" { handle_cleanup_message(line, self, complete_line); + } else if service == b"clamd" { + handle_clamd_message(line, self, complete_line) } } Ok(()) -- 2.39.2