Re: [Exim] ETRN fun and route_list-lookups

Page principale
Supprimer ce message
Répondre à ce message
Auteur: Christian Froemmel
Date:  
À: Dave C.
CC: exim-users
Sujet: Re: [Exim] ETRN fun and route_list-lookups
At 20:13 07.11.01, Dave C. wrote:

Hi,

>If you want to use a file, try route_file instead of route_list
>;-)


Well, yes. I didn't wanted to, but now I did it this way ;-) For the
records and probably as addition to C037:

The setup is for hosts which have no own MX-Record but a dialup-connection
which collects mail via ETRN.

etrn-config in the mainpart of the config:

smtp_etrn_hosts = 213.54.8.0/19
smtp_etrn_command = /usr/exim/scripts/etrn_runner.sh $domain
$sender_host_address

Transport as shown in C037.

The routers:

etrn_bsmtp:
driver = domainlist
transport = bsmtp_for_etrn
condition = "${if eq {$received_protocol}{etrn_requeue} {0}{1}}"
domains = lsearch;/usr/exim/aliases/etrn
route_list = *

etrn_router:
driver = domainlist
transport = remote_smtp
condition = "${if eq {$received_protocol}{etrn_requeue} {1}{0}}"
domains = lsearch;/usr/exim/aliases/etrn
# because the route_file is generated by a script I had to do it with this
modemask
modemask = 0000
search_type = lsearch*
route_file = /tmp/bsmtp-route

The script:
#!/bin/bash

# Where exim lives
EXIM=/usr/exim/bin/exim

# Something appropriate to generate a temporary unique string
UNIQ=`head -c100 /dev/urandom | md5sum | cut -f 1 -d" "`

arg=$1
domain=`echo $arg | sed 's/^\#//g'`
ip=$2

echo "* ${ip} byname" > /tmp/bsmtp-route

if ( test -f /var/spool/etrn/${domain} ); then
  /usr/exim/bin/exim_lock -q /var/spool/etrn/${domain} "mv 
/var/spool/etrn/${domain} /tmp/etrn-bsmtp-${UNIQ}"
  ( cat /tmp/etrn-bsmtp-${UNIQ}
    echo "QUIT" ) | $EXIM -bS -oMr etrn_requeue
  rm -f /tmp/etrn-bsmtp-${UNIQ}
fi


$EXIM -R $domain

# If you use smtp_etrn_serialize, the following ensures that the
# serialize hint is removed for the argument exactly as specified by
# the client (which might have an # prepended if they are issuing an
# ETRN argument as required by exim's default ETRN support

$EXIM -R $arg

--- end

I don't remove the route_file, since a queue runner could access it
afterwards, the bsmtp_router would decline and I have a frozen message.
Please note, that this setup suits my needs with just ONE etrn user which
collects several domains. Maybe it needs a littlebit more tweaking when
there are several concurrent etrn-users.

regards
Christian

--
Mailadministrator of the Clinic of Medicine "Benjamin Franklin" Berlin