OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
Postfix Archives: Re: 2 SMTP Relays, depending on the From: add

Re: 2 SMTP Relays, depending on the From: address


Subject: Re: 2 SMTP Relays, depending on the From: address
From: Alexis Maldonado (dymsacrracsa.co.cr)
Date: Sun Jan 02 2000 - 04:31:11 CST


Hello!

On Sat, Jan 01, 2000 at 05:57:56PM -0500, Wietse Venema wrote:
> Use two Postfix instances on the same machine, each with different
> settings for:
>
> PARAMETER FOO.COM BAR.COM
> =========================================================
> myorigin foo.com bar.com
> inet_interfaces x.x.x.x y.y.y.y 127.0.0.1
> relayhost smtp.foo.com mail.bar.com
>
> You have two config directories.

Thank you for your advice.

It works perfectly now!

Just in case this information will help anyone, here's how I did it:

First I configured Postfix according to the FAQ section that talks about
dial-up machines. I had it working fine for my first provider (bar.com),
then I started to make changes for the second provider:

I used IP aliasing to get another address for my server:

        ifconfig eth0:0 192.168.1.9 netmask 255.255.255.0
        ifconfig lo:0 127.0.0.2

(If this doesn't work, then you have to compile a kernel with support for
IP: Aliasing support)

My regular IP for this machine is 192.168.1.8

So, according to your table:
x.x.x.x == 192.168.1.8
y.y.y.y == 192.168.1.9

I had to create several directories to have both instances of Postfix
running:

        cp -a /etc/postfix /etc/postfix2
        cp -a /usr/lib/postfix /usr/lib/postfix2

I created user postfix2.

Then I edited /etc/postfix/main.cf and /etc/postfix2/main.cf:

        * FOO.COM (/etc/postfix)

        In /etc/postfix/main.cf:

                myorigin = foo.com
                inet_interfaces = 192.168.1.8 127.0.0.1
                relayhost = smtp.foo.com
        

        (It wouldn't deliver mail if I had " = 192.168.1.8" only)
        (I don't know why.)

        * BAR.COM (/etc/postfix2)

        In /etc/postfix2/main.cf: (Make the nec. changes)

                queue_directory = /var/spool/postfix2
                program_directory = /usr/lib/postfix2
                daemon_directory = /usr/lib/postfix2
                mail_owner = postfix2

                myorigin = bar.com
                inet_interfaces = 192.168.1.9 127.0.0.2
                relayhost = mail.bar.com

                transport_maps = hash:/etc/postfix2/transport
                virtual_maps = hash:/etc/postfix2/virtual

 
> Start up Postfix with: postfix -c config-directory start
> Flush queue with: postfix -c config-directory flush

This worked great. I just added the following lines to an appropiate
/etc/init.d script:

        postfix -c /etc/postfix start
        postfix -c /etc/postfix2 start

On the server's /etc/ppp/ip-up.d/ directory I added a script that would send
the e-mail:

        postfix -c /etc/postfix flush
        postfix -c /etc/postfix2 flush

Sorry for the long message. I am not sure if I took everything into account,
so please correct me if I'm mistaken.

Greetings,

Alexis Maldonado
Disenos y Montajes S.A.

--
______________________________________________

DYMSA - Disenos y Montajes S.A. Tel. +(506) 227-5616 Fax. +(506) 227-5257

e-mail: dymsacrracsa.co.cr

PO Box: Apdo 171-2010 Zapote San Jose, Costa Rica

Address: 500 mts Sur de Rotonda de Zapote Edificio DYMSA San Jose, Costa Rica Central America ______________________________________________



This archive was generated by hypermail 2b27 : Sun Jan 02 2000 - 04:35:16 CST