Mailing List Archive

rewrite rule when using forwardfile
Hi,

I sent a mail to exim-users a month ago about my difficulties with
rewrite rules not being applied when using a forwardfile director.

I didn't get any replies, so I've left it a while before trying again.
I'd also appreciate any suggestions of more details I could include or
how I could be clearer to increase my chances for assistance :-)

If I am doing wrong by posting again, my apologies. I considered
posting simply the url to my previous message, but I presume that
would be worse because then people would have to follow it.

My original post follows (althought this time I have appended a Z to
my address, so it is spread over the internet a little less...):

I'm using Exim version 3.34 #3 built 04-Jan-2002 11:25:07

I have a set of addresses in /etc/exim/mailinglists/us, and the
following in my directors configuration:

lists:
driver = forwardfile
file_transport = address_file
pipe_transport = address_pipe
reply_transport = address_reply
domains = haus
file = /etc/mailinglists/${local_part}
no_check_local_user
forbid_pipe
forbid_file
errors_to = nick-errors@nickpiper.co.ukZ

I also have a bunch of rewrite rules such as

*@*.haus $1@haus
nicholas@haus nick@nickpiper.co.ukZ Ffrs

so that any machine inside my LAN can easily send mail, with a from
address such as user@melon.haus, which is then rewritten to their
correct address. I don't want to rewrite To: addresses, because
user@haus is deliverable, and I'd rather mail not try leave the LAN
only to come back in.

This appears to work just fine. If I send myself a mail via a simple
"echo test | mail nicholas" the mail starts with:
Re: rewrite rule when using forwardfile [ In reply to ]
On Tue, 28 May 2002, Nicholas Piper wrote:

> lists:
> driver = forwardfile
> file_transport = address_file
> pipe_transport = address_pipe
> reply_transport = address_reply
> domains = haus
> file = /etc/mailinglists/${local_part}
> no_check_local_user
> forbid_pipe
> forbid_file
> errors_to = nick-errors@nickpiper.co.ukZ
>
> I also have a bunch of rewrite rules such as
>
> *@*.haus $1@haus
> nicholas@haus nick@nickpiper.co.ukZ Ffrs


> *However*, if I do "echo test | mail us" in order to send mail to all
> the people listed in mailinglists/us, those two addresses stay as
> nicholas@haus in the mails people receive:
>
> >From nicholas@haus Sat Apr 27 16:33:23 2002
> Return-path: <nicholas@haus>

Hmm. I would have expected "nick-errors@nickpiper.co.ukZ", assuming that
that is a valid address.

Try running

exim -d9 us
test
.

to run a delivery with debugging turned on. The copious output will be
written to stderr. It may give you a clue.


--
Philip Hazel University of Cambridge Computing Service,
ph10@cus.cam.ac.uk Cambridge, England. Phone: +44 1223 334714.
Re: rewrite rule when using forwardfile [ In reply to ]
Sorry for the long mail, I thought it better to include all the
context again.

On Wed, 05 Jun 2002, Philip Hazel wrote:

> On Tue, 28 May 2002, Nicholas Piper wrote:

> > lists:
> > driver = forwardfile
> > file_transport = address_file
> > pipe_transport = address_pipe
> > reply_transport = address_reply
> > domains = haus
> > file = /etc/mailinglists/${local_part}
> > no_check_local_user
> > forbid_pipe
> > forbid_file
> > errors_to = nick-errors@nickpiper.co.ukZ

> > I also have a bunch of rewrite rules such as

> > *@*.haus $1@haus
> > nicholas@haus nick@nickpiper.co.ukZ Ffrs

> > *However*, if I do "echo test | mail us" in order to send mail to all
> > the people listed in mailinglists/us, those two addresses stay as
> > nicholas@haus in the mails people receive:

> > >From nicholas@haus Sat Apr 27 16:33:23 2002
> > Return-path: <nicholas@haus>

> Hmm. I would have expected "nick-errors@nickpiper.co.ukZ", assuming that
> that is a valid address.

It is valid, in that mail to it would work... it would arrive here,
and then my rule
*@nickpiper.co.uk nicholas@haus Tbc
would make it into nicholas@haus and deliver it to me.

> Try running

> exim -d9 us

I don't see anything which tells me what is wrong. Maybe there is a
clue and I'm missing it though, so I've included the results below.
For comparison, I've done the same thing with an "ordinary" address,
nicholas@honeypot.netZ. That rewrites just fine (AFAICS).

