Dovecot IMAP Server Date: September, 2009.

Slides:



Advertisements
Similar presentations
© 2012 Entrinsik, Inc. Informer Administration Exploring the system menu and functions PRESENTER: Jason Vorenkamp| Informer Software Engineer| March 2012.
Advertisements

ITIS 3110 Jason Watson. Replication methods o Primary/Backup o Master/Slave o Multi-master Load-balancing methods o DNS Round-Robin o Reverse Proxy.
Draft-lemonade-imap-submit-01.txt “Forward without Download” Allow IMAP client to include previously- received message (or parts) in or as new message.
Server Upgrade From UW to Cyrus. What is an IMAP Server? Provides access to your mail messages stored on the mail server Requires authentication.
©Company confidential 1 Performance Testing for TM & D – An Overview.
Hands-On Microsoft Windows Server 2003 Administration Chapter 6 Managing Printers, Publishing, Auditing, and Desk Resources.
Backup and Recovery Part 1.
2440: 141 Web Site Administration Services Instructor: Enoch E. Damson.
Architecture of SMTP, POP, IMAP, MIME.
Pro Exchange SPAM Filter An Exchange 2000 based spam filtering solution.
Mail Server Fitri Setyorini. Content SMTP POP3 How mail server works IMAP.
-I CS-3505 Wb_ -I.ppt. 4 The most useful feature of the internet 4 Lots of different programs, but most of them can talk to each.
SquirrelMail for Webmail AfNOG 2012 Scalable Internet Services (SS-E) Presented by Michuki Mwangi Serrekunda, Gambia (Original Materials by Joelja)
SquirrelMail for Webmail AfNOG 2013 Scalable Internet Services (SS-E) Presented by Michuki Mwangi Lusaka, Zambia (Original Materials by Joelja)
NovaBACKUP 10 xSP Technical Training By: Nathan Fouarge
© 2007 Cisco Systems, Inc. All rights reserved.Cisco Public 1 Application Layer Functionality and Protocols Network Fundamentals – Chapter 3.
IT:Network:Applications Fall  Running one “machine” inside another “machine”  OS in Virtual machines sees ◦ CPU(s) ◦ Memory ◦ Disk ◦ USB ◦ etc.
22-Aug-15 | 1 |1 | Help! I need more servers! What do I do? Scaling a PHP application.
Implementing POP3 and IMAP4 Using Dovecot
Microsoft Windows 2003 Server. Client/Server Environment Many client computers connect to a server.
Computer Concepts 2014 Chapter 7 The Web and .
Hands-On Microsoft Windows Server 2008 Chapter 5 Configuring, Managing, and Troubleshooting Resource Access.
SCO Insight Connector Training. The SCO Insight Connector  Product Overview  Technical Specifications  Installation  Using the Components  Target.
Backup Local Online For secure offsite storage of your , and making it available from any computer or smart phone. Backup accessed with.
IT 424 Networks2 IT 424 Networks2 Ack.: Slides are adapted from the slides of the book: “Computer Networking” – J. Kurose, K. Ross Chapter 2: Application.
Computer Networking From LANs to WANs: Hardware, Software, and Security Chapter 12 Electronic Mail.
Dovecot Mail Storage Timo Sirainen. Me: Timo Sirainen Born 1979 in Finland First C64 BASIC programs around 1988 Open source coding since about 1998 –
NECP: the Network Element Control Protocol IETF WREC Working Group November 11, 1999.
Copyright ®xSpring Pte Ltd, All rights reserved Versions DateVersionDescriptionAuthor May First version. Modified from Enterprise edition.NBL.
Dovecot IMAP Server Date: July, 2009.
INSTALLING MICROSOFT EXCHANGE SERVER 2003 CLUSTERS AND FRONT-END AND BACK ‑ END SERVERS Chapter 4.
Dovecot – server for pop and imap AfNOG CHIX Blantyre, Malawi October - November, 2011 (Materials developed by Joel Jaeggli For AfNOG)‏
Dovecot IMAP Server Timo Sirainen August 2008.
(or ?) Short for Electronic Mail The transmission of messages over networks.
Hands-On Microsoft Windows Server 2008 Chapter 5 Configuring, Managing, and Troubleshooting Resource Access.
Single Sign-on with Kerberos 1 Chris Eberle Ryan Thomas RC Johnson Kim-Lan Tran CS-591 Fall 2008.
Exchang ing. Ex-mail Ex mail is windows base mailing service where With Microsoft Exchange and Users can do more than send and receive. Exchange.
Module 3 Planning and Deploying Mailbox Services.
Module 6: Managing Client Access. Overview Implementing Client Access Servers Implementing Client Access Features Implementing Outlook Web Access Introduction.
Chapter 10 Chapter 10: Managing the Distributed File System, Disk Quotas, and Software Installation.
Integrating and Troubleshooting Citrix Access Gateway.
ESRI User Conference 2004 ArcSDE. Some Nuggets Setup Performance Distribution Geodatabase History.
CS 3830 Day 9 Introduction 1-1. Announcements r Quiz #2 this Friday r Demo prog1 and prog2 together starting this Wednesday 2: Application Layer 2.
CERN - IT Department CH-1211 Genève 23 Switzerland t OIS Deployment of Exchange 2010 mail platform Pawel Grzywaczewski, CERN IT/OIS HEPIX.
DNS DNS overview DNS operation DNS zones. DNS Overview Name to IP address lookup service based on Domain Names Some DNS servers hold name and address.
Your friend, Bluestem. What is Bluestem? “Bluestem is a software system which enables one or more high-security SSL HTTP servers in a domain (entrusted.
A Quick Look At How Works Understanding the basics of how works can make life a lot easier for any user. Especially those who are interested.
Enterprise Messaging & Collaboration. e-Interact Modules.
CITA 310 Section 6 Providing Services (Textbook Chapter 8)
Post Office Protocol.
Linux Operations and Administration Chapter Twelve Configuring a Mail Server.
MCSE Guide to Microsoft Exchange Server 2003 Administration Chapter One Introduction to Exchange Server 2003.
Draft-lemonade-imap-submit-00.txt “Forward without Download” Allow IMAP client to include previously- received message (or parts) in or as new message.
Log Shipping, Mirroring, Replication and Clustering Which should I use? That depends on a few questions we must ask the user. We will go over these questions.
Storage Element Security Jens G Jensen, WP5 Barcelona, May 2003.
Implementing POP3 and IMAP4 Using Dovecot AfNOG 2016 Scalable Internet Services (SS-E) Gaborone, Botswana Presented by Michuki Mwangi (Built on materials.
Spring 2006 CPE : Application Layer_ 1 Special Topics in Computer Engineering Application layer: Some of these Slides are Based on Slides.
Hands-On Microsoft Windows Server 2008 Chapter 5 Configuring, Managing, and Troubleshooting Resource Access.
REPLICATION & LOAD BALANCING
Networking Applications
Authentication & .htaccess
CONTENT MANAGEMENT SYSTEM CSIR-NISCAIR, New Delhi
draft-lemonade-imap-submit-01.txt “Forward without Download”
A Technical Overview of Microsoft® SQL Server™ 2005 High Availability Beta 2 Matthew Stephen IT Pro Evangelist (SQL Server)
Web Caching? Web Caching:.
Implementing POP3 and IMAP4 Using Dovecot
THE BASICS.
LPIC-2 Real Q&As. How is the LDAP administrator account configured when the rootdn and rootpw directives are not present in the slapd.conf file?
IIS.
Chapter 7 Network Applications
Presentation transcript:

Dovecot IMAP Server Date: September, 2009

Rackspace Rackspace uses Dovecot to serve IMAP for over a million paid mailboxes – MS Exchange also available Rackspace has sponsored Dovecot development for years – And employed me full time for year 2009

Overview Dovecot history & how Apple uses it Dovecot features IMAP & Dovecot performance Troubleshooting Future features

What is Dovecot? Dovecot is – IMAP server – POP3 server – Local mail delivery agent with Sieve filtering – Managesieve server – LMTP server (v2.0+) Dovecot is NOT – SMTP server So it neither receives nor sends mails directly

Dovecot Pictures from Wikipedia, by Cyril Thomas and Carcharoth

History Dovecot design was started around June 2002 First release was July 2002 Late 2003 a redesign started v1.0.0 released April 13 th 2007 v1.1.0 released June 21 st 2008 v1.2.0 released July 1 st 2009 v2.0 betas hopefully this year

Why Did Apple Switch to Dovecot from Cyrus?

Apple’s Dovecot My test version: WWDC developers preview dovecot --version says: apple0.5 Apple patches: – Open Directory authentication – Multiple connections per mail process Configuration in /etc/dovecot/dovecot.conf – Server admin changes some settings – Defaults more towards performance than security

Features Often has better performance than competition. – Optimized for minimizing disk I/O (index/cache files) – Hosting my own mails on 10 years old Sparc helps Highly configurable for different environments – Standard mbox and Maildir with transparent indexing (external mailbox modifications are ok) – dbox: Dovecot’s high-performance mailbox format – Many different ways of clustering – Extremely flexible authentication Postfix and Exim support Dovecot for SMTP AUTH

Features Admin-friendly / self-healing – All errors are logged – Understandable error messages – Improved constantly (to reduce my load) – Detected (index) corruption gets fixed automatically file_dotlock_create(/home/timo/Maildir/dovecot-uidlist) failed: Permission denied (euid=1000(timo) egid=1000(timo) missing +x perm: /home/timo) chown(/home/timo/Maildir/.box, -1, 0(root)) failed: Operation not permitted (egid=1000(timo), group based on /home/timo/Maildir)

Authentication Password and user database separation – Passdb for verifying user’s password – Userdb for looking up how to access mailbox Support for almost everything: SQL, LDAP, PAM, checkpassword scripts, etc. – Everything is configurable (e.g. full SQL queries) – Supports multiple dbs (e.g. system + virtual users) Auth mechanisms: PLAIN, CRAM-MD5, DIGEST-MD5, Kerberos, OTP, etc. Password schemes: Plaintext, CRYPT, MD5, SHA1, SHA256, SSHA, SSHA256, etc.

Authentication Cache Passdb and userdb lookups can be cached Password changes are automatically detected: If auth is unsuccessful, and previous auth was a)successful: do uncached passdb lookup b)usuccessful: fail login Negative caching can be disabled – User doesn’t exist caching – Password failures (v1.2+) Avoids a need for imapproxy with webmails?

