Re: [exim] Advanced Exim Configuration with the smart_route …

Top Page
Delete this message
Reply to this message
Author: Danielle M.
Date:  
To: exim-users
Subject: Re: [exim] Advanced Exim Configuration with the smart_route directive


On 6/11/2015 10:34 AM, Jon Gerdes wrote:
> On Thu, 2015-06-11 at 10:05 -0500, Danielle M. wrote:
>> Hey Jon,
>>
>> Thank you so much for the help. I'm relatively new to advanced Exim
>> configuration and am running into an error or two with your
>> suggestion. Exim is returning the below error when trying to set your
>> ACL variable in the connect area:
>>
>> main option "set" unknown
>>
>> As for the router condition, would it look something like this?
>>
>> condition = ${if acl_c_mail_submission_port{1}}
>>     smart_route:
>>     driver = manualroute
>>     domains = !+local_domains
>>     transport = remote_smtp
>>     route_list = * ip_address

>>
>> Thank you!
>> Dani McLeod
>> On 6/11/2015 3:38 AM, Jon Gerdes wrote:
>>
>>> On Wed, 2015-06-10 at 17:03 -0500, Danielle M. wrote:
>>>> Trying this one more time as I do not think my first send registered.
>>>> --
>>>>
>>>> Hello!
>>> -- snip --
>>>> I might want to attack this from a different direction if the former
>>>> doesn't work. I've set php mail to send via port 587 with the smtp_port
>>>> php.ini directive. Is there any way I can set the Exim smart_route
>>>> option with a condition to only apply to port 587?
>>>>
>>>> Thank you,
>>>> Danielle M.
>>> If you are only receiving mail for this purpose on port 587 then you can
>>> set an ACL variable in the connect ACL, something like this:
>>>
>>> warn  condition = ${if ={587}{$interface_port}}
>>>        set acl_c_mail_submission_port = 1

>>>
>>> Then in the router section, you can test for "is
>>> acl_c_mail_submission_port = 1" in a condition = and send to the
>>> relevant transport.
>>>
>>> See:
>>> http://www.exim.org/exim-html-current/doc/html/spec_html/ch-access_control_lists.html Section 19 for notes on ACL variables.
>>>
>>> Cheers
>>> Jon
>
> Danielle
>
> You need to put my suggestion inside the connect ACL on your system. For
> example you could have something like this:
>
>
> # This will probably be near the top of the config
> acl_smtp_connect = acl_check_connect
> .... more "acl_xxx =" lines
>
> ....
>
> begin acl
>
> acl_check_connect:
>
>
> warn  condition = ${if ={587}{$interface_port}}
>        set acl_c_mail_submission_port = 1
>        domains = !+local_domains

>
> # You need to actually accept it as well!
> accept domains = !+local_domains
>
> # end of connect acl
>
> ... other acls ...
>
> begin routers
>
> ## Note how the condition is put within the router definition
> ## remember more than one router can be run on a message,
> ## so I've added in a no_more
> smart_route:
>      driver = manualroute
>      domains = !+local_domains
>      transport = remote_smtp
>      route_list = * ip_address_for_smart_host
>      condition = {if acl_c_mail_submission_port{1}}
>      no_more

>
> other_route:
>      driver = manualroute
>      domains = !+local_domains
>      transport = remote_smtp
>      route_list = * ip_address_for_another_host
>      no_more

>
> .. other routers perhaps
>
> begin transports
>
> remote_smtp:
>      driver = smtp

>
> The above is untested and likely to have errors somewhere!
>
> Test syntax first:
> #exim -bV
>
> Now test functionality:
> #exim -bhc ip_address_for_a_mail_submission_port_system
>
> ....
> helo name_that_the_client_system_might_use
> ....
> mail from: user@???
> ....
> rcpt to: user@another_example.co.uk
> ....
> data
> Type anything you like here and finish with a fullstop or period and hit
> enter again
> .
>
>
> Choose the IP address and email addresses carefully and you will be
> testing what exim would actually do to your email without trying it out
> for real. Read the output to each bit of the test carefully.
>
> This is the reason why I bought exim in the first place 8)
>
> Cheers
> Jon
>
> PS Please stay on list unless you need to send confidential stuff also
> it looks like the locals prefer bottom posting to top posting.
>
>
> Blueloop Ltd
>
> Jon Gerdes | Senior Consultant
>
> Blueloop House
> Ilchester Road
> Yeovil
> Somerset BA21 3AA
>
> Tel: 2100
> Web: www.blueloop.net
>
>
>
> Registered Address : Blueloop House, Ilchester Road, YEOVIL, BA21 3AA Registered England & Wales - 3981322
>
> CONFIDENTIAL INFORMATION
> This e-mail and any files attached with it are confidential and for the sole use of the intended recipient(s). If you are not the intended recipient(s) you are prohibited from using, copying or distributing this or any information contained in it and should immediately notify the sender and delete the message from your system.
>
> Internet communications are not secure and Blueloop Limited is not responsible for unauthorised use by third parties nor for alteration or corruption in transmission. Furthermore, while Blueloop Limited have taken reasonable precautions to minimise the risk of software viruses, it cannot accept liability for any damage which you may suffer as a result of such viruses, and we therefore recommend you carry out your own virus checks on receipt of any e-mail.

I have this set up as Jon suggested, but I think there is a syntax error
somewhere. See Exim's log entry below:

2015-06-11 12:37:41 1Z36Q9-0000fy-E3 failed to expand condition "${if
and{{bool_lax{NULL}}{bool_lax{{if
eq{$acl_c_mail_submission_port}{1}}}}}}" for smart_route router: missing
} at end of condition inside "and" group

I've tried all of the common sense fixes I could think of (ensuring all
braces have a matching opposite brace, etc.) to no avail. To sum up what
I've added:

---Under acl_check_connect---

warn  condition = ${if ={587}{$interface_port}}
       set acl_c_mail_submission_port = 1
       domains = !+local_domains
accept domains = !+local_domains


---Under routers---

smart_route:
     driver = manualroute
     domains = !+local_domains
     transport = remote_smtp
     route_list = * ip_address_for_smart_host
     condition = {if acl_c_mail_submission_port{1}}
     no_more


Any ideas?

Thank you,
Danielle M.