nicholas@piamox7:/usr/local/new_home/nicholas$ /usr/sbin/exim -d9 us
Exim version 3.34 debug level 9 uid=1000 gid=1000
Berkeley DB: Sleepycat Software: DB 2.4.14: (6/2/98)
Caller is a trusted user
This is a test. Please ignore it.
.
LOG: 0 MAIN
<= nick@nickpiper.co.ukZ U=nicholas P=local S=305
Exim version 3.34 debug level 1 uid=8 gid=8
Berkeley DB: Sleepycat Software: DB 2.4.14: (6/2/98)
delivering message 17G1ll-0002VG-00
LOG: 0 MAIN
=> |/usr/bin/procmail -f- (liz@haus) <us@haus> D=userforward T=address_pipe
LOG: 0 MAIN
=> |/usr/bin/procmail -f- (msg@haus) <us@haus> D=userforward T=address_pipe
LOG: 0 MAIN
=> |/usr/bin/procmail -f- (nicholas@haus) <us@haus> D=userforward T=address_pipe
LOG: 0 MAIN
=> claire <us@haus> D=localuser T=local_delivery
Connecting to vimg2.reading.ac.ukZ [134.225.112.82.25] ... connected
SMTP<< 220 vimg2.rdg.ac.ukZ ESMTP Exim Thu, 06 Jun 2002 19:14:19 +0100
SMTP>> EHLO haus.hn.org
SMTP<< 250-vimg2.rdg.ac.ukZ Hello pc2-reda6-0-cust135.bre.cable.ntl.com [80.3.249.135]
250-SIZE
250-PIPELINING
250 HELP
SMTP>> MAIL FROM:<nicholas@haus> SIZE=1337
SMTP>> RCPT TO:<XXXXXaw@reading.ac.ukZ>
SMTP>> RCPT TO:<XXXXXrb@reading.ac.ukZ>
SMTP>> DATA
SMTP<< 250 <nicholas@haus> is syntactically correct
SMTP<< 250 <XXXXXaw@reading.ac.ukZ> is syntactically correct
SMTP<< 250 <XXXXXrb@reading.ac.ukZ> is syntactically correct
SMTP<< 354 Enter message, ending with "." on a line by itself
SMTP>> writing message and terminating "."
SMTP<< 550 rejected: cannot route to sender <nicholas@haus>
SMTP>> QUIT
LOG: 0 MAIN
** XXXXXaw@reading.ac.ukZ <us@haus> R=lookuphost T=remote_smtp: SMTP error from remote mailer after end of data: host vimg2.reading.ac.ukZ [134.225.112.82]: 550 rejected: cannot route to sender <nicholas@haus>
LOG: 0 MAIN
** XXXXXrb@reading.ac.ukZ <us@haus> R=lookuphost T=remote_smtp: SMTP error from remote mailer after end of data: host vimg2.reading.ac.ukZ [134.225.112.82]: 550 rejected: cannot route to sender <nicholas@haus>
Connecting to mx06.hotmail.com [64.4.55.7.25] ... failed
LOG: 0 MAIN
mx06.hotmail.com [64.4.55.7]: Connection refused
Connecting to mx08.hotmail.com [64.4.49.7.25] ... failed
LOG: 0 MAIN
mx08.hotmail.com [64.4.49.7]: Connection refused
Connecting to mx13.hotmail.com [64.4.50.71.25] ... failed
LOG: 0 MAIN
mx13.hotmail.com [64.4.50.71]: Connection refused
Connecting to mx05.hotmail.com [65.54.254.129.25] ... connected
SMTP<< 220 hotmail.com Microsoft ESMTP MAIL Service, Version: 5.0.2195.4905 ready at Thu, 6 Jun 2002 11:12:14 -0700
SMTP>> EHLO haus.hn.org
SMTP<< 250-hotmail.com Hello [80.3.249.135]
250-SIZE 3565158
250-PIPELINING
250-8bitmime
250-BINARYMIME
250-CHUNKING
250-VRFY
250-AUTH LOGIN
250-AUTH=LOGIN
250-X-HMAUTH
250 OK
SMTP>> MAIL FROM:<nicholas@haus> SIZE=1337
SMTP>> RCPT TO:<XXXXXXXXXX@hotmail.com>
SMTP>> DATA
SMTP<< 452 Out of memory
LOG: 0 MAIN
SMTP error from remote mailer after MAIL FROM:<nicholas@haus> SIZE=1337: host mx05.hotmail.com [65.54.254.129]: 452 Out of memory
SMTP>> QUIT
Connecting to mx10.hotmail.com [64.4.49.135.25] ... failed
LOG: 0 MAIN
mx10.hotmail.com [64.4.49.135]: Connection refused
LOG: 0 MAIN
== XXXXXXXXXX@hotmail.com <nibarik@haus> T=remote_smtp defer (111): Connection refused
Exim version 3.34 debug level 1 uid=8 gid=8
Berkeley DB: Sleepycat Software: DB 2.4.14: (6/2/98)
LOG: 0 MAIN
<= <> R=17G1ll-0002VG-00 U=mail P=local S=1460
Exim version 3.34 debug level 1 uid=8 gid=8
Berkeley DB: Sleepycat Software: DB 2.4.14: (6/2/98)
delivering message 17G1m9-0002VX-00
LOG: 5 MAIN
Error message sent to nicholas@haus
LOG: 0 MAIN
=> |/usr/bin/procmail -f- <nicholas@haus> D=userforward T=address_pipe
LOG: 0 MAIN
Completed


Now for the working mail:

