Dovecot IMAP (part 1)

So, now i’ve gotta learn some IMAP with dovecot, which seems to be the go-to software for coolness.

Why? Easy!

I’m the proud new owner of heick.email, which currently is not pointed anywhere as far as web services or anything else. What I currently do for email is take *@unliterate.net, drop any messages to a SPAM folder, and let my Thunderbird pull the messages and based on the * part I sort it into folders. This way, I can use email addresses like matthew.is.awesome@unliterate.net, and I would get the email in my Inbox. It’d be considered SPAM, but if I wanted to actually draw my attention to it I’d create a mail filter and sort that into a folder.

One of the cool things about IMAP is the folders. You can, at a whim, create a folder and have client-related mail rules “filter” email to a separate folder. Folders can also be “private” or “shared”, which is a good feature.

So, i’ve set myself a goal so far:

  • Choose an IMAP server software (dovecot)
  • Configure it up with 143 (imap) and 993 (imaps)
  • Get POP (110) access
  • Setup the main SPAM inbox user
  • Setup scripts to be able to allocate an inbox to a user that is not part of SPAM (for some possible gifting or resale)
  • Setup /my/ user
  • profit

I am going to have to learn how to talk to IMAP via Terminal as well so I can fine-tune my configurations and see what I’m doing.

To start, I’m using Oracle VM VirtualBox with 2 VM’s

  • Windows XP for Outlook Express. Not caring about updates or anything
  • Centos 6.8 minimal, for base installation and configuration

usual “test” settings such as everything on the same network, root password is password, and no firewalls and full updates where necessary.

I’ve also created a user called userpoop with password poopuser. No domain definition yet, as this is the preliminaries.

$ adduser userpoop
$ passwd userpoop

IMAP 101

I’ve had to learn some basic commands to talk to IMAP, such as:

A login userpoop poopuser
B select INBOX
C logout

^ Some of the basics on getting in and out of your folder.

Installing on Centos6.8

yum does what I need it to do:

yum install dovecot

this gives me dovecot-2.0.9-22 and portreserve-0.0.4-11.

$ rpm -ql portreserve
/etc/portreserve
/etc/rc.d/init.d/portreserve
/sbin/portrelease
/sbin/portreserve
/usr/share/doc/portreserve-0.0.4
/usr/share/doc/portreserve-0.0.4/COPYING
/usr/share/doc/portreserve-0.0.4/ChangeLog
/usr/share/doc/portreserve-0.0.4/NEWS
/usr/share/doc/portreserve-0.0.4/README
/usr/share/man/man1/portrelease.1.gz
/usr/share/man/man1/portreserve.1.gz
/var/run/portreserve

…curious.

Everything with dovecot that I need is in /etc/dovecot/*. Keeping the default configuration, and knowing that the configuration loads via ASCII order i’ll just give myself a configuration file to work with:

touch /etc/dovecot/conf.d/99-self.conf

# First requirement of this is to ONLY have imap, not pop3
# So, we need to adjust the server that we're listiening on

# This enables imap(143) and imaps(993)
protocols = imap

# Setup where we store mail at
mail_location = mbox:~/mail:INBOX=/var/mail/%u

# HACKERY TO GET IT WORKING
# related to authentication
disable_plaintext_auth = no
auth_mechanisms = plain
# Using a passwordfile
passdb {
 driver = passwd-file
 args = scheme=CRYPT username_format=%u /etc/dovecot/users
}
userdb {
 driver = passwd-file
 args = username_format=%u /etc/dovecot/users
}

and I need an /etc/dovecot/users to get basic PLAIN authentication started, so I can get more familiar with this:

/etc/dovecot/users
userpoop:{PLAIN}poopuser:500:500::/home/userpoop

and now…we test via telnet

Leave a Reply