Re: [exim] More routing

Pàgina inicial
Delete this message
Reply to this message
Autor: Ian FREISLICH
Data:  
A: exim-users
CC: John Oxley
Assumpte: Re: [exim] More routing
Tony Finch wrote:
> On Tue, 12 Apr 2005, John Oxley wrote:
>
> > On Tue, Apr 12, 2005 at 11:21:02AM +0100, Tony Finch wrote:
> > > On Tue, 12 Apr 2005, John Oxley wrote:
> > > >
> > > > I have a routers.conf with about 150 entries similar to:
> > > > hub_route_foo:
> > > >     driver = manualroute
> > > >     transport = remote_smtp
> > > >     route_list = foo.com 1.2.3.4

> > > >
> > > > I have a mysql table with foo.com and 1.2.3.4 in it.
> > >
> > > Use one router like the above, but replace the route_list setting with a
> > > route_data setting which performs a MySQL query using $domain as a key.
> >
> > You mean
> >    route_list = {$lookup mysql{select domain,ip from domains}}

>
> No. There are several mistakes there.
>
> route_data = ${lookup mysql {select ip from domains where domain = $domain}}
>
> (though I might have screwed up the SQL)


I do ETRN for dynamic dialin if that's of interest:

domainlist uucp_domains= lsearch;/etc/exim/domains.etrn
SET_ETRN_ADDRESS=${lookup pgsql{SELECT 'yes' FROM remember_etrn_host('$acl_c0', '$sender_host_address')}{value}}
ETRN_ADDRESS=${lookup pgsql{SELECT * FROM etrn_host($domain)}}

hold_domains = +etrn_domains
queue_domains = +etrn_domains
queue_smtp_domains = +etrn_domains

acl_smtp_etrn 
  accept   authenticated= *   
           set acl_c0   = ${sg{$smtp_command_argument}{\N^#*\N}{}}
           condition    = ${lookup{$acl_c0} lsearch{/etc/exim/domains.etrn} {yes}{no}}
           condition    = ${if \
                            eq{$acl_c0}{${sg{$authenticated_id}{\N^.*@\N}{}}}\
                            {yes}{no}}
           condition    = SET_ETRN_ADDRESS


deny

begin routers
etrn:
driver = manual_route
transport = remote_smtp
domains = +etrn_domains
route_data = ETRN_HOST

The magic happens in SET_ETRN_ADDRESS and ETRN_HOST which inserts
or updates the domain:host entry and returns the host address
respectively.

Users authenticate with user@domain and are only allowed to ETRN
for the domain_part of their username.

Ian

--
Ian Freislich