Mailing List Archive

Destination address in a transport
Hi,

I need to find out how to put the destination email address into the my
transport. How do I do that?
Is that available in a ready-made variable?

my_router:
  driver = accept
  domains = ! +local_domains
  transport = my_transport
  no_more

my_transport:
  driver = pipe
  user = nobody
  command = /usr/bin/my_proggie - <destination-email-address>     <----
This is where I need to insert the recipient's email address
  return_fail_output

Thanks,
Thomas



--
## subscription configuration (requires account):
## https://lists.exim.org/mailman3/postorius/lists/exim-users.lists.exim.org/
## unsubscribe (doesn't require an account):
## exim-users-unsubscribe@lists.exim.org
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/
Re: Destination address in a transport [ In reply to ]
On Tue, Oct 24, 2023 at 08:48:30PM +0200, Thomas Andrews via Exim-users wrote:

> I need to find out how to put the destination email address into the
> my transport. How do I do that? Is that available in a ready-made
> variable?

Funny, I was just thinking about this too, in the context of the DKIM
threads. The only way I see is $local_part@$domain , but I'm afraid
I may miss some subtlety that way.

--
Ian

--
## subscription configuration (requires account):
## https://lists.exim.org/mailman3/postorius/lists/exim-users.lists.exim.org/
## unsubscribe (doesn't require an account):
## exim-users-unsubscribe@lists.exim.org
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/
Re: Destination address in a transport [ In reply to ]
On 25/10/2023 17:48, Ian Z via Exim-users wrote:
> On Tue, Oct 24, 2023 at 08:48:30PM +0200, Thomas Andrews via Exim-users wrote:
>
>> I need to find out how to put the destination email address into the
>> my transport. How do I do that? Is that available in a ready-made
>> variable?
>
> Funny, I was just thinking about this too, in the context of the DKIM
> threads. The only way I see is $local_part@$domain , but I'm afraid
> I may miss some subtlety that way.

For use in a command line for a pipe transport, you'll need de-tainted
versions of those. Which means full verification of both components
against a local source of trust.
--
Cheers,
Jeremy


--
## subscription configuration (requires account):
## https://lists.exim.org/mailman3/postorius/lists/exim-users.lists.exim.org/
## unsubscribe (doesn't require an account):
## exim-users-unsubscribe@lists.exim.org
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/
Re: Destination address in a transport [ In reply to ]
On 10/25/23 23:09, Jeremy Harris via Exim-users wrote:
> On 25/10/2023 17:48, Ian Z via Exim-users wrote:
>> On Tue, Oct 24, 2023 at 08:48:30PM +0200, Thomas Andrews via
>> Exim-users wrote:
>>
>>> I need to find out how to put the destination email address into the
>>> my transport. How do I do that?  Is that available in a ready-made
>>> variable?
>>
>> Funny, I was just thinking about this too, in the context of the DKIM
>> threads. The only way I see is $local_part@$domain , but I'm afraid
>> I may miss some subtlety that way.
>
> For use in a command line for a pipe transport, you'll need de-tainted
> versions of those.  Which means full verification of both components
> against a local source of trust.

The destination address could be gjh@wimzail.org or anything - ie I have
no way to de-taint it as it is not a local address. Therefore using
$local_part and $domain is not an option. What are my other options? (By
the way, it doesn't actually matter if the destination address is
tainted in my case - the external program my_proggie will deal with that.)

--
Thanks,
Thomas

--
## subscription configuration (requires account):
## https://lists.exim.org/mailman3/postorius/lists/exim-users.lists.exim.org/
## unsubscribe (doesn't require an account):
## exim-users-unsubscribe@lists.exim.org
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/
Re: Destination address in a transport [ In reply to ]
On 2023-10-26 Thomas Andrews via Exim-users <exim-users@lists.exim.org> wrote:
> On 10/25/23 23:09, Jeremy Harris via Exim-users wrote:
[...]
> > For use in a command line for a pipe transport, you'll need de-tainted
> > versions of those.? Which means full verification of both components
> > against a local source of trust.

> The destination address could be gjh@wimzail.org or anything - ie I have no
> way to de-taint it as it is not a local address. Therefore using $local_part
> and $domain is not an option. What are my other options? (By the way, it
> doesn't actually matter if the destination address is tainted in my case -
> the external program my_proggie will deal with that.)

Exim will refuse to invoke the external arguments with tainted
arguments.

Other options are to pass on the information by different means than a
commandline arguments, inline like using lmtp protocol.

cu Andreas
--
`What a good friend you are to him, Dr. Maturin. His other friends are
so grateful to you.'
`I sew his ears on from time to time, sure'

