Re: [exim] Using ${run ...} to execute external command, dea…

Kezdőlap
Üzenet törlése
Válasz az üzenetre
Szerző: Heiko Schlittermann
Dátum:  
Címzett: exim-users
Tárgy: Re: [exim] Using ${run ...} to execute external command, dealingwith result, Exim syntax
Morten W. Petersen <morten@???> (Do 27 Aug 2009 16:55:15 CEST):
> Hi,
>
> I'm trying to use an external python script to verify that a remote SMTP
> host
> can accept a recipient. Using Exim's callout didn't work (getting too many
> write lock issues).
>
> The configuration looks like this:
>
> [...]
> begin acl
>
> greylist_acl:
>     warn set acl_m8 = ${run{/opt/nidelven/do_remote_callout.py 
> $local_part $domain $sender_address $sender_host_address 
> $sender_helo_name}{$value}{error}}
>         log_message = greylisting ACL result: $acl_m8
>     accept
>         condition = ${if eq{$acl_m8}{greylist}{1}}
>     deny
> [...]
> However, I don't see any entries in the log, so it doesn't look like the 
> command
> or the logging is being run.  Am I missing something to get logging working?


First question: did you configure the use of your greylist_acl?
When it should run at „RCPT TO“ time, you should set (in the global part
of the config)

    acl_smtp_rcpt = greylist_acl


And, I'd write the ACL this way:

    greylist_acl:
        accept  condition = ${run{/opt/nidelven/do_remote_callout.py \
                $local_part \
                $domain \
                $sender_address \
                $sender_host_address \
                $sender_helo_name}\
                {true}{false}}
        deny


And in this case you should make sure, that your command exists with a
zero exit value (as normal programs do) on success and with anything
else on verification error.

On the other hand, I'd investigate the problems regarding the built in
callout verification, except for some special requirements it should
just work.

> What is the right way to access the result of the command? Is that
> stored in
> acl_m8? Does $runrc represent the exit value of the command?


Should. Should.

> What's the right syntax for checking the exit value against 0, 1 etc?


    condition = $acl_m8


should suffice.

But(!) I may be wrong, so double check my answer and have a look into
the spec file.


    Best regards from Dresden/Germany
    Viele Grüße aus Dresden
    Heiko Schlittermann
-- 
 SCHLITTERMANN.de ---------------------------- internet & unix support -
 Heiko Schlittermann HS12-RIPE -----------------------------------------
 gnupg encrypted messages are welcome - key ID: 48D0359B ---------------
 gnupg fingerprint: 3061 CFBF 2D88 F034 E8D2  7E92 EE4E AC98 48D0 359B -