Re: [exim] Exim's smtp_active_hostname option

Top Page
Delete this message
Reply to this message
Author: Sven Eschenberg
Date:  
To: exim-users
Subject: Re: [exim] Exim's smtp_active_hostname option
First of, I am sorry Jeremy, that I answered you directly and did not
hit the list reply button *sigh*.

Here's my answer to the list:

I hope it is okay to paste in some output to show the behavior:

Config (for testing):
smtp_active_hostname = SomeRandomName

exim -odq -t
To: dark@stratus
Subject: Test

Hello World
.

I am using a minimal setup here to keep things simple for display/testing.

exim -Mvh 1b5aYM-00014g-UJ
1b5aYM-00014g-UJ-H
root 0 0
<root@stratus>
1464189418 0
-active_hostname SomeRandomName
-ident root
-received_protocol local
-body_linecount 1
-max_received_linelength 16
-auth_id root
-auth_sender root@stratus
-allow_unqualified_recipient
-allow_unqualified_sender
-deliver_firsttime
-local
XX
1
dark@stratus

158P Received: from root by stratus with local (Exim 4.87)
     (envelope-from <root@stratus>)
     id 1b5aYM-00014g-UJ
     for dark@stratus; Wed, 25 May 2016 17:17:19 +0200
017T To: dark@stratus
014  Subject: Test
040I Message-Id: <E1b5aYM-00014g-UJ@stratus>
026F From: root <root@stratus>
038  Date: Wed, 25 May 2016 17:17:15 +0200


As one can see, active_hostname got expanded and used. (Same holds true
for exim -bs I guess, but I can verify this later if you want).

Of course it can be debated if -bs as it uses smtp should expand
smtp_active_hostname, even though the mail is coming in via stdin.

Someone asked why this imposes a problem, here's a simplified version of
an expansion string where the expansion caused a panic:
smtp_active_hostname = ${extract{$received_ip_address}{ip1=hosta
ipx=hostx ipn=hostn}fail}

Now for both exim -t and -bs expansion fails as the key for ${extract is
empty. It actually happened first time when exim tried to create a
sender notification for a failure (exim calls/execs exim -t <....> for
that).

I could certainly agree that when -oMi is present and an
interface/connections is 'simulated', that expansion takes place. It
does seem a little weird for mails passed in via stdin, though. Well, at
least with respect to the current documentation, that is.

Yes, I know I can check if $received_ip_address is set. Unfortunately I
hit a weird behavior there too which puzzles me, but that's a different
story .

Regards

-Sven

Am 25.05.2016 um 15:03 schrieb Jeremy Harris:
> On 24/05/16 15:59, Sven Eschenberg wrote:
>> The documentation states (v4.87) for smtp_active_hostname:
>> At the start of an incoming SMTP connection, its value is expanded and
>> used instead of the value of $primary_hostname in SMTP responses.
>>
>> While this seems reasonable it does seem to imply that no expansion
>> takes place whenever neither smtp is used nor a connection is coming in.
>
> Arguably it says nothing either way. You cannot infer that.
> (but I'm language-lawyering...)
>
>> Unfortunately I had to realize that exim still expands
>> smtp_active_hostname for locally incoming mail.
>
> What's your definition of "local" here? Is smtp involved?
>