On my mailserver runs postfix with dovecot. All authentication-data is stored in a mysql-table.
To be able to separate pop3-users from imap-users, respectively disable pop3/imap for specific accounts I had to create two dovecot instances. Please note that I don’t use the LDA from dovecot but maildrop otherwise it could become a little bit complicated.
HowTo install and run two separate dovecot instances
First there must be two config-directories: “/etc/dovecot-pop3d/” and “/etc/dovecot-imapd/” (make copies from “/etc/dovecot/”). The same steps you have to do in “/var/run/” too (here make copies from “/var/run/dovecot/” of corse).
Below is the my configuration file of the imapd-dovecot (/etc/dovecot-imapd/dovecot.conf). To get the pop3d-version you have to edit the lines 1, 2, 22, 25 and 32.
protocols = imap
base_dir = /var/run/dovecot-imapd/
mail_location = maildir:/var/vmail/%d/%u
mail_extra_groups = mail
# Required: Must have UID of vmail
first_valid_uid = 107
last_valid_uid = 107
pop3_uidl_format = %08Xu%08Xv
maildir_copy_with_hardlinks = yes
disable_plaintext_auth = no
protocol imap {
mail_plugins = quota imap_quota
imap_client_workarounds = outlook-idle delay-newmail
}
protocol lda {
postmaster_address = noaccount@t-p.com
mail_plugins = quota
}
auth default {
mechanisms = plain
passdb sql {
args = /etc/dovecot-imapd/dovecot-sql.conf
}
userdb sql {
args = /etc/dovecot-imapd/dovecot-sql.conf
}
userdb prefetch {
}
user = nobody
socket listen {
master {
path = /var/run/dovecot-imapd/auth-master
mode = 0660
user = vmail
group = mail
}
}
}
dict {
}
plugin {
quota = maildir:storage=10240
}
Also create your own “/etc/dovecot-imapd/dovecot-sql.conf”-file (example).
Now you to create some start/stop-scripts. To do that make two copies of “/etc/init.d/dovecot” named “dovecot-imapd” and “dovecot-pop3d” and change it this way:
$ diff /etc/init.d/dovecot /etc/init.d/dovecot-imapd
23c23,24
< NAME=dovecot
—
> DAEMON_OPTS=”-c /etc/dovecot-imapd/dovecot.conf”
> NAME=dovecot-imapd
35c36
< /etc/dovecot/dovecot.conf`
—
> /etc/dovecot-imapd/dovecot.conf`
45c46
< if grep protocols /etc/dovecot/dovecot.conf | sed ’s/#.*$//’ | tr -d ‘”‘ | \
—
> if grep protocols /etc/dovecot-imapd/dovecot.conf | sed ’s/#.*$//’ | tr -d ‘”‘ | \
52c53
< start-stop-daemon –start –quiet –oknodo –exec $DAEMON
—
> start-stop-daemon –start –quiet –oknodo –name $NAME –exec $DAEMON — $DAEMON_OPTS
59c60
< start-stop-daemon –stop –quiet –oknodo –exec $DAEMON
—
> start-stop-daemon –stop –quiet –oknodo –pidfile /var/run/dovecot-imapd/master.pid
82c83
< start-stop-daemon –stop –quiet –oknodo –exec $DAEMON
—
> start-stop-daemon –stop –quiet –oknodo –pidfile /var/run/dovecot-imapd/master.pid
84c85
< start-stop-daemon –start –quiet –oknodo –exec $DAEMON
—
> start-stop-daemon –start –quiet –oknodo –name $NAME –exec $DAEMON
This is again only for imapd, you can create by yourself the pop3d-version. Now make suitable symlinks in “/etc/rc?.d/” (I created them manually) to start/stop these daemons automatically. At the end remove the old script “/etc/init.d/dovecot” and all its links in “/etc/rc?.d/”.
Maybe there will be a own package for this someday.
Source:
www.dovecot.org
http://wiki.dovecot.org/AuthDatabase/SQL