eximconf: log information about MIME parts
authorAdam D. Barratt <adam@adam-barratt.org.uk>
Mon, 7 Oct 2019 18:31:20 +0000 (19:31 +0100)
committerAdam D. Barratt <adam@adam-barratt.org.uk>
Mon, 7 Oct 2019 18:31:20 +0000 (19:31 +0100)
This provides some useful debugging information. Initially it will be
used to survey the likelihood of legitimate attachments being blocked
if further rules are introduced. For this reason, we only log the
"extension", not the full filename.

Signed-off-by: Adam D. Barratt <adam@adam-barratt.org.uk>
modules/exim/templates/eximconf.erb

index 1b5a802..a11e8d5 100644 (file)
@@ -942,6 +942,14 @@ acl_check_mime:
          condition     = ${if !eq{$acl_m_srb}{false}}
          message       = X-Surbl-Hit: $primary_hostname: $acl_m_srb
 
          condition     = ${if !eq{$acl_m_srb}{false}}
          message       = X-Surbl-Hit: $primary_hostname: $acl_m_srb
 
+  # Dump MIME parts to disk. "default" creates sequentially-named files
+  # in <spool_directory>/scan/<message_id>/ which should then be
+  # automagically unlinked after processing.
+  warn   decode        = default
+
+  # Log some information about attachments for debugging
+  warn   log_message   = MIME part [$mime_part_count] -> [${extract{-1}{.}{${lc:$mime_filename}}}] [$mime_content_type]
+
   accept
 
 <%- end -%>
   accept
 
 <%- end -%>