Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sendmail config for inbound mail and redirecting them internally to ot

Status
Not open for further replies.

SecOS

IS-IT--Management
Mar 22, 2011
2
US
Hi,

I have configured a sendmail MTA for incoming mails in a network and by using IPtables i have redirected the traffic internally to other port where one more SMTP by a application is running.

Iptables rule:

iptables -A INPUT -i eth0 -p tcp --dport 25 -j ACCEPT

iptables -A PREROUTING -t nat -i eth0 -p tcp --dport 25 -j REDIRECT --to-port 25000

My sendmail config is as below.

Sendmail.mc

define(`SMART_HOST', `relay:host.subdomain.mydomain.com')dnl

dnl # define(`RELAY_MAILER',`esmtp')dnl
define(`RELAY_MAILER_ARGS', `TCP $h 25000')dnl
define(`ESMTP_MAILER_ARGS', `TCP $h 25000')dnl
dnl #
dnl # The following causes sendmail to only listen on the IPv4 loopback address
dnl # 127.0.0.1 and not on any other network devices. Remove the loopback
dnl # address restriction to accept email from the internet or intranet.
dnl #
DAEMON_OPTIONS(`Port=smtp,Addr= "my IP address", Name=MTA-public')dnl
DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA-local')dnl

/etc/services file details

smtp 25/tcp mail
smtp 25/udp mail
submission 25000/tcp # submission
submission 25000/udp # submission



after sendmail config is done i am able to receive mails , but when i applied the iptables rule as above then the mails get reject and logs will give me an error as

dsn=5.0.0, stat= deffered service unavailable

and the bounce message shows

#5.0.0 SMTP; 554 Transaction failed> #SMTP#

I am not sure what i am missing here and what to do more to fix this.
 
one small thing is in the below command i missed "s" in ports.

iptables -A PREROUTING -t nat -i eth0 -p tcp --dport 25 -j REDIRECT --to-ports 25000

Then the above steps are all corect and tested and working fine.

The issue what i faced is after setting everything the application SMTP had few issue, once they are fixed everything got fixed.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top