Dovecot with mbox virtual hosts

Home | UNIX | Oracle | Code | Practical | Private

Dovecot with mbox virtual hosts

pbraun.nethence.com/doc/mail/postoffice.html
pbraun.nethence.com/doc/mail/vm-pop3d.html
pbraun.nethence.com/doc/mail/dovecot.html
pbraun.nethence.com/doc/mail/spamass-milter.html
pbraun.nethence.com/doc/mail/procmail.html


Prepare the system
See Postoffice smtp server virtual mbox configuration (pbraun.nethence.com/doc/mail/postoffice.html)


Prerequesties
Make sure you've got those packages installed,
rpm -q ntp dovecot

Dovecot doesn't like time changes (wiki.dovecot.org/TimeMovedBackwards). You need the NTP daemon to slow down or accelerate the clock speed when updating the time,
cd /etc
mv ntp.conf ntp.conf.dist
sed '/^$/d;/^#/d;' ntp.conf.dist > ntp.conf
vi ntp.conf
point to your prefered NTP serveurs e.g.,
server ntp1.dedibox.fr
server ntp.obspm.fr


Configuration
Check for configuration file location,
dovecot -n | head -1

Configure,
cd /etc
mv dovecot.conf dovecot.conf.dist
vi dovecot.conf
like,
protocols = pop3 imap
syslog_facility = mail
first_valid_uid = 8
disable_plaintext_auth = no
ssl_disable = yes
#mail_debug = yes

# for thunderbird (at least for thunderbird 1),
protocol imap {
login_greeting_capability = yes
imap_client_workarounds = tb-extra-mailbox-sep
}

auth default {
passdb passwd-file {
args = /etc/virtual/%d/passwd
}
userdb static {
args = uid=8 gid=12
}
}

mail_location = mbox:/var/spool/virtual/%d/%n.folders:INBOX=/var/spool/virtual/%d/%n
#mail_location = mbox:/var/spool/virtual/%d/%n.folders
Note. check UID and GID,
grep ^mail /etc/passwd
grep ^mail /etc/group
Note. if you want an alternate port e.g. for pop3,
#rotocol pop3 {
# listen = *:111
#

Run and enable the daemon,
service dovecot start
chkconfig dovecot on
check ports 110 and 143 are listening,
ps aux | egrep 'pop3|imap'
netstat -antp | grep LISTEN | grep 110
netstat -antp | grep LISTEN | grep 143


User administration
Create a virtual mail user,
cd /etc/virtual
./pop_passwd.pl user password >> example.net/passwd
create its IMAP folder and inbox symbolic link,
cd /var/spool/virtual
touch example.net/user
mkdir -p example.net/user.folders
#ln -s ../user example.net/user.folders/inbox

Fix perms,
chown -R mail:mail /etc/virtual
chown -R mail:mail /var/spool/virtual
find /etc/virtual -type d -exec chmod 700 {} \;
find /etc/virtual -type f -exec chmod 600 {} \;
find /var/spool/virtual -type d -exec chmod 700 {} \;
find /var/spool/virtual -type f -exec chmod 600 {} \;

Clean-up subscriptions,
cd /var/spool/virtual/example.net/user.imap
for dir in `find . -type d -name .imap`; do rm -rf $dir; done


References
wiki.dovecot.org/BasicConfiguration
wiki.dovecot.org/VirtualUsers
kevin.denis.free.fr/vmail/part4.html
neranjara.org/article/title/How_to_configure_PostFix_and_Dovecot_for_Virtual_Users_with_out_a_Database_
help.ubuntu.com/community/Dovecot


Home | UNIX | Oracle | Code | Practical | Private | Donate | Print | html/css
© 2010 Pierre-Philipp Braun