Mailing List Archive

exim rewrites the "From:" address
When I send an email using: mailx -r , specifying the from address in
the form name@domain, exim rewrites the domain of the From: address and
Sender: address to the first entry in the local_domains list. My server
hosts multiple domains, so I need to be able to specify the domain part
of the email address.

My server uses Debian so the configuration is generated from files
exim4.conf.localmacros (where I set: MAIN_FORCE_SENDER to yes) and
update-exim4.conf.conf (where I set dc_other_hostnames to the list
of domain names on this server). But I checked the generated file
/var/lib/exim4/config.autogenerated and it contains:


.ifndef MAIN_FORCE_SENDER
local_from_check = false
local_sender_retain = true
untrusted_set_sender = *
.endif

which according to my understanding of the documentation should make
exim leave the from address specified in the command
mailx -r name@domain destination
unchanged. But on restarting exim and sending an email with mailx -r,
it doesn't, it rewrites the domain name.

Why is it doing this and how can I stop it?


--
## List details at https://lists.exim.org/mailman/listinfo/exim-users
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/
Re: exim rewrites the "From:" address [ In reply to ]
On 25/02/2023 23:21, Nick via Exim-users wrote:
> Why is it doing this

Possibility 1: the macro is not in fact set.

Check by running "exim -bP macros | grep MAIN_FORCE_SENDER"

--
Cheers,
Jeremy


--
## List details at https://lists.exim.org/mailman/listinfo/exim-users
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/
Re: exim rewrites the "From:" address [ In reply to ]
On 25/02/2023 23:21, Nick via Exim-users wrote:
> Why is it doing this and how can I stop it?

Possibility 2: "mailx" does not actually run exim with the arguments
you think it does.
--
Cheers,
Jeremy


--
## List details at https://lists.exim.org/mailman/listinfo/exim-users
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/
Re: exim rewrites the "From:" address [ In reply to ]
On Sat, 25 Feb 2023, Nick via Exim-users wrote:

> When I send an email using: mailx -r , specifying the from address in
> the form name@domain, exim rewrites the domain of the From: address and
> Sender: address to the first entry in the local_domains list. My server
> hosts multiple domains, so I need to be able to specify the domain part
> of the email address.
>
> My server uses Debian so the configuration is generated from files
> exim4.conf.localmacros?(where I set: MAIN_FORCE_SENDER to yes) and
> update-exim4.conf.conf (where I set dc_other_hostnames to the list
> of domain names on this server). But I checked the generated file
> /var/lib/exim4/config.autogenerated and it contains:
>
>
> .ifndef MAIN_FORCE_SENDER
> local_from_check = false
> local_sender_retain = true
> untrusted_set_sender = *
> .endif

If you *set* MAIN_FORCE_SENDER, then that section will *not* be executed
(there is an "n" in "ifndef"). I don't think that is what you meant.

> which according to my understanding of the documentation should make
> exim leave the from address specified in the command
> mailx -r name@domain destination
> unchanged. But on restarting exim and sending an email with mailx -r,
> it doesn't, it rewrites the domain name.
>
> Why is it doing this and how can I stop it?

--
Andrew C. Aitchison Kendal, UK
andrew@aitchison.me.uk
--
## List details at https://lists.exim.org/mailman/listinfo/exim-users
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/
Re: exim rewrites the "From:" address [ In reply to ]
A dom, 26-02-2023 às 12:11 +0000, Jeremy Harris via Exim-users
escreveu:
> On 25/02/2023 23:21, Nick via Exim-users wrote:
> > Why is it doing this
>
> Possibility 1: the macro is not in fact set.
>
> Check by running "exim -bP macros | grep MAIN_FORCE_SENDER"
>
> --
> Cheers,
>    Jeremy
>
>
Result:
MAIN_FORCE_SENDER=yes

--
## List details at https://lists.exim.org/mailman/listinfo/exim-users
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/
Re: exim rewrites the "From:" address [ In reply to ]
A dom, 26-02-2023 às 12:55 +0000, Andrew C Aitchison via Exim-users
escreveu:
> On Sat, 25 Feb 2023, Nick via Exim-users wrote:
>
> > When I send an email using: mailx -r , specifying the from address
> > in
> > the form name@domain, exim rewrites the domain of the From: address
> > and
> > Sender: address to the first entry in the local_domains list. My
> > server
> > hosts multiple domains, so I need to be able to specify the domain
> > part
> > of the email address.
> >
> > My server uses Debian so the configuration is generated from files
> > exim4.conf.localmacros (where I set: MAIN_FORCE_SENDER to yes) and
> > update-exim4.conf.conf (where I set dc_other_hostnames to the list
> > of domain names on this server). But I checked the generated file
> > /var/lib/exim4/config.autogenerated and it contains:
> >
> >
> > .ifndef MAIN_FORCE_SENDER
> > local_from_check = false
> > local_sender_retain = true
> > untrusted_set_sender = *
> > .endif
>
> If you *set* MAIN_FORCE_SENDER, then that section will *not* be
> executed
> (there is an "n" in "ifndef"). I don't think that is what you meant.
>
> > which according to my understanding of the documentation should
> > make
> > exim leave the from address specified in the command
> > mailx -r name@domain destination
> > unchanged. But on restarting exim and sending an email with mailx -
> > r,
> > it doesn't, it rewrites the domain name.
> >
> > Why is it doing this and how can I stop it?
>
> --
> Andrew C. Aitchison                      Kendal, UK
>                     andrew@aitchison.me.uk
Good point. So I deleted the MAIN_FORCE_SENDER line from
exim4.conf.localmacros,
ran update-exim4.conf,
ran /etc/init.d/exim4 restart,
and then ran  exim -bP macros | grep MAIN_FORCE_SENDER
which now produced no output.
Then I ran mailx -r with the desired from address.

