# /opt/csw/bin/pkgutil -i CSWdovecot
Create a directory to hold the dovecot configuration files and some more symlinks.
# mkdir /opt/csw/etc/dovecot # ln -s /opt/csw/etc/dovecot/dovecot.conf /opt/csw/etc/dovecot.conf # ln -s /opt/csw/etc/dovecot /etc/dovecot
Verify the SSL certificate and key are in place.
cert.key /opt/csw/ssl/private/dovecot.pem cert.crt /opt/csw/ssl/certs/dovecot.pem
The dovecot configuration is very straightforward. This configuration uses a separate password file for each vhost. The %d in the userdb and passdb blocks translates to the vhost. When using a separate password file per vhost you don't put the @vhost in the login. When opting for a single password file emailaddr@vhost should be the login stored in the password file. Also disable_plaintext_auth is set to no, but that should be enabled on a production system.
Example /etc/dovecot/dovecot.conf:
# What protocols to listen for
protocols = pop3 imap
# Whether to enable/disable plaintext logins over unsecure protocols.
disable_plaintext_auth = no
pop3_uidl_format = %08Xu%08Xv
# Default maildir directory relative to the home directory.
default_mail_env = maildir:~/
# First UID/GID allowed to be used for a user
first_valid_uid = 101
first_valid_gid = 102
auth default {
mechanisms = plain login
passdb passwd-file {
args = /data/mail/vhosts/%d/passwd
}
userdb passwd-file {
args = /data/mail/vhosts/%d/passwd
}
socket listen {
client {
path = /opt/csw/var/spool/postfix/private/auth
mode = 0660
user = postfix
group = postfix
}
}
}
The password file is similar to a standard unix password file. The encryption method is stored in {} before the password or hash. The UID and GID need to be above the first_valid_uid/first_valid_gid, and if using the postfix virtual mail server should be the UID/GID of the virtmail created when installing postfix. Password hashes can be generated with dovecotpw
/data/mail/vhosts/vhost1.dom/passwd
fake:101:102:{SHA1}PaVBVZkYqAjCQCu6UBL2xgsnZhw=::/data/mail/vhosts/vhosts1.dom/fake/
really.fake:101:102:{PLAIN}qwerty::/data/mail/vhosts/vhosts1.dom/really.fake/
[;P;]
Finally we need to configure sasl. This is done by creating /etc/sasl/smtpd.conf with the following:
pwcheck_method: auxprop mech_list: PLAIN LOGIN
A lot of postfix/sasl installations store sasl configuration files in /etc/sasl so create the following symlink.
# ln -s /etc/sasl /etc/postfix/sasl
The very last thing that needs to be done is to restart postfix and dovecot.
# svcadm restart cswdovecot cswpostfix