[pmg-devel] [PATCH log-tracker 1/2] add clamd signature found messages to log output
Mira Limbeck
m.limbeck at proxmox.com
Wed Jul 19 17:13:51 CEST 2023
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 at 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
More information about the pmg-devel
mailing list