>
>>  I don't suppose you mean
>> that you  want to limit the number of apparent recipients in the To: and
>> Cc: header  fields. :-)
>
> He might do. That's something I'm trying to implement here, after a very
> nasty internal spam attack. Someone emailed all students on campus, and
> included 20,000 email addresses in the To: header. 70 people hit
> reply-to-all.
>
> What I'm trying to do, if I can get the syntax right, is replace long
> headers To: and Cc: headers (say, more than 1024 chars) with a comment
> like  "long list hidden by postmaster:;". I don't see a way of actually
> counting  the number of addresses, which I'd slightly prefer.
>

I've got this working now. So, my MSA server is rewriting long To: and Cc: 
headers.

I had difficulty getting the syntax right, so I refactored to put the code 
into macros, so my transports look like this:

remote_smtp:
    driver = smtp
    no_delay_after_cutoff
    headers_remove = \
        Bcc \
        REMOVE_LONG_HEADERS
    headers_add = \
        X-Sussex: true \
        REPLACE_LONG_HEADERS
    hosts_avoid_tls = !*.sussex.ac.uk : !*.susx.ac.uk

The "X-Sussex: true" header lets my MX server know whether a message 
originated here. Ideally I'd do something clever with encryption, but 
that's not relevant here. What is relevant is the REMOVE_LONG_HEADERS 
macro. I use a macro because I have four transports: remote_smtp, 
remote_lmtp, remote_smtp_rew, and remote_lmtp_rew. The lmtp transports are 
for delivery to our Cyrus IMAP server. The _rew variants are for people 
that want their sender addresses canonicalised (my spell checker wants to 
say "cannibalised" here!).

So, the Macros look like this:

# Maximum permitted header lengths (unit is characters)(
MAX_CC = 4096
MAX_TO = 4096

# This condition tests that the To: header is less than MAX_TO characters.
LONG_TO_HEADERS = \
          > { ${strlen:$h_To:} } {MAX_TO}

# This condition tests that the Cc: header is less than MAX_CC characters.
LONG_CC_HEADERS = \
          > { ${strlen:$h_Cc:} } {MAX_CC}

# This is used by headers_remove
REMOVE_LONG_HEADERS = \
    ${if  LONG_TO_HEADERS {: To }}\
    ${if  LONG_CC_HEADERS {: Cc }}

# This is used by headers_add

CONCEALED_STRING = address list masked by postmaster:;

REPLACE_LONG_HEADERS = \
    ${if  LONG_TO_HEADERS {\nTo: CONCEALED_STRING }}\
    ${if  LONG_CC_HEADERS {\nCc: CONCEALED_STRING }}





-- 
Ian Eiloart
IT Services, University of Sussex

-- 
## List details at http://www.exim.org/mailman/listinfo/exim-users 
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://www.exim.org/eximwiki/

Reply via email to