chiark / gitweb /
exchange.m4: Rename X-Distorted-... headers in messages from outside.
[exim-config] / exchange.m4
index 9f8324a6c9f74bd862f788e308c2d76f4d70a273..fe79ce31d04e5ef4e73189e86269a217855f291c 100644 (file)
@@ -62,6 +62,27 @@ mail_client_addr:
        ## OK.
        accept
 
+DIVERT(null)
+###--------------------------------------------------------------------------
+### Rename locally-meaningful headers in mail from outside.
+
+m4_define(<:DISTORTED_HEADERS:>,
+<:X-CONF_header_token-Warning,
+X-CONF_header_token-SpamAssassin-Score,
+X-CONF_header_token-SpamAssassin-Status:>)
+
+SECTION(acl, data)m4_dnl
+       ## If this message is coming from outside then rename headers which
+       ## look like the ones we're likely to add.  This is most relevant for
+       ## our spam-report headers, because I'm not sure I understand why
+       ## someone would want to fake an X-Distorted-Warning header.
+       warn    !condition = ${if eq{$acl_c_mode}{submission}}
+               !hosts = +allnets
+                set acl_m_hdradd = ${if def:acl_m_hdradd{$acl_m_hdradd}}\
+                       RENAME_HEADERS_ADD(<:DISTORTED_HEADERS:>)
+                set acl_m_hdrrm = ${if def:acl_m_hdrrm{$acl_m_hdrrm:}}\
+                       RENAME_HEADERS_REMOVE(<:DISTORTED_HEADERS:>)
+
 DIVERT(null)
 ###--------------------------------------------------------------------------
 ### The obvious trivial router.