all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [pmg-devel] [PATCH log-tracker 1/2] add clamd signature found messages to log output
@ 2023-07-19 15:13 Mira Limbeck
  2023-07-19 15:13 ` [pmg-devel] [PATCH log-tracker 2/2] tests: add clamd signature found log test Mira Limbeck
  2023-08-04 12:09 ` [pmg-devel] [PATCH log-tracker 1/2] add clamd signature found messages to log output Dominik Csapak
  0 siblings, 2 replies; 4+ messages in thread
From: Mira Limbeck @ 2023-07-19 15:13 UTC (permalink / raw)
  To: pmg-devel

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 <m.limbeck@proxmox.com>
---
 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




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-09-12 14:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-19 15:13 [pmg-devel] [PATCH log-tracker 1/2] add clamd signature found messages to log output Mira Limbeck
2023-07-19 15:13 ` [pmg-devel] [PATCH log-tracker 2/2] tests: add clamd signature found log test Mira Limbeck
2023-08-04 12:09 ` [pmg-devel] [PATCH log-tracker 1/2] add clamd signature found messages to log output Dominik Csapak
2023-09-12 14:18   ` Stoiko Ivanov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal