Re: [Exim] Question about having a pipe handle ALL received …

Top Page
Delete this message
Reply to this message
Author: Tor Slettnes
Date:  
To: Doug Fields
CC: exim-users
Subject: Re: [Exim] Question about having a pipe handle ALL received mail
--

On Mar 10, 2004, at 15:50, Doug Fields wrote:
> I would like to configure Exim 4 to accept e-mail just as one would
> configure a normal Internet-accessible SMTP mailer:
>     a) Accepts mail for "local" domains without authentication
>     b) Accepts mail for relay with authentication
>         1) From a table in PostgreSQL of users and passwords


From my /etc/exim4/conf.d/auth/30_exim4-config_examples:

# Here is an example of CRAM-MD5 authentication against PostgreSQL:
#
# psqldb_auth:
# driver = cram_md5
# public_name = CRAM-MD5
# server_secret = ${lookup pgsql{SELECT pw FROM users WHERE username
= '${quote_pgsql:$1}'}{$value}fail}
# server_set_id = $1



> However, once Exim decides to accept a message, we'd like ALL messages
> to subsequently be delivered to a local program using the pipe
> delivery, rather than handled by Exim in any of the usual ways. For
> example, it might call a pipe program like this:
>
> delivermail <SMTP_From> <Auth_User_ID> <Remote_IP> <RCPT_TO_1>
> <RCPT_TO_2> ...
> for example:
>
> delivermail joe@??? joe 1.2.3.4 jim@??? john@???
>
> (I'm willing to have any additional meta-data that Exim has on the
> command line as well, such as which IP address was used to connect to
> Exim if there were more than one, and so forth.)
>


First, you don't want to do this. That's what you have Exim for. If
you want to take care of all the logic of routing addresses, delivering
to local users, SMTP or LMTP transactions, etc - you would essentially
be writing your own MTA (which you also don't want to do).

What is it that you want to do? Chances are you could do it just as
easily, or more easily, _within_ exim (or perhaps via the local_scan
interface).

That said, set up a transport to do this job (e.g. 'deliver_pipe', see
the default 'maildrop_pipe' for an example), and then create a router
before any other routers (without any conditions) that uses this
transport.

Exim variables and expansions are available to get the parameters you
need.  For instance:
     $sender_address
     $authenticated_id
     ${lookup dnsdb{mx=$domain}fail}
     $address_data


Note that you probably either want to call this once for ALL recipients
(in which case <Remote_IP> is ambigious), or once for EVERY address (in
which case you will only have one RCPT_TO argument). Your example
above is a hybrid, which will be quite a bit more complicated to
achieve.



> Has anyone ever configured Exim 4 in such a fashion? Would you be so
> kind as to point me to references (including the Exim 4 book, the
> online site, or any other information) about how to configure Exim 4 in
> this fashion?


'spec.txt.gz' in your Exim distribution.

-tor

--
[ smime.p7s of type application/pkcs7-signature deleted ]
--