--
## subscription configuration (requires account):
## https://lists.exim.org/mailman3/postorius/lists/exim-users.lists.exim.org/
## unsubscribe (doesn't require an account):
## exim-users-unsubscribe@lists.exim.org
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/
Re: Destination address in a transport [ In reply to ]
On 26/10/2023 05:38, Thomas Andrews via Exim-users wrote:
> What are my other options?

What is this external program doing? Could you be using the
transport-filter facilities?
--
Cheers,
Jeremy


--
## subscription configuration (requires account):
## https://lists.exim.org/mailman3/postorius/lists/exim-users.lists.exim.org/
## unsubscribe (doesn't require an account):
## exim-users-unsubscribe@lists.exim.org
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/
Re: Destination address in a transport [ In reply to ]
On 10/26/23 10:57, Jeremy Harris via Exim-users wrote:
> On 26/10/2023 05:38, Thomas Andrews via Exim-users wrote:
>> What are my other options?
>
> What is this external program doing?  Could you be using the
> transport-filter facilities?

The external program is delivering the email to another server for
further processing.

--
Regards,
Thomas


--
## subscription configuration (requires account):
## https://lists.exim.org/mailman3/postorius/lists/exim-users.lists.exim.org/
## unsubscribe (doesn't require an account):
## exim-users-unsubscribe@lists.exim.org
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/
Re: Destination address in a transport [ In reply to ]
On 26/10/2023 10:11, Thomas Andrews via Exim-users wrote:
> The external program is delivering the email to another server for further processing.

If that's all it is doing, and the delivery is done using SMTP, Exim
can do that itself. What are you not telling us?
--
Cheers,
Jeremy


--
## subscription configuration (requires account):
## https://lists.exim.org/mailman3/postorius/lists/exim-users.lists.exim.org/
## unsubscribe (doesn't require an account):
## exim-users-unsubscribe@lists.exim.org
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/
Re: Destination address in a transport [ In reply to ]
On 10/26/23 11:51, Jeremy Harris via Exim-users wrote:
> On 26/10/2023 10:11, Thomas Andrews via Exim-users wrote:
>> The external program is delivering the email to another server for
>> further processing.
>
> If that's all it is doing, and the delivery is done using SMTP, Exim
> can do that itself.  What are you not telling us?

