Upgrading Apple Mail Service from OS X 10.6.8 to 10.8.5

Are you planning to upgrade from OS X Server 10.6.8 to OS X 10.8.5 and Server 2.x? Well alright then. If your 10.6.8 installation is clean and operating well, it should upgrade in place pretty smoothly, as Apple’s done a decent job of fixing the Perl scripts that were wreaking havoc in earlier iterations. Sadly, though, some editing of the main.cf and master.cf files in /Library/Server/Mail/Config/postfix/ will still likely be necessary to get mail delivering to your users post upgrade/migration.

In master.cf, make sure to edit the following lines. Note that they’ve probably been wrapped to display in your browser.

Original:

 dovecot unix - n n - 25 pipe
 flags=DRhu user=_dovecot:mail argv=/usr/libexec/dovecot/dovecot-lda -d ${user}

New:

 dovecot unix - n n - 25 pipe
 flags=DRhu user=_dovecot:mail argv=/Applications/Server.app/Contents/ServerRoot/usr/libexec/dovecot/deliver -d ${user}

Re-enable submission port 587, if you want to relay mail that way:

submission inet n - n - - smtpd
 -o smtpd_tls_security_level=encrypt

In main.cf, make sure to add the “mailbox_transport = dovecot” directive. Change all instances of /etc/postfix, if they exist to /Library/Server/Mail/Config/postfix.

Here’s an example of a fairly simple, real world post-migration Postfix configuration as reported by sudo postconf -n:

biff = no
 command_directory = /usr/sbin
 config_directory = /Library/Server/Mail/Config/postfix
 daemon_directory = /usr/libexec/postfix
 data_directory = /Library/Server/Mail/Data/mta
 debug_peer_level = 2
 debugger_command = PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin xxgdb $daemon_directory/$process_name $process_id & sleep 5
 dovecot_destination_recipient_limit = 1
 html_directory = /usr/share/doc/postfix/html
 imap_submit_cred_file = /Library/Server/Mail/Config/postfix/submit.cred
 inet_interfaces = loopback-only
 inet_protocols = all
 mail_owner = _postfix
 mailbox_size_limit = 0
 mailq_path = /usr/bin/mailq
 manpage_directory = /usr/share/man
 message_size_limit = 10485760
 mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
 mydomain_fallback = localhost
 mynetworks = 127.0.0.0/8,192.168.168.0/24
 newaliases_path = /usr/bin/newaliases
 queue_directory = /Library/Server/Mail/Data/spool
 readme_directory = /usr/share/doc/postfix
 recipient_delimiter = +
 sample_directory = /usr/share/doc/postfix/examples
 sendmail_path = /usr/sbin/sendmail
 setgid_group = _postdrop
 smtpd_client_restrictions = permit_mynetworks permit_sasl_authenticated permit
 smtpd_tls_ciphers = medium
 smtpd_tls_exclude_ciphers = SSLv2, aNULL, ADH, eNULL
 tls_random_source = dev:/dev/urandom
 unknown_local_recipient_reject_code = 550
 use_sacl_cache = yes

Lastly, if you don’t like running a grey-listing policy, you can disable the stock build by issuing the following command:

sudo serveradmin settings mail:postfix:greylist_disable = yes

There’s much more you can do with Postfix and Dovecot under OS X 10.8 “Mountain Lion”, and later with the Server “app” installed, but to quickly start hosting your own email, that’s all there is to it. Really! Beyond the most basic settings, these days, Apple’s forcing us to do most of the configuring via a shell, rather than via the GUI “Server” application, but as long as you take some time to familiarize yourself with the command-line tools, and the locations of the various files, you’ll be fine.