Maildir Apple: /var/spool/mail/dovecot/ / Maildir basics: – One file = one mail – Filename globally unique – Message flags stored in filename M8247P5745.host,W=1279,S=1243:2,S – W = Virtual message size (CRLF linefeeds) – S = Physical message size (exactly the same as in disk) – for speeding up quota recalculation – :2, just means “version 2” and flags follow the comma. S = Seen Messages must never change!

Maildir++ Directory Layout Maildir/ - INBOX – cur/, new/, tmp/ Maildir/.foo/ – folder called ”foo” – cur/, new/, tmp/ Maildir/.foo.bar/ – foo’s child folder ”bar” – cur/, new/, tmp/ ’.’ begins all folder directory names and separates hierarchies

Maildir Directories Saving messages: – first mail is written to tmp/ Once in a while old files (from crashes, etc.) are deleted – mail is moved to new/ to finish saving Dovecot looks for mails in new/ and moves to cur/ – Scanning new/ is faster than scanning cur/ – So cur/ will eventually contain all messages

Dovecot Files dovecot-uidlist maps filenames to IMAP UIDs dovecot-keywords maps a..z flags in filenames to IMAP keywords (aka. custom flags, labels) subscriptions tracks IMAP subscriptions No state is lost if deleted: dovecot-uidvalidity* - for generating unique IMAP UIDVALIDITY values dovecot.index* - Index files maildirsize – Tracks quota usage

