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

Kezdőlap
Üzenet törlése
Válasz az üzenetre
Szerző: Morten W. Petersen
Dátum:  
Címzett: exim-users
Tárgy: Re: [exim] Using ${run ...} to execute external command, dealing with result, Exim syntax
Morten W. Petersen skrev:
> Heiko Schlittermann skrev:
>
>> 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.
>>
>>
>
> $acl_m8 seems to be empty, but runrc does the trick. Thanks for the help! :)
>


OK, I now have a working system which checks the remote SMTP whether it
accepts the recipient.

However, the remote SMTP is sometimes unavailable.. is it possible to tell
Exim to give a temporary error if that's the case?

-Morten

--
Morten W. Petersen
Manager
Nidelven IT Ltd

Phone: +47 45 44 00 69
Email: morten@???