Thursday, 19 September 2013

Configuring Dovecot under OS X (10.8)

Installation

I use macports for any third-party software I want to install, so installing dovecot was as trivial as:

$ sudo bash
# port install dovecot

Configuration

dovecot Configuration

I had to make a number of changes to the dovecot.conf file in order to get dovecot working:

# cd /opt/local/etc/dovecot
# cp dovecot-example.conf dovecot.conf

Here is the configuration, with comments stripped using sed:

# sed '/^[ \t]*#/d' dovecot.conf | sed '/^[ \t]*$/d'

base_dir = /opt/local/var/run/dovecot/
protocols = imaps
log_path = /opt/local/var/log/dovecot.log
ssl = yes
ssl_cert_file = /private/etc/ssl/mydomain_com.crt
ssl_key_file = /private/etc/ssl/private/mydomain_com.key
ssl_ca_file = /private/etc/ssl/private/PositiveSSLCA2.crt
login_dir = /opt/local/var/run/dovecot/login
login_chroot = yes
login_user = _dovecot
mail_privileged_group = mail
protocol imap {
  login_executable = /opt/local/libexec/dovecot/imap-login
  mail_executable = /opt/local/libexec/dovecot/imap
}
protocol pop3 {
  login_executable = /opt/local/libexec/dovecot/pop3-login
  mail_executable = /opt/local/libexec/dovecot/pop3
}
protocol lda {
  auth_socket_path = /opt/local/var/run/dovecot/auth-master
}
auth_executable = /opt/local/libexec/dovecot/dovecot-auth
auth default {
  mechanisms = plain login
  passdb pam {
    args = login
  }
  userdb passwd {
  }
  user = root
  socket listen {
    master {
      path = /opt/local/var/run/dovecot/auth-master
      mode = 0660
    }
    client {
      path = /opt/local/var/run/dovecot/auth-client
      mode = 0660
    }
  }
}
dict {
}
plugin {
}


Note that the "socket listen" section only really needs the client part, and that will be used to provide authentication for postfix's smtpd.

pam configuration

None required (we cheated with "args = login" in the "passwd pam" section).

launchd configuration

Macports installs a working launchd configuration in /Library/LaunchDaemons/org.macports.dovecot.plist:

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd" >
<plist version='1.0'>
<dict>
<key>Label</key><string>org.macports.dovecot</string>
<key>ProgramArguments</key>
<array>
        <string>/opt/local/bin/daemondo</string>
        <string>--label=dovecot</string>
        <string>--start-cmd</string>
        <string>/opt/local/sbin/dovecot</string>
        <string>;</string>
        <string>--pid=fileauto</string>
        <string>--pidfile</string>
        <string>/opt/local/var/run/dovecot/master.pid</string>
</array>
<key>Debug</key><false/>
<key>Disabled</key><false/>
<key>KeepAlive</key><true/>
</dict>
</plist>

(I cannot remember if I changed the Disabled value from true to false, but you can leave it false and use -w in the commands below):

# launchctl load  /Library/LaunchDaemons/org.macports.dovecot.plist

If you make any configuration changes then it's best to unload the dovecot (change load to unload in the above command) and reload it .

Router configuration

You'll need to forward port 993 from your router through to the server, but I cannot help you there.

No comments:

Post a Comment