All this made absoultely no difference. Exim still rewrites the "From"
address.
(Actually, that bad MAIN_FORCE_SENDER line was inserted in a misguided
previous attempt to fix the problem.)


--
## List details at https://lists.exim.org/mailman/listinfo/exim-users
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/
Re: exim rewrites the "From:" address [ In reply to ]
Le 2023-02-25 23:21, Nick via Exim-users a ?crit :
> When I send an email using: mailx -r , specifying the from address in
> the form name@domain, exim rewrites the domain of the From: address and
> Sender: address to the first entry in the local_domains list. My server
> hosts multiple domains, so I need to be able to specify the domain part
> of the email address.
>
> My server uses Debian so the configuration is generated from files
> exim4.conf.localmacros?(where I set: MAIN_FORCE_SENDER to yes) and
> update-exim4.conf.conf (where I set dc_other_hostnames to the list
> of domain names on this server). But I checked the generated file
> /var/lib/exim4/config.autogenerated and it contains:
>
>
> .ifndef MAIN_FORCE_SENDER
> local_from_check = false
> local_sender_retain = true
> untrusted_set_sender = *
> .endif
>
> which according to my understanding of the documentation should make
> exim leave the from address specified in the command
> mailx -r name@domain destination
> unchanged. But on restarting exim and sending an email with mailx -r,
> it doesn't, it rewrites the domain name.
>
> Why is it doing this and how can I stop it?
>
>
> --
> ## List details at https://lists.exim.org/mailman/listinfo/exim-users
> ## Exim details at http://www.exim.org/
> ## Please use the Wiki with this list - http://wiki.exim.org/

Hi,

I've just trie to send an email with mailx -r specifying a from adress.
It works fine.
Tested on a Debian sid with a from address on a domain different from
the default one (user root).
I use exim4-daemon-heavy 4.96-14

--
## List details at https://lists.exim.org/mailman/listinfo/exim-users
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/
Re: exim rewrites the "From:" address [ In reply to ]
A dom, 26-02-2023 às 16:46 +0100, nb via Exim-users escreveu:
> Le 2023-02-25 23:21, Nick via Exim-users a écrit :
> > When I send an email using: mailx -r , specifying the from address
> > in
> > the form name@domain, exim rewrites the domain of the From: address
> > and
> > Sender: address to the first entry in the local_domains list. My
> > server
> > hosts multiple domains, so I need to be able to specify the domain
> > part
> > of the email address.
> >
> > My server uses Debian so the configuration is generated from files
> > exim4.conf.localmacros (where I set: MAIN_FORCE_SENDER to yes) and
> > update-exim4.conf.conf (where I set dc_other_hostnames to the list
> > of domain names on this server). But I checked the generated file
> > /var/lib/exim4/config.autogenerated and it contains:
> >
> >
> > .ifndef MAIN_FORCE_SENDER
> > local_from_check = false
> > local_sender_retain = true
> > untrusted_set_sender = *
> > .endif
> >
> > which according to my understanding of the documentation should
> > make
> > exim leave the from address specified in the command
> > mailx -r name@domain destination
> > unchanged. But on restarting exim and sending an email with mailx -
> > r,
> > it doesn't, it rewrites the domain name.
> >
> > Why is it doing this and how can I stop it?
> >
> >
> > --
> > ## List details at https://lists.exim.org/mailman/listinfo/exim-
> > users
> > ## Exim details at http://www.exim.org/
> > ## Please use the Wiki with this list - http://wiki.exim.org/
>
> Hi,
>
> I've just trie to send an email with mailx -r specifying a from
> adress.
> It works fine.
> Tested on a Debian sid with a from address on a domain different from
> the default one (user root).
> I use exim4-daemon-heavy 4.96-14
>
That doesn't address the question - no-one doubted that Exim 4.xx
is able to preserve the From: address.
The point is, what is it in the config files that makes it rewrite
the From: address; or alternatively, what should be in the config
files to make it preserve the From: address?


--
## List details at https://lists.exim.org/mailman/listinfo/exim-users
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/
Re: exim rewrites the "From:" address [ In reply to ]
> That doesn't address the question - no-one doubted that Exim 4.xx
> is able to preserve the From: address.
> The point is, what is it in the config files that makes it rewrite
> the From: address; or alternatively, what should be in the config
> files to make it preserve the From: address?

I don't know if this can help you.
Here's my /etc/exim4/update-exim4.conf.conf


