NDLUG
Dovecot: Secure IMAP Email Server
February 2, 2006
Why Run An Email Server?
● Control resource allocation – Limited storage on regular email account (50 megabytes at ND) – Unlimited on your own computer ● Do filtering and sorting – Spam filtering: Bogofilter (Bayesian Filter) – Sort mail into folders: Procmail ● Access email from everywhere ● Have a local mail archive
● It's freaking sweet A Tale of Two Email Services
● POP3 ● IMAP – Ubiquitous – Access inbox from different – Download whole messages machines from server to local – Faster startup times (only machine download headers) – Minimum use of connect – Messages remain on the time server – Minimum use of server – Subscription Folders resources
General NIX Email Setup
1Fetchmail/Getmail queries pop email server 2Messages sent to procmail for sorting 3Bogofilter checks to see if emails are spam 4Messages are saved to local inbox ex: /home/user/mail
Dovecot Email Server
● POP and IMAP server ● Compatible with UWIMAP and CourierIMAP ● Integration with /etc/passwd ● Fast and efficient ● Fail safe ● TLS/SSL Support ● www.dovecot.org Installation
● Ubuntu Linux – sudo aptget install dovecotimapd (IMAP) – sudo aptget install dovecotpop3d (POP3) ● NetBSD – cd /usr/pkgsrc/mail/dovecot; sudo make install clean ● Arch Linux – sudo pacman S dovecot
IMAP Configuration
dovecot.conf: protocols = imaps # Use IMAPS Port ssl_disable = no # Enable SSL ssl_cert_file = /etc/ssl/certs/dovecot.pem # Server Certificate ssl_key_file = /etc/ssl/private/dovecot.pem # Server Key login = imap # Allow IMAP Login default_mail_env = mbox:/home/%u/mail:INBOX=/home/%u/mail/Inbox # Local mail location auth = default # Use default auth_mechanisms = plain # Use Plain Text Login auth_userdb = passwd # Use /etc/passwd auth_passdb = pam # Use PAM auth_user = root # Process Owner
Notes
● If you want to use SSL (i.e. IMAPS), you need to generate your own SSL certificates – Dovecot comes with a script mkcert.sh to aid this – You can reuse any certificates that you already have ● You can run Dovecot as a nonroot user (AFS?) ● Both MBOX and Maildir mail format are supported (dbox and possibly SQL DB in the future) ● SMTP is handled by another program: sendmail, msmtp
● RTFM or Wiki