IMAP Protocol Base protocol is complex – difficult to implement it correctly (both client & server) Flexible – many different ways to implement a client (online & offline clients) Extensible – there are a lot of extensions – Clients rarely support more than some basic extensions, such as IDLE. – Thunderbird v3 adds support for several new extensions, such as CONDSTORE.

ImapTest IMAP Server Tester Written originally for Dovecot stress testing – Found a lot of crashes, hangs and mailbox corruption on other IMAP servers as well Tests IMAP server compliance with scripted tests and dynamic random stress testing. Dovecot is currently the only IMAP server that fully passes all of ImapTest tests. Panda IMAP is practically there too Most other servers fail in many different ways.

Offline IMAP Clients Typically download newly seen messages’ bodies once and cache them locally Often can be configured to download immediately vs. download when reading Some use server side searches (Thunderbird) and some don’t (Outlook – if some messages haven’t been downloaded, those aren’t searched) Usually also fetch messages’ metadata once (headers, received date) Server-side caching may help, but not that much – It’s extra disk I/O -> more likely just hurts

Online IMAP Clients Webmails often keep asking for the same information over and over and over again Pine and some webmails cache what they’ve already seen, but not permanently Mutt (without local cache) and some others fetch all messages’ metadata every time when opening a mailbox Caching is very useful, but different clients want different metadata

