General
cancel
Showing results for 
Search instead for 
Did you mean: 

Two SMTP Ports on same host - How to forward ?

Andre Braganca
Frequent Advisor

Two SMTP Ports on same host - How to forward ?

I've got this HPUX11 host which receives mail from other hosts via the "standard" TCP port 25. Is it possible to forward some of this e-mail (for a given address) to an application which is listening on other SMTP port (defined as 2525) ?
Thanks in advance for your help.
Don't forget to breathe ...
6 REPLIES
Wodisch
Honored Contributor

Re: Two SMTP Ports on same host - How to forward ?

Hi,

with "IPFilter/9000" (free and supported) you shoukld be able to "forward" to that port...

FWIW,
Wodisch
Andre Braganca
Frequent Advisor

Re: Two SMTP Ports on same host - How to forward ?

I was wondering if this was possible to do via "sendmail" configuration (of which I am very ignorant!) and relaying mail for a given user to the application on port 2525. I think that what Wodisch is proposing is to install a firewall and somehow do port mapping. Can you give me some pointers, as this subject is a bit alien to me...
Don't forget to breathe ...
Jordan Bean
Honored Contributor

Re: Two SMTP Ports on same host - How to forward ?


I believe this can be done via sendmail, but it won't be easy. It will involve creating a new IPC mailer that uses port 2525 and a new rule in an appropriate ruleset to select this mailer for matching addresses.

You can start experimenting in /etc/mail/sendmail.cf by duplicating the relay mailer (Mrelay), calling it gateway (Mgateway), and changing

A=IPC $h

to

A=IPC localhost 2525

Then add this rule to ruleset 98 (S98):

R$* < @ $+ .GATEWAY. > [TAB] $#gateway $@ $2 $: $1@$2

(Note: [TAB] means this whitespace must be of tabs, not spaces, to distinguish the LHS from the RHS.)

Then add aliases to /etc/mail/aliases like this:

user1:user1@domain.GATEWAY
user2:user2@domain.GATEWAY

then refresh the aliases database and restart sendmail:


newaliases (sendmail -bi)
kill -HUP $(head -1 /var/run/sendmail.pid)

I'm sure you have many questions, so fire away!

Wodisch
Honored Contributor

Re: Two SMTP Ports on same host - How to forward ?

Hi,

you are right, that's the idea:

run multiple "sendmail", but each on a different local IP-address only (and of course "chroot()ed"). So they all would use port TCP/25. Then use "IPFilter/9000" to do the port-mapping/-forwarding from that port 2525 (or similiar) to the appropriate single IP-address port 25.

You can get "IPFilter/9000" for free form HP at : http://software.hp.com

FWIW,
Wodisch
Andre Braganca
Frequent Advisor

Re: Two SMTP Ports on same host - How to forward ?

Thanks for your help, but I went the other way round and managed to get the Exchange Administrator to configure it so that some e-mails were routed to port 2525.

Regards.
Don't forget to breathe ...
Christopher Caldwell
Honored Contributor

Re: Two SMTP Ports on same host - How to forward ?

Yes.

Assumes sendmail >= 8.10

Look at DaemonPortOptions in
/usr/contrib/sendmail/usr/newconfig/etc/mail/cf/README

e.g.
DAEMON_OPTIONS(`Port=2525, Addr=127.0.0.1, Name=MTA0')
DAEMON_OPTIONS(`Port=1234, Addr=127.0.0.1, Name=MTA1')
DAEMON_OPTIONS(`Port=4321, Addr=127.0.0.1, Name=MTA2')

You could probably tweak sendmail.cf directly, as well.