NDLUG

Dovecot: Secure IMAP 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: ● 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/ queries pop email server 2Messages sent to procmail for sorting 3Bogofilter checks to see if are spam 4Messages are saved to local inbox ex: /home/user/mail

Dovecot Email Server

● POP and IMAP server ● Compatible with UW­IMAP and Courier­IMAP ● Integration with /etc/passwd ● Fast and efficient ● Fail safe ● TLS/SSL Support ● www.dovecot.org Installation

● Ubuntu Linux – sudo apt­get install dovecot­imapd (IMAP) – sudo apt­get install dovecot­pop3d (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 = :/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 non­root user (AFS?) ● Both MBOX and mail format are supported (dbox and possibly SQL DB in the future) ● SMTP is handled by another program: , msmtp

● RTFM or Wiki