dc_eximconfig_configtype='internet'
dc_other_hostnames='colibri.dagami.org : colibri : dagami.org : dagami.tk : sncli.cf'
dc_local_interfaces=''
dc_readhost=''
dc_relay_domains=''
dc_minimaldns='false'
dc_relay_nets='... my list of allowed servers ...'
dc_smarthost=''
CFILEMODE='644'
dc_use_split_config='true'
dc_hide_mailname=''
dc_mailname_in_oh='true'
dc_localdelivery='dovecot_vmail'

/etc/mailname contain:
colibri.dagami.org


--
## List details at https://lists.exim.org/mailman/listinfo/exim-users
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/
Re: exim rewrites the "From:" address [ In reply to ]
Ahoj,

D?a Mon, 27 Feb 2023 16:01:19 +0000 Nick via Exim-users
<exim-users@exim.org> napísal:

> That doesn't address the question - no-one doubted that Exim 4.xx
> is able to preserve the From: address.
> The point is, what is it in the config files that makes it rewrite
> the From: address; or alternatively, what should be in the config
> files to make it preserve the From: address?

We do not know what is in config file, but we are expected to know what
is wrong in it?

By that the answer perfectly "address the question" -- it is something
in your config, which is not there by default and you (original poster)
have either to share whole config (or relevant parts, but it seems that
you do not know exactly which parts are relevant) or debug it by self.

regards

--
Slavko
https://www.slavino.sk
Re: exim rewrites the "From:" address [ In reply to ]
On Mon, 27 Feb 2023, Nick via Exim-users wrote:

> That doesn't address the question - no-one doubted that Exim 4.xx
> is able to preserve the From: address.
> The point is, what is it in the config files that makes it rewrite
> the From: address; or alternatively, what should be in the config
> files to make it preserve the From: address?

Well, I would look at the header rewrite section first. It starts with
begin rewrite
and continues until the nexxt begin (or the end of the file).

--
Andrew C. Aitchison Kendal, UK
andrew@aitchison.me.uk

--
## List details at https://lists.exim.org/mailman/listinfo/exim-users
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/
Re: exim rewrites the "From:" address [ In reply to ]
On Mon, Feb 27, 2023 at 04:01:19PM +0000, Nick via Exim-users wrote:
> The point is, what is it in the config files that makes it rewrite
> the From: address; or alternatively, what should be in the config
> files to make it preserve the From: address?

Almost all possible manipulations with this header should be in the
"rewrite" section of config file, which is generally small and should be
studied first.

Headers can be also added/removed in ACLs, with "grep From exim.conf"
all such points may be found quickly.

And with -brw and -d-all+rewrite command line options one can bisect
from original (distribution) config to problematic config.
Again, the "rewrite" section should be inspected first.
--
Eugene Berdnikov

--
## List details at https://lists.exim.org/mailman/listinfo/exim-users
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/
Re: exim rewrites the "From:" address [ In reply to ]
Hi all

Worth noting - as we have many, many times on this list - that if you're
using Debian or a derivative such as Ubuntu, then this list may not be able
to help you.

The split config, the macros etc - they're all Debian specific.

Additionally, if the OP would be kind enough to subscribe to the list, that
would stop me having to release their posts several times per day.

Thanks

Graeme (moderator)
--
## List details at https://lists.exim.org/mailman/listinfo/exim-users
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/
Re: exim rewrites the "From:" address [ In reply to ]
A seg, 27-02-2023 às 20:38 +0000, Andrew C Aitchison via Exim-users
escreveu:
> On Mon, 27 Feb 2023, Nick via Exim-users wrote:
>
> > That doesn't address the question - no-one doubted that Exim 4.xx
> > is able to preserve the From: address.
> > The point is, what is it in the config files that makes it rewrite
> > the From: address; or alternatively, what should be in the config
> > files to make it preserve the From: address?
>
> Well, I would look at the header rewrite section first. It starts
> with
> begin rewrite
> and continues until the nexxt begin (or the end of the file).
>
> --
> Andrew C. Aitchison                      Kendal, UK
>                     andrew@aitchison.me.uk
>

The 'begin rewrite' section in my /var/lib/exim4/config.autogenerated
is as follows:
------cut----
begin rewrite

.ifndef NO_EAA_REWRITE_REWRITE
*@+local_domains "${lookup{${local_part}}lsearch{/etc/email-addresses}\
{$value}fail}" Ffrs
*@ETC_MAILNAME "${lookup{${local_part}}lsearch{/etc/email-addresses}\
{$value}fail}" Ffrs
.endif

begin authenticators
----cut------
I guess the next step is to display the output of
exim -bP macros | grep NO_EAA_REWRITE_REWRITE
which produces no output at all, so NO_EAA_REWRITE_REWRITE
seems not to be set. So exim is looking at /etc/email-addresses.
I'd overlooked /etc/email-addresses. Seems that putting
an email address in there results in all email from that
user getting its From: address rewritten.
So I took out that user from the /etc/email-addresses
file. Now, that user can use mailx -r and it does what I want.
Your message solved my problem.
Thank you!

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