[exim] Message-ID header rewriting

Página Principal
Apagar esta mensagem
Responder a esta mensagem
Autor: Peter Denison
Data:  
Para: exim-users
CC: Debian Exim4 maintainers, Jan-Peter.Koopmann
Assunto: [exim] Message-ID header rewriting
For a while I've been thinking about extending header rewriting to the
Message-ID header, so as to not leak information about my internal network
out through the mail gateway. (If you are an anti-rewriting zealot, please
stop reading now!)

I have implemented this, and done some testing of it.

It can be turned on by using the "all-headers" flag, or by adding an 'i'
flag to the rewriting rule flags.

Fortunately someone else appears to also be interested, according to the
exim-users list archives, so I thought I'd share the patch.

Is this sufficient as a patch-submission process, or is there some
other address or list I should forward to? Please someone let me know.
(CC'd to debian maintainers and Jan-Peter as interested parties)

Patch is against 4.34 (from debian source package), but I have checked
visually against a pristine 4.44, and it should apply cleanly with offsets

--- src/rewrite.c.orig    2004-05-10 13:31:20.000000000 +0100
+++ src/rewrite.c    2004-12-17 21:28:28.000000000 +0000
@@ -20,7 +20,8 @@
    "     bcc",
    "reply-to",
    "env-from",
-  "  env-to"
+  "  env-to",
+  "  msg-id"
  };


  /* Structure and table for finding source of address for debug printing */
@@ -39,6 +40,7 @@
    { rewrite_replyto, US"reply-to:" },
    { rewrite_envfrom, US"env-from" },
    { rewrite_envto,   US"env-to" },
+  { rewrite_msgid,   US"message-id:"},
    { rewrite_smtp,    US"smtp recipient" },
    { rewrite_smtp|rewrite_smtp_sender, US"smtp sender" }
  };
@@ -745,6 +747,10 @@
    case htype_reply_to:
    return rewrite_one_header(h, rewrite_replyto, routed_old, routed_new,
      rewrite_rules, existflags, replace);
+
+  case htype_id:
+  return rewrite_one_header(h, rewrite_msgid, routed_old, routed_new,
+    rewrite_rules, existflags, replace);
    }


  return NULL;
--- src/macros.h.orig    2004-05-10 13:31:20.000000000 +0100
+++ src/macros.h    2004-12-17 21:34:38.000000000 +0000
@@ -613,21 +613,22 @@
  #define rewrite_cc           0x0008
  #define rewrite_bcc          0x0010
  #define rewrite_replyto      0x0020
-#define rewrite_all_headers  0x003F  /* all header flags */
+#define rewrite_msgid        0x0040
+#define rewrite_all_headers  0x007F  /* all header flags */


-#define rewrite_envfrom      0x0040
-#define rewrite_envto        0x0080
-#define rewrite_all_envelope 0x00C0  /* all envelope flags */
+#define rewrite_envfrom      0x0080
+#define rewrite_envto        0x0100
+#define rewrite_all_envelope 0x0180  /* all envelope flags */


  #define rewrite_all      (rewrite_all_headers | rewrite_all_envelope)


-#define rewrite_smtp         0x0100  /* rewrite at SMTP time */
-#define rewrite_smtp_sender  0x0200  /* SMTP sender rewrite (allows <>) */
-#define rewrite_qualify      0x0400  /* qualify if necessary */
-#define rewrite_repeat       0x0800  /* repeat rewrite rule */
+#define rewrite_smtp         0x0200  /* rewrite at SMTP time */
+#define rewrite_smtp_sender  0x0400  /* SMTP sender rewrite (allows <>) */
+#define rewrite_qualify      0x0800  /* qualify if necessary */
+#define rewrite_repeat       0x1000  /* repeat rewrite rule */


-#define rewrite_whole        0x1000  /* option bit for headers */
-#define rewrite_quit         0x2000  /* "no more" option */
+#define rewrite_whole        0x2000  /* option bit for headers */
+#define rewrite_quit         0x4000  /* "no more" option */


  /* Flags for log_write(); LOG_MAIN, LOG_PANIC, and LOG_REJECT are also in
  local_scan.h */
--- src/readconf.c.orig    2004-05-10 13:31:20.000000000 +0100
+++ src/readconf.c    2004-12-17 21:34:38.000000000 +0000
@@ -1018,6 +1021,7 @@
    case 'c': next->flags |= rewrite_cc;   break;
    case 'b': next->flags |= rewrite_bcc;  break;
    case 'r': next->flags |= rewrite_replyto; break;
+  case 'i': next->flags |= rewrite_msgid; break;


    case 'E': next->flags |= rewrite_all_envelope; break;
    case 'F': next->flags |= rewrite_envfrom; break;


--
Peter Denison <peterd at marshadder dot org>
Please use this address only for personal mail, not copied to lists
gatewayed to news or web pages unless the addresses are removed.