Sorry for the vagueness - I just didn't want to clutter with too much
info. The emails are not getting delivered to the next machine via SMTP
- that option is not available/possible/suitable in this case. So, it's
a bespoke program that is used to do the transfer. (And that facilitates
additional processing, but that's not relevant.)

--
Thanks,
Thomas


--
## subscription configuration (requires account):
## https://lists.exim.org/mailman3/postorius/lists/exim-users.lists.exim.org/
## unsubscribe (doesn't require an account):
## exim-users-unsubscribe@lists.exim.org
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/
Re: Destination address in a transport [ In reply to ]
On 2023-10-26, Thomas Andrews via Exim-users <exim-users@lists.exim.org> wrote:
> On 10/26/23 11:51, Jeremy Harris via Exim-users wrote:
>> On 26/10/2023 10:11, Thomas Andrews via Exim-users wrote:
>>> The external program is delivering the email to another server for
>>> further processing.
>>
>> If that's all it is doing, and the delivery is done using SMTP, Exim
>> can do that itself.  What are you not telling us?
>
> Sorry for the vagueness - I just didn't want to clutter with too much
> info. The emails are not getting delivered to the next machine via SMTP
> - that option is not available/possible/suitable in this case. So, it's
> a bespoke program that is used to do the transfer. (And that facilitates
> additional processing, but that's not relevant.)

I think reading the fine documentation might help - there's an index
entry for de-tainting. In particular, I suspect wildlsearch is useful,
though I haven't had to do it yet.

--
## subscription configuration (requires account):
## https://lists.exim.org/mailman3/postorius/lists/exim-users.lists.exim.org/
## unsubscribe (doesn't require an account):
## exim-users-unsubscribe@lists.exim.org
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/
Re: Destination address in a transport [ In reply to ]
On 26/10/2023 11:19, Thomas Andrews via Exim-users wrote:
> he emails are not getting delivered to the next machine via SMTP - that option is not available/possible/suitable in this case. So, it's a bespoke program that is used to do the transfer.

The optimal solution would be to rewrite this bespoke program to
talk ESMTP or LMTP. Anything else would constitute a deliberate evasion
of the security reasons for taint-tracking.
--
Cheers,
Jeremy


--
## subscription configuration (requires account):
## https://lists.exim.org/mailman3/postorius/lists/exim-users.lists.exim.org/
## unsubscribe (doesn't require an account):
## exim-users-unsubscribe@lists.exim.org
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/
Re: Destination address in a transport [ In reply to ]
Hi!

On Thu, 26 Oct 2023, Thomas Andrews via Exim-users wrote:

> The destination address could be gjh@wimzail.org or anything - ie I have no
> way to de-taint it as it is not a local address. Therefore using $local_part
> and $domain is not an option. What are my other options? (By the way, it
> doesn't actually matter if the destination address is tainted in my case -
> the external program my_proggie will deal with that.)

There are two solutions available. One is a dirty hack
(https://jimbobmcgee.wordpress.com/2020/07/29/de-tainting-exim-configuration-variables/)
which can be set up within exim. And the other one is a wrapper which uses
the environment variables set by exim when run. The env variables include
the receipient's email address. This way the wrapper is called without any
tainted variables, exim is happy, and the wrapper still gets the
receipient's email address.

ciao
Markus
--
/ Markus Reschke \
\ madires@theca-tabellaria.de /


--
## subscription configuration (requires account):
## https://lists.exim.org/mailman3/postorius/lists/exim-users.lists.exim.org/
## unsubscribe (doesn't require an account):
## exim-users-unsubscribe@lists.exim.org
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/
Re: Destination address in a transport [ In reply to ]
On 2023-10-26, Jeremy Harris via Exim-users <exim-users@lists.exim.org> wrote:
> On 26/10/2023 11:19, Thomas Andrews via Exim-users wrote:
>> he emails are not getting delivered to the next machine via SMTP - that option is not available/possible/suitable in this case. So, it's a bespoke program that is used to do the transfer.
>
> The optimal solution would be to rewrite this bespoke program to
> talk ESMTP or LMTP. Anything else would constitute a deliberate evasion
> of the security reasons for taint-tracking.

I think it would constitute evading Exim's limited idea of security.
If an external program is known to assume that its arguments are
tainted, it is safe, in a properly expressed security policy, to pass
it tainted arguments. (Assuming that there are no OS or library bugs
allowing for overflow attacks etc. by argument passing, but that's not
a policy issue.) Arguments are just another input to the program.

Correct me if I'm wrong :)





--
## subscription configuration (requires account):
## https://lists.exim.org/mailman3/postorius/lists/exim-users.lists.exim.org/
## unsubscribe (doesn't require an account):
## exim-users-unsubscribe@lists.exim.org
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/
Re: Destination address in a transport [ In reply to ]
On 2023-10-26, Thomas Andrews via Exim-users <exim-users@lists.exim.org> wrote:
> On 10/26/23 11:51, Jeremy Harris via Exim-users wrote:
>> On 26/10/2023 10:11, Thomas Andrews via Exim-users wrote:
>>> The external program is delivering the email to another server for
>>> further processing.
>>
>> If that's all it is doing, and the delivery is done using SMTP, Exim
>> can do that itself.  What are you not telling us?
>
> Sorry for the vagueness - I just didn't want to clutter with too much
> info. The emails are not getting delivered to the next machine via SMTP
> - that option is not available/possible/suitable in this case. So, it's
> a bespoke program that is used to do the transfer. (And that facilitates
> additional processing, but that's not relevant.)
>

Can you modfy the program so that it takes the destination address
from a header instead of from the command line?


--
Jasen.
???????? ????? ???????

--
## subscription configuration (requires account):
## https://lists.exim.org/mailman3/postorius/lists/exim-users.lists.exim.org/
## unsubscribe (doesn't require an account):
## exim-users-unsubscribe@lists.exim.org
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/
Re: Destination address in a transport [ In reply to ]
On 10/27/23 06:09, Jasen Betts via Exim-users wrote:
> On 2023-10-26, Thomas Andrews via Exim-users <exim-users@lists.exim.org> wrote:
>> On 10/26/23 11:51, Jeremy Harris via Exim-users wrote:
>>> On 26/10/2023 10:11, Thomas Andrews via Exim-users wrote:
>>>> The external program is delivering the email to another server for
>>>> further processing.
>>> If that's all it is doing, and the delivery is done using SMTP, Exim
>>> can do that itself.  What are you not telling us?
>> Sorry for the vagueness - I just didn't want to clutter with too much
>> info. The emails are not getting delivered to the next machine via SMTP
>> - that option is not available/possible/suitable in this case. So, it's
>> a bespoke program that is used to do the transfer. (And that facilitates
>> additional processing, but that's not relevant.)
>>
> Can you modfy the program so that it takes the destination address
> from a header instead of from the command line?
Thanks Jasen, but I have elected to use the "dirty hack" solution
suggested by Markus Reschke.

--
Regards,
Thomas


--
## subscription configuration (requires account):
## https://lists.exim.org/mailman3/postorius/lists/exim-users.lists.exim.org/
## unsubscribe (doesn't require an account):
## exim-users-unsubscribe@lists.exim.org
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/