Operating System - HP-UX
1832647 Members
2828 Online
110043 Solutions
New Discussion

sendmail listening to localhost

 
Peter Remirez
Occasional Advisor

sendmail listening to localhost

HI,

Could some kindly show me how do I check if my version of sendmail is currently listening to the localhost?

Thanks
5 REPLIES 5
Jordan Bean
Honored Contributor

Re: sendmail listening to localhost

The simplest, most direct:

telnet localhost smtp

To know if sendmail is listening only on the loopback interface, then check look at DaemonPortOptions in the sendmail.cf file. Or...

lsof -nPi tcp:25

or

netstat -an | grep :25

which will tell to which interfaces sendmail is bound.

Michael Steele_2
Honored Contributor

Re: sendmail listening to localhost

The sendmail daemon only needs to be up for receiving mail. It doesn't need to be started for sending mail.

# ps -ef | grep -i sendmail

SMTP is on port 25, but checking the mail.log should be enough. After starting the daemon an entry is made in mail.log.

# tail -f /var/adm/syslog/mail.log

# sendmail -bd -q30m

Test by sending an email out:

# tail -f....

# echo 'test' | mailx -s "test subject" you@your_domain.com

Or, see if the mail server knows the alais:

# sendmail -v you@yourdomain < /dev/null

With command the SMTP server will be queried. It will then respond with known or unknown email alias.
Support Fatherhood - Stop Family Law
Pratyush Paul_1
Valued Contributor

Re: sendmail listening to localhost

Please do not use

#sendmail -bd -q15m ( you are basically opening up port 25 SMTP port to the hacker)

instead use

#sendmail -q15 ( it is secure, put this in cron, and it will scan the mail queue directory when there is a triger)

To sendmail mail in verbose mode is this

#sendmail -v userid@domain.com

It will list you the complete data flow of the mail packet.

Thanks

Pratyush
Die Hard
Aranzazu
Frequent Advisor

Re: sendmail listening to localhost

The best way to know it is by netstat command, because lsoft is not included in standar instalation.

You have to do:
netstat -an|grep -i list|grep 25

You will have something like this:

tcp 0 0 *.25 *.* LISTEN

This line meas that the sendmail is listen in all IP of the system (includes 127.0.0.1)

If you have this:
tcp 0 0 172.12.10.123:25 *.* LISTEN
This means that only is listen on this IP.


I hope this help you.

Arancha.

Seth Parker
Trusted Contributor

Re: sendmail listening to localhost

Like Jordan suggested, run "telnet 127.0.0.1 25" on the machine in question and see if you get a sendmail banner.

If you're trying to keep it from listening, another option you can try is to configure HP's /etc/rc.config.d/mailservs file and set SENDMAIL_SERVER=0. That will keep sendmail from listening (on any port), but it will still allow for messages to be sent from the machine. If you do this, you'll need to add a periodic cronjob "/usr/sbin/sendmail -q" to make sure that any mail that couldn't be sent the first time is processed.

Regards,
Seth