Author: Phil Pennock Date: To: David Hoepelman CC: exim-users Subject: Re: [exim] Exim4 pipe email through two commands
On 2010-11-25 at 22:18 +0100, David Hoepelman wrote: > user@computer: echo "someemailcontents" | /usr/bin/somefilter -n 5 |
> /usr/bin/somecommand -opt someoption > There are a couple of ways I imagine I could do this:
> 2. Modify the aliases file so that the mail goes through 2 commands
> (like shell pipelining) > However I do not know if 2 or 3 is possible with exim4. Can anyone
> enlighten me on this?
The "redirect" Router which processes the aliases file will reference a
"pipe" transport, probably called "address_pipe". Change that to
"address_pipe_unsafe", then go to the Transports section of the config
(after "begin transports") and make a copy of "address_pipe", calling it
"address_pipe_unsafe". On this copy, add the "use_shell" option.
A Unix shell will then be used for parsing the command and constructing
the command pipeline and you can join together multiple commands, as you
show above. This has all the downsides of permitting arbitrary commands
to appear, with command substitution and other security issues, so be
cautious in your deployment of this -- only use it for Routers where the
command is specified by a trusted account, and no part of the original
address can appear in the command.