Tuesday 24 March 2015

Open Port 25 to All

[root@server mail]# netstat -vatn
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State      
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN 
 
After looking through several files I discovered how to fix it:
First you need to edit /etc/mail/sendmail.mc, find the following section:
dnl This changes sendmail to only listen on the loopback device 127.0.0.1 dnl and not on any other network devices. Comment this out if you want dnl to accept email over the network. DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')
 
You will need to comment out the like with DAEMON_OPTIONS, using "dnl" at the begining of the line:
dnl This changes sendmail to only listen on the loopback device 127.0.0.1 dnl and not on any other network devices. Comment this out if you want dnl to accept email over the network. dnl DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')
 
You will then need to restart sendmail
/etc/init.d/sendmail restart
 
Once you have done this sendmail will listen on all IP address on the system:

[root@server mail]# netstat -vatn
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State      
tcp        0      0 0.0.0.0:25              0.0.0.0:*               LISTEN 
 
And you can recieve mail from others, and send mail from your clients.