RE: [Exim] Masquerade needed for outbound mail.

Top Page
Delete this message
Reply to this message
Author: Kevin Reed
Date:  
To: 'Xander D Harkness'
CC: 'exim Users'
Subject: RE: [Exim] Masquerade needed for outbound mail.
What a day...

Xander D Harkness wrote...
>
> krelvinaz@??? wrote:
>
> >
> >Unfortunately this is not going to work because it will rewrite all
> >hostname.domain.com to domain.com, even if it is staying inside the
> >network.
> >
> >I need to only change it when it is going to leave the local
> network to
> >the Internet.
> >
> >Thats why I think I need to do this in the outbound transport.
> >
> >
>
> There is an example in the Exim book which you could customise :-)
>
> *@*.hitch.example      "${if !eq {$sender_host_address}{}\
>                                         {$1@???}fail}"

>
> senderhost address matches the empty string for locally
> generated mails
> - I guess just stick in something that will match all your
> internal hosts ;-) Kind regards Xander


I think I'm close...

The FAQ had what I think I needed although more complicated than I needed.

Assuming..

Local Domain is:        my.domain
Mail Host is:        mailhost.my.domain
Remote Mail Server:    mailhost.remote.domain


I've currently got a router like below. This appears to work good.

SMART_HOST_ROUTE:
driver = manualroute
domains = ! mailhost.my.domain
route_list = * mailhost.remote.domain
transport = ${if
match{$domain}{\N\.my\.domain$\N}{remote_smtp}{smarthost_smtp}}
no_more

Not sure I actually need the choice of routers as any local delivery was
done above by a
Different router.. But the above still works.

Under transports, I've got the following...

remote_smtp:
driver = smtp

smarthost_smtp:
     driver = smtp
     headers_rewrite = *@*.my.domain $1@???
     return_path = *@*.my.domain MAILER-DAEMON@???



In the transport... I think the headers_rewrite is working okay
but I think the return_path is wrong.



Message was being sent to: suzy@??? from
testaccount@???

- - - - -
From: testaccount@???
To: suzy@???
Subject: test

test
- - - - -

Command line:

exim -d -v -f testaccount@??? -t < testmessage



.
.
.
Connecting to maihost.remote.domain [xxx.xxx.xxx.xxx]:25 ... connected
read response data: size=92
SMTP<< 220 maihost.remote.domain ESMTP Sendmail 8.11.6+Sun/8.11.6; Thu, 14
Aug 2003
01:38:54 -0500 (CDT)
SMTP>> EHLO mailhost.my.domain

read response data: size=200
  SMTP<< 250-maihost.remote.domain Hello
mailhost.my.domain[xxx.xxx.xxx.xxx], pleased to
meet you
         250-ENHANCEDSTATUSCODES
         250-EXPN
         250-VERB
         250-8BITMIME
         250-SIZE
         250-DSN
         250-ONEX
         250-ETRN
         250-XUSR
         250 HELP
xxx.xxx.xxx.xxx in hosts_require_auth? no (option unset)


THIS PART LOOKS WRONG... I don't think it got the return_path right.

SMTP>> MAIL FROM:<*@*.my.domain MAILER-DAEMON@???> SIZE=1346

read response data: size=64
SMTP<< 250 2.1.0 <*@*.my.domain MAILER-DAEMON@???>... Sender ok

THIS LOOKS RIGHT...

SMTP>> RCPT TO:<suzy@???>

read response data: size=44
SMTP<< 250 2.1.5 <suzy@???>... Recipient ok
SMTP>> DATA

read response data: size=50
SMTP<< 354 Enter mail, end with "." on a line by itself
SMTP>> writing message and terminating "."


THIS PART WHICH IS A REWRITTEN PART LOOKS OKAY

rewrite_one_header: type=F:
From: testaccount@???
address match: subject=testaccount@??? pattern=*@*.my.domain
mystique.my.domain in "*.my.domain"? yes (matched "*.my.domain")
testaccount@??? in "*@*.my.domain"? yes (matched
"*@*.my.domain")
newlen=22 newtype=F newtext:
From: testaccount@???
remainder:
rewrite_one_header: type=T:
To: suzy@???
address match: subject=suzy@??? pattern=*@*.my.domain
Other.domain in "*.my.domain"? no (end of list)
suzy@??? in "*@*.my.domain"? no (end of list)
writing data block fd=7 size=314 timeout=300
read response data: size=54
SMTP<< 250 2.0.0 h7E6csV00004 Message accepted for delivery


Hard to test.... But I think I've got what I need but the return_path is
wrong.
I think I am assuming it is a rewrite when it is just a string setting?