nicholas@piamox7:/usr/local/new_home/nicholas$ Exim version 3.34 debug level 1 uid=8 gid=8
Berkeley DB: Sleepycat Software: DB 2.4.14: (6/2/98)
delivering message 17G1ym-0002ZE-00
Connecting to mail.honeypot.netZ [208.162.254.122.25] ... connected
SMTP<< 220 kanga.honeypot.netZ ESMTP Sendmail 8.12.3/8.12.3; Thu, 6 Jun 2002 13:27:27 -0500 (CDT)
SMTP>> EHLO haus.hn.org
SMTP<< 250-kanga.honeypot.netZ Hello pc2-reda6-0-cust135.bre.cable.ntl.com [80.3.249.135], pleased to meet you
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-8BITMIME
250-SIZE
250-DSN
250-ETRN
250-DELIVERBY
250 HELP
SMTP>> MAIL FROM:<nick@nickpiper.co.ukZ> SIZE=1336
SMTP>> RCPT TO:<nicholas@honeypot.netZ>
SMTP>> DATA
SMTP<< 250 2.1.0 <nick@nickpiper.co.ukZ>... Sender ok
SMTP<< 250 2.1.5 <nicholas@honeypot.netZ>... Recipient ok
SMTP<< 354 Enter mail, end with "." on a line by itself
SMTP>> writing message and terminating "."
SMTP<< 250 2.0.0 g56IRRYV069627 Message accepted for delivery
SMTP>> QUIT
LOG: 0 MAIN
=> nicholas@honeypot.netZ R=lookuphost T=remote_smtp H=mail.honeypot.netZ [208.162.254.122]
LOG: 0 MAIN
Completed

Just in case it is useful:

nicholas@piamox7:/usr/local/new_home/nicholas$ /usr/sbin/exim -brw nicholas
sender: nick@nickpiper.co.ukZ
from: nick@nickpiper.co.ukZ
to: nicholas@haus
cc: nicholas@haus
bcc: nicholas@haus
reply-to: nick@nickpiper.co.ukZ
env-from: nick@nickpiper.co.ukZ
env-to: nicholas@haus

(All the Z's I've added manually just for this mail)

Nick

--
Part 3 MEng Cybernetics; Reading, UK http://www.nickpiper.co.uk/
GPG Encrypted mail welcome! 1024D/3ED8B27F
Choose life. Be Vegan :-) Please reduce needless cruelty + suffering !
Re: rewrite rule when using forwardfile [ In reply to ]
On Thu, 6 Jun 2002, Nicholas Piper wrote:

> > Try running
>
> > exim -d9 us
>
> I don't see anything which tells me what is wrong.

Oops. I should have said, "try running 'exim -d9 us' *as an admin
user*". Sorry about that.

> nicholas@piamox7:/usr/local/new_home/nicholas$ /usr/sbin/exim -d9 us
> Exim version 3.34 debug level 9 uid=1000 gid=1000
> Berkeley DB: Sleepycat Software: DB 2.4.14: (6/2/98)
> Caller is a trusted user
> This is a test. Please ignore it.
> .
> LOG: 0 MAIN
> <= nick@nickpiper.co.ukZ U=nicholas P=local S=305
> Exim version 3.34 debug level 1 uid=8 gid=8
^
^
^
The debug level has been forced down to 1 for a non-admin user. This
doesn't show anything interesting, unfortunately. I'm afraid you'll have
to try again, as root or exim or another admin user (if you have any set
up).

--
Philip Hazel University of Cambridge Computing Service,
ph10@cus.cam.ac.uk Cambridge, England. Phone: +44 1223 334714.
Re: rewrite rule when using forwardfile [ In reply to ]
Hi Philip,

On Fri, 07 Jun 2002, Philip Hazel wrote:

> Oops. I should have said, "try running 'exim -d9 us' *as an admin
> user*". Sorry about that.

Ah :-)

I ran it as root, and I get

[stuff snipped]
------ Verifying errors address nick-errors@nickpiper.co.ukZ ------
>>>>>>>>>>>>>>>>>>>>>>>>
Verifying nick-errors@nickpiper.co.ukZ
nick-errors@nickpiper.co.ukZ in *@*.haus? no (end of list)
nick-errors@nickpiper.co.ukZ in *@nickpiper.co.ukZ? yes
(*@nickpiper.co.ukZ)
"nick-errors@nickpiper.co.ukZ" rewritten as "nicholas@haus"
haus in local_domains? yes (matched haus)
haus in percent_hack_domains? no (end of list)
address nicholas@haus
local_part=nicholas domain=haus
domain is local
[stuff snipped]

/me slaps head

I've now changed my errors address to one which will reach me, but not
in the domain nickpiper.co.uk.

Thanks for your help!

Nick

--
Part 3 MEng Cybernetics; Reading, UK http://www.nickpiper.co.ukZ/
GPG Encrypted mail welcome! 1024D/3ED8B27F
Choose life. Be Vegan :-) Please reduce needless cruelty + suffering !