Configure Sendmail to prevent failure after system updates

May 07, '03 09:40:00AM

Contributed by: SonicMcTails

Sendmail has a bad habbit of breaking after system updates because it doesn't like a group writeable directory. Also, if you to make it so / is not writable, it prevents you from editing files are not in folders.

However, the DontBlameSendmail option allows certian file checks to be overwritten, including Group Writable Directories. This allows Sendmail to work and not make your harddrive read-only. Sendmail's configuration file is very complex so the use of M4 configuration files is recommend. I'm assuming you don't already have a setup M4 file, and you're just starting from scratch. If you already have a file, read the comment at the bottom of this hint. You'll need the Developer Tools installed, and make sure you log in as an admin and then follow the steps in the second part of this hint...

Fixing Sendmail:

  1. Open Terminal and change directories to /usr -> share -> sendmail -> conf -> cf
      cd /usr/share/sendmail/conf/cf
  2. Spawn a root login(enter your password when prompted) by typing sudo su. The reason we start a root shell is because redirects don't quite work with sudo (if you try redirecting to a place/file that your normal user can't, you get Permission Denied)

  3. Copy generic-darwin.mc to system-darwin.mc
      cp generic-darwin.mc system-darwin.mc
  4. Add the DontBlameSendmail line
      echo "define(`confDONT_BLAME_SENDMAIL', `GroupWritableDirPathSafe')dnl"
      >> system-darwin.mc
    [That should be one line]

  5. Move Apple's sendmail.cf and submit.cf out of the way
      mv /etc/mail/sendmail.cf /etc/mail/sendmail.cf.apple
      mv /etc/mail/submit.cf /etc/mail/submit.cf.apple
  6. Recreate Sendmail's sendmail.cf and submit.cf
      m4 ../m4/cf.m4 system-darwin.mc > /etc/mail/sendmail.cf
      m4 ../m4/cf.m4 system-darwin.mc > /etc/mail/submit.cf
  7. Enable Sendmail Daemon Mode
    sed "s/MAILSERVER=-NO-/MAILSERVER=-YES-/" /etc/hostconfig >
      /etc/hostconfig.new && mv /etc/hostconfig.new /etc/hostconfig
    [That should be all on one line]

  8. Start Sendmail
      /System/Library/StartupItems/Sendmail/Sendmail start
    Now sendmail is running in daemon mode so you can use 127.0.0.1 as an SMTP server.

  9. Make sure sendmail works by typing telnet 0 25. If you see something like this:
      Trying 0.0.0.0...
      Connected to 0.
      Escape character is '^]'.
      220 nemesis1.local ESMTP Sendmail 8.12.9/8.12.9; Sat,
        3 May 2003 21:15:18 -0400 (EDT)
    
    Then you have a working sendmail configuration.
Note: If you already have a sendmail m4 file, paste this line in at the bottom:
define(`confDONT_BLAME_SENDMAIL', `GroupWritableDirPathSafe')dnl
Note 2: Should Sendmail stop working due to a upgrade of sendmail (Apple upgrades Sendmail from time to time), repeat all steps expect for #3 to fix it.

Comments (14)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20030503213653261