1

I'm running RHEL 6 and already done the following modifications :

[root@ark mail]# grep 0.0.0.0 sendmail.mc
DAEMON_OPTIONS(`Port=smtp,Addr=0.0.0.0, Name=MTA')dnl

[root@ark mail]# make sendmail.cf

Making sure it did apply:

[root@ark mail]# grep 0.0.0.0 sendmail.cf
O DaemonPortOptions=Port=smtp,Addr=0.0.0.0, Name=MTA
#O ClientPortOptions=Family=inet, Address=0.0.0.0
#O ConnectOnlyTo=0.0.0.0

[root@ark mail]# makemap -v hash access.db < access
key=`connect:localhost.localdomain', val=`RELAY'
key=`connect:localhost', val=`RELAY'
key=`connect:127.0.0.1', val=`RELAY'
key=`connect:[my.remote.ip]', val=`RELAY'

However it still inisits listening to 127.0.0.1 :

[root@ark mail]# netstat -lptun | grep 25
tcp        0      0 127.0.0.1:25                0.0.0.0:*                   LISTEN      1174/master

I've already restarted sendmail several times.

user75228
  • 97
  • 1
  • 2
  • 8
  • It's possible, though unlikely, that sendmail is running from a non-standard `.cf` file. Could we get **pasted into the question** the output of `ps auxww|grep sendmail`? Also, your output above is only definitive if the working directory is `/etc/mail`; could we make that explicit with `grep 0.0.0.0 /etc/mail/sendmail.cf`? – MadHatter May 02 '14 at 08:11
  • Could you post results of the following command? `grep -i DaemonPortOptions /etc/mail/sendmail.cf` – AnFi May 07 '14 at 07:14

2 Answers2

4
[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 rebuild the file:

m4 /etc/mail/sendmail.mc > /etc/sendmail.cf

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.

Rupesh
  • 151
  • 2
  • The last step, rebuilding cf file, can also be achieved by restarting sendmail service. – abbr Jul 25 '17 at 16:18
0

Look at /etc/sysconfig/mail. You can't miss the remote setting.

MichelZ
  • 11,068
  • 4
  • 32
  • 59
Rupesh
  • 151
  • 2