Re: [exim] Access $domain in ACL?

Top Page
Delete this message
Reply to this message
Author: Heiko Schlittermann
Date:  
To: exim-users
Subject: Re: [exim] Access $domain in ACL?
Rob Gunther via Exim-users <exim-users@???> (Mo 16 Sep 2019 03:22:45 CEST):
> Bummer, I see the $domain variable is not available. RTFM and I see the
> following note:
>
> 15. Data for message ACLs
> In the case of RCPT (but not MAIL or DATA), $domain and $local_part are set
> from the argument address. The entire SMTP command is available in
> $smtp_command.
>
> That sucks, as I don't know who the recipient is the virus-infected message
> is.


The data ACL runs *once* per message. The message can have multiple
recipients, so which domain do you expect in $domain?

Though a "$recipients" variable exists for the DATA acl.

If you've different DATA policies for different recipients, you've to
single them out at RCPT stage.

    # part of the RCPT ACL
    defer   condition = $recipients_count


Or, if you DATA policies are bound to the domain, you've to check if the
domain is known already from a previous recipient, and, if it's the
same, accept the message, otherwise defer it:

    # part of the RCPT ACL
    defer condition = ${if def:acl_m_domain}
          condition = ${if !eq{$domain}{$acl_m_domain}}
    accept set acl_m_domain = $domain


Using the $domain as a key for a policy lookup is left as an excercise
for the reader :)

    Best regards from Dresden/Germany
    Viele Grüße aus Dresden
    Heiko Schlittermann
--
 SCHLITTERMANN.de ---------------------------- internet & unix support -
 Heiko Schlittermann, Dipl.-Ing. (TU) - {fon,fax}: +49.351.802998{1,3} -
 gnupg encrypted messages are welcome --------------- key ID: F69376CE -
 ! key id 7CBF764A and 972EAC9F are revoked since 2015-01 ------------ -