sendmail Stopped Working; What Is Preventing Listening?

My Ubuntu 16.04.1 LTS system sent its last Fail2Ban notice on 9/28/16. Since then, sendmail has not worked. I've been focused on the following from /var/log/mail.log (substituted with example.com).

Oct 25 04:26:45 woody sendmail[6662]: u9P4QjGc006662: from=fail2ban, size=2693, class=0, nrcpts=1, msgid=<201610250426.u9P4QjGc006662@example.com>, relay=root@localhost
Oct 25 04:26:45 woody sendmail[6662]: u9P4QjGc006662: to=linode@m.example.com, delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=32693, relay=[127.0.0.1] [127.0.0.1], dsn=4.0.0, stat=Deferred: Connection refused by [127.0.0.1]

I tried apt-get remove sendmail and then apt-get install sendmail and no change.

I then spun up a fresh instance of Ubuntu 16.04.1 LTS; called apt-get install sendmail and sendmail worked.

I then focused on netstat -l between the two systems

Stock install before installing sendmail
> Proto Recv-Q Send-Q Local Address Foreign Address State

tcp 0 0 *:ssh *:* LISTEN

tcp6 0 0 [::]:ssh [::]:* LISTEN

Stock install after installing sendmail
> tcp 0 0 localhost:submission : LISTEN

tcp 0 0 *:ssh *:* LISTEN

tcp 0 0 localhost:smtp : LISTEN

tcp6 0 0 [::]:ssh [::]:* LISTEN

Broken system after all my efforts
> tcp 0 0 localhost:mysql : LISTEN

tcp 0 0 *:ssh *:* LISTEN

tcp6 0 0 [::]:http [::]:* LISTEN

tcp6 0 0 [::]:ssh [::]:* LISTEN

tcp6 0 0 [::]:https [::]:* LISTEN

What is preventing localhost:submission and localhost:smtp from appearing on the broken system?

On the working system I see sendmail-mta in the list from ps -e. On the broken system it's not there.

When I run sendmail start & on the broken system it appears briefly as sendmail and then goes away.

I then focused on trying to do a clean install of sendmail. I executed the following:

apt-get remove sendmail
apt-get purge sendmai
apt autoremove
rm /etc/mail/sendmail*
apt-get install sendmail

I was hoping doing so would re-create the config files but it did not. ls /etc/mail/send* has 0 results.

6 Replies

Hello invalidptr,

I'm thinking the issue is that fail2ban is blocking your server from, well, communicating with itself. (?!).

What makes me think that is this:

Connection refused by [127.0.0.1]

I would check the ban list, but if nothing seems to be coming up, I'd say test by disabling fail2ban and restart sendmail. If it works, cool! If not, then check the mailing log again and see if any new errors come up.

If it so happens to be fail2ban being the issue, just whitelist your IP address (public and private) and you should be good:

http://www.fail2ban.org/wiki/index.php/Whitelist

Good luck.

Something is restarting fail2ban. I execute fail2ban-client stop and then ps -e | grep fail shows it with a new PID. Any ideas how to stop this?

When it's being restarted is it while you're in the middle of being SSH'd in, or is this after a server restart?

Also, can you try whitelisting your IP address:

https://www.linode.com/docs/security/us … itelisting">https://www.linode.com/docs/security/using-fail2ban-for-security#ip-whitelisting

@invalidptr:

Something is restarting fail2ban. I execute fail2ban-client stop and then ps -e | grep fail shows it with a new PID. Any ideas how to stop this?

Use "sudo service fail2ban stop". You're doing it from the client, perhaps the new systemd thinks fail2ban crashed and is restarting it. IDK.

Also, one of your posts suggested that sendmail isn't listening at all. Even if fail2ban had put its IP (I guess localhost from your posts) in a jail; sendmail should still be listening either way.

Also, sendmail isn't the best email mailer option, Google "sendmail or postfix". I highly recommend Postfix.

Also, your idea to spin up a separate known good instance is an excellent debugging/troubleshooting technique.

Thanks jebblue, service fail2ban stop did stop fail2ban and I was able to launch sendmail today. sendmail still does not show up as listening and test email still gets refused by 127.0.0.1.

FWIW I'm using sendmail based on this Linode article setting up fail2ban. But I've seen others mention postfix as a replacement as well.

If it's not listening, check the logs for errors.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct