Re: [exim] Hide IP address of authenticated users

Top Page
Delete this message
Reply to this message
Author: Jasen Betts
Date:  
To: exim-users
Subject: Re: [exim] Hide IP address of authenticated users
On 2023-03-14, Yves Goergen via Exim-users <exim-users@???> wrote:
> Hello,
>
> I'd like to hide the IP address of authenticated users sending their
> messages over my SMTP server. The address always appears in the
> "Received" header and remains there for the final recipient.
>
> A web search has only led to this information:
>
> https://serverfault.com/questions/1035035/remove-ip-and-username-from-exim-mail-headers
>
> I couldn't find any information about the suggested solution. That
> all-caps name is mentioned in very long Debian package listings, but I
> couldn't find any documentation. The name also doesn't appear in Exim's
> source code (according to GitHub search).
>
> Is there some explanation about this? Does it work? What does it do?
> Should I create the mentioned file if I don't have it yet?


Yes, that is an addition provided by the exim configuration system used
by debian.


I use the following:

received_header_text = Received: \
   ${if def:sender_rcvhost {from \
      ${if bool{$acl_m_mangle_received}{\
   ${sg{$sender_rcvhost}{\\[(\\d+\\.\\d+\\.\\d+)\\.\\d+\\]}{[10.\$1]}}\
      }{$sender_rcvhost}}\n\t}\
          {${if def:sender_ident {from ${quote_local_part:$sender_ident} }}\
    ${if def:sender_helo_name {(helo=$sender_helo_name)\n\t}}}}\
       by $primary_hostname ${if def:received_protocol {with $received_protocol}} \
   ${if def:tls_cipher {($tls_cipher)\n\t}}(Exim $version_number)\n\t\
      ${if def:sender_address {(envelope-from <$sender_address>)\n\t}}\
         id $message_exim_id${if def:received_for {\n\tfor $received_for}}



Where "$acl_m_mangle_received" is a variable set in the mail ACL

This expression conditionally rewites the client ip address a.b.c.d to look like a
LAN address 10.a.b.c

This is enough to satify Spamassassin (which wants to see a received
header) and Barracuda Networks (who take objection to cetrain ip
addresses appearing in received headers)

--
Jasen.
🇺🇦 Слава Україні