IMAP Server Performance Difficult to benchmark Depends a lot on clients: Whether clients use a local cache makes a huge difference. – Online vs. offline clients What data to index/cache? SPECmail2009 adds support for IMAP – Emulates different IMAP clients. Client amounts are configurable. – The only benchmark giving realistic results. – Published results all run on different hardware -> results unusable for comparing software

Dovecot Cache File dovecot.index.cache files The main reason for Dovecot’s good performance Dynamic: caches only what clients want. – Specific message headers (From:, Subject:, etc), – MIME structure information, – Sent / received date, etc. Caching decisions for each field: “no”, “temporary”, “permanent” Unused fields dropped after a month. Cached data never changes (IMAP guarantees) Cache file gets “compressed” once in a while Often about 10-20% of mailbox size

Dovecot Index Files dovecot.index contains messages’ metadata – IMAP Unique ID number (UID) identifies messages – Flags (\Seen, \Answered, keywords, etc.) – Extension data: mbox file offsets, cache file offsets, modseq number (v1.2 CONDSTORE), etc. Lazily created/updated since v1.1 – dovecot.index.log has all the latest changes. dovecot.index is updated after 8 kB of new data has been written to the.log

Dovecot Index Files dovecot.index.log is a mailbox transaction log – Somewhat similar to databases’ transaction logs or filesystem journals. – Contains all changes to be done to dovecot.index. dovecot.index is read to memory once and then updated from dovecot.index.log – Very efficient with NFS / clustered filesystems! – Very efficient to find out what changes another session had done!

Plugins Dovecot plugins can hook into almost anything and modify Dovecot’s behavior. Some existing features implemented as plugins: – Access Control Lists – Quota – Full text search indexes – Reading compressed mbox/maildir files Can add new IMAP commands Implement new mail storage backends (virtual, SQL, IMAP proxying)

Dovecot Clustering Two different ways to do it: Globally shared filesystem – Many IMAP servers, each able to handle any user – NFS, cluster filesystems Sharding – Each user’s data mirrored in 2-3 servers – IMAP proxy forwards users to correct server(s)

Apple Clustering I’ve only googled this information.. Xsan, cluster filesystem Multiple mail servers connected to Xsan – Active-active setup – Load balancing with hardware, DNS,..? – Performance probably best if user usually redirected to the same server Or if not user, at least the same IP

Troubleshooting Logs! Dovecot logs all errors! top rawlog dtruss

Dovecot Processes Something’s slow? Isolate it to a specific process first, then use e.g. dtruss: dovecot – master process, creates all other processes, all logging goes through it dovecot-auth – OD lookups imap-login, pop3-login – accepts new connections, handles commands until successful login, SSL proxying even after login imap, pop3 – post-login handling

Client Troubleshooting Look at the IMAP/POP3 protocol traffic between Dovecot and client – Dovecot’s rawlog tool works also with SSL connections – Some other network sniffer such as Wireshark imap/pop3_client_workarounds settings not enabled in Apple’s default config (?)

v1.2 New Features Virtual mailboxes (search views) – ”All unread s in all mailboxes” – All messages in all mailboxes (except Trash) Virtual POP3 INBOX For searching messages from all mailboxes gmail-like conversation views Users can share mailboxes to each others – IMAP ACL commands New IMAP extensions, performance improvements

Dovecot v2.0 Some new features already implemented: – Redesigned master process Easy to add external services, e.g. ManageSieve – Redesigned configuration Local/remote IP/mask -specific configuration – SSL certs Allow changing config data source (e.g. SQL?) – LMTP server and proxy – dsync: Realiably and efficiently sync two mailboxes (e.g. via SSH) – dbox – high performance mailbox format

Dovecot v2.x Features not yet implemented, but hopefully will be by the end of this year: – Index file improvements No locking (with atomic appends) Small checksums all around for detecting corruption In general make the code simpler and more robust – Multi-master replication dbox cloud storage (for some existing cloud API(s)?) Index sharing/replication between servers

Questions?