Solved Sendmail doesn't look at /etc/hosts. Sadness ensues.

I have a probably atypical configuration. I'm running FreeBSD 10.1-RELEASE on a VM in Azure. Azure just gives you a CNAME to a cloudapp.net domain. So let's say the hostname is vincent. You would connect to your VM as vincent.cloudapp.net. In my case, I've CNAME'd further: vincent.example.com (my domain) points to vincent.cloudapp.net. To summarize:

  • vincent.example com CNAME for vincent.cloudapp.net
  • on vincent.cloudapp.net, the hostname is set to vincent.example.com
What I see on this VM is that sendmail tries to contact vincent.cloudapp.net - in other words, it asks DNS a question and gets back the end of the chain. Since I'm not running an Internet-facing SMTP server (and don't wish to), mail bounces and queues. I guess I haven't actually looked to see if SMTP is open to the Internet - those ports aren't open at the firewall so in a sense it doesn't matter.

I'm wondering

  • how do I tell sendmail to deliver locally
  • why sendmail looks at DNS, when my nsswitch.conf says
    Code:
    files dns
    and my 127.0.0.1 is properly configured as vincent.example.com, which is indeed the system's hostname (and hostname -f agrees)
  • if I wouldn't just be happier with a pkg install opensmtpd :)
I haven't modified sendmail since install. Do I really need to dig out my m4 manual?
 
Put the hostnames your server is known as in /etc/mail/local-host-names and restart sendmail. Every mailbox@ address under the hostnames in /etc/mail/local-host-names will map straight to local user mailbox (i.e. /var/mail/mailbox) or wherever you point it using aliases.

As for m4, there's no real need. Just run cd /etc/mail; make all install restart and you should be done.
 
Thanks!

Modifying /etc/mail/local-host-names and a restart of sendmail did the trick.

For future googlers, the format of /etc/mail/local-host-names is one hostname per line. It's mentioned in the fine manual but the format isn't spelled out (though fortunately was pretty obvious).
 
Back
Top