Sendmail & Cyrus-imapd

Aleksandar Milivojevic amilivojevic at pbl.ca
Tue Apr 5 17:02:52 UTC 2005


GPL wrote:
> Hi folks, I'm starting my first jump into working with a Linux mail
> server. So far from what I have read I need sendmail for SMTP and some
> other service for POP/IMAP. From what I see the thing to use with
> fedora is Cyrus-imapd. My goal is to run a mail server for a handful
> of people in a non mission critical environment that can be accessed
> by outlook/thunderbird, etc.. A learning experience mainly.

There are two IMAP servers distributed with Fedora.

Cyrus IMAPD is very powerfull IMAP server.  It is very fast, and has 
many features needed for large installations.  It also allows you to 
setup virtual users (in other words, you can setup mail accounts without 
need to create actual system accounts).  It implements complete 
separation of system accounts and email store.

Dovecot is simple IMAP server.  It is trivial to setup, and uses 
existing system accounts, and user's home directories to store email. 
If you simply want something that is fast and easy to get working, it 
might be better choice.  There's not much to learn with that one ;-)

If you want to lear advanced thing about IMAP, Cyrus is the right way to 
go, because Dovecot does not have support for some features.  If you 
decide to go Cyrus route, couple of hints to get you going.

The configuration files distributed with Fedora will make use of system 
accounts for authentication.  It is easy to change them to use LDAP or 
some other form of athentication if you want to go that way.  By 
default, /etc/imapd.conf is setup to saslauthd to perform 
authentication, and saslauthd is configured (in 
/etc/sysconfig/saslauthd) to use /etc/shadow file.  If you want to take 
advantage of PAM, you can instruct saslauthd to use pam mechanisms 
instead of directly accessing /etc/shadow.

This will take care of authentication.

Since email store is completely separate from system accounts, you will 
need to manually create mailboxes, or let Cyrus IMAPD create them 
automatically when they are accessed for the first time.

Fire up cyrus-imapd and saslauthd services (and make sure they are 
started on boot using chkconfig command).

To create mailboxes manually, set the password for cyrus account 
("passwd cyrus" as root).  Than execute "cyradm --user cyrus localhost". 
  It will prompt you for cyrus' password.  Inside cyradm, you can type 
"help" to get list of all commands.  To create mailbox for user foobar 
(for example), you would type "cm user.foobar".  The "user." part is 
important, since if you type only "cm foobar", you would create shared 
folder, not user's mailbox!

You'd probably want to create mailbox for root, yourself, and all other 
accounts that you want to receive mail for (most system accounts are 
aliased to root, so you don't need mailboxes for them, unless you 
changed /etc/aliases file).  You can get list of all mailboxes and 
folders by typing "lm".

To delete mailbox, you first need to allow cyradm to do that. 
Basically, you would grant priviledge with "sam user.foobar +c cyradm", 
and than delete mailbox with "dm user.foobar".  It is kind of safety 
mechanism to prevent you from wiping out your entire mail store (yes, 
"dm user" would delete *all* mailboxes).  There are many more things you 
can do from within cyradm, including setting up ACLs if you want users 
to be able share folders and so on.

If you want mailboxes to be created automatically, instead of you 
creating them by hand, edit /etc/imapd.conf and add something along the 
lines:

autocreatequota: -1
autocreateinboxfolders: Drafts|Templates|Sent Items
autosubscribeinboxfolders: Drafts|Templates|Sent Items

When user logs in for the first time to check email, his mailbox will be 
created, and some common folders will be also created and user 
subscribed to them.  Note that user will not be able to receive email 
before he logs in for the first time (since mailbox isn't existing), 
unless you created mailbox manually.  I would advise against using 
"createonpost" option, since that would create mailboxes for 
non-existing users too.  For more details, check imapd.conf man page.

You also need to instruct sendmail that email is no longer to be stored 
in /var/spool/mail directory.  Go to /etc/mail directory, and edit 
sendmail.mc file.  Remove (or comment) this two lines:

FEATURE(`local_procmail')
MAILER(procmail)

And add this three lines:

define(`CYRUSV2_MAILER_ARGS', `FILE /var/lib/imap/socket/lmtp')
define(`confLOCAL_MAILER',`cyrusv2')
MAILER(cyrusv2)

Rebuild sendmail.cf (type "m4 sendmail.mc > sendmail.cf"), restart 
sendmail, and off you go.

There are many resources about Cyrus IMAPD.  The O'Reilly book is sadly 
out of date, so I wouldn't recommend spending any money on it (until 
there is an updated version).  There are some helpfull resources on 
Cyrus web site:

http://asg.web.cmu.edu/cyrus/imapd/

Sligtly out-of-date HOWTO (most stuff from it was already done for you 
by Red Hat, but you might want to check it out):

http://en.tldp.org/HOWTO/Cyrus-IMAP.html

There's also mailing list (you'll find links on Cyrus web site), that 
might be helpfull in some cases (in my experience too many bigshots on 
the list who don't want to be bothered with begginers questions).

-- 
Aleksandar Milivojevic <amilivojevic at pbl.ca>    Pollard Banknote Limited
Systems Administrator                           1499 Buffalo Place
Tel: (204) 474-2323 ext 276                     Winnipeg, MB  R3T 1L7




More information about the fedora-list mailing list