Categories

TechTip: Sendmail not accepting connections

If you have a fresh installation of Sendmail and you can't figure out which firewall setting is preventing it from accepting external connections, check this before you go digging through your iptables.

By default Sendmail ships with a setting that lets it accept localhost/loopback (127.0.0.1) connections only. To make sure that you can connect to it on the external ethernet interface do the following:
  1. Open /etc/mail/sendmail.mc in VI or any other text-editor of your choice
  2. Find a line that looks like this "DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl" (or for other/older releases "O DaemonPortOptions=Port=smtp,Addr=127.0.0.1, Name=MTA")
  3. Replace the IP address after "Addr=" with the IP address of your external adapter, or remove "Addr=127.0.0.1," altogether to allow connections from all interfaces. You can also change the value of the "Port=" (default "smtp" = "25").
  4. Save the file (if you're using VI, Esc+:wq)
  5. Execute the following command to recompile Sendmail with new configuration: "make -C /etc/mail"
  6. Restart Sendmail using "service sendmail restart"
This should do the trick and save you some headaches with trying to troubleshoot your firewalls (although don't forget that you still need the firewall(s) to allow SMTP traffic for Sendmail to work).

No comments: