Cyrus

From LQWiki
Jump to: navigation, search

Cyrus is an program that offers a mail service. It is an implementation as well of the imap as of the pop protocol.

Web Site

http://cyrusimap.web.cmu.edu/

Install it

This description has been tested with SUSE Linux 11.1, but should work same or similar on any Linux.

  • Install the software
sudo yast -i cyrus-imapd
  • Allow plain text logins for cyrus.

Change /etc/imap.conf, add a line

allowplaintext: yes
  • Start the service
sudo /etc/init.d/cyrus start
# nmap -p 143 localhost

Starting Nmap 4.75 ( http://nmap.org ) at 2009-04-23 06:16 CEST
Warning: Hostname localhost resolves to 2 IPs. Using 127.0.0.1.
Interesting ports on localhost (127.0.0.1):
PORT    STATE SERVICE
143/tcp open  imap

Nmap done: 1 IP address (1 host up) scanned in 0.08 seconds
  • Find out who the cyrus administrator is
# cat /etc/imapd.conf | grep admins
admins: cyrus

In this case the cyrus administrator is cyrus. We will assume this in the rest of the tutorial.

  • Become the user cyrus
su - cyrus
  • Create a test mailbox for user testuser
# cyradm --auth plain localhost
localhost> createmailbox testuser
localhost> quit
# telnet localhost 143
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
* OK ls3122 Cyrus IMAP4 v2.2.12 server ready
1 LOGIN testuser password
1 OK User logged in
1 SELECT INBOX
* FLAGS (\Answered \Flagged \Draft \Deleted \Seen)
* OK [PERMANENTFLAGS (\Answered \Flagged \Draft \Deleted \Seen \*)]
* 0 EXISTS
* 0 RECENT
* OK [UIDVALIDITY 1240475989]
* OK [UIDNEXT 1]
1 OK [READ-WRITE] Completed
1 LOGOUT

How to ...

Create a mailbox

cyradm --user youruser --auth plain localhost
cm youruser

TroubleShooting

Invalid login

-ERR [AUTH] Invalid login
  • Solution: Add your user to cyrus' authentication file:
saslpasswd2 -c myuser
And make sure the sasl authentication daemon is started:
/etc/init.d/saslauthd start

Permission denied for postfix

  • Symptome: You are using postfix as MTA. You send a mail using sendmail. Afterwards, mailq delivers a permission denied error:
mailq
-Queue ID- --Size-- ----Arrival Time---- -Sender/Recipient-------
2547D8346E5      282 Sat Jan  5 11:32:18  root@kolossus.site
       (connect to kolossus.site[/var/lib/imap/socket/lmtp]: Permission denied)
                                          whoever@localhost.site
-- 0 Kbytes in 1 Request.
postfix is configured to run as user postfix:
ll /var/spool/postfix/deferred/
total 16
drwx------ 2 postfix postfix 4096 Jan  5 12:43 2
[...]
the user postfix cannot write-access /var/lib/imap/socket/:
sudo -u postfix touch /var/lib/imap/socket/postfix-tmp
touch: cannot touch `/var/lib/imap/socket/postfix-tmp': Permission denied
  • Reason: Your postfix is not allowed to write to cyrus' lmtp socket /var/lib/imap/socket/lmtp
  • Solution: Set the permissions that postfix can access your cyrus socket, e.g.:
chmod 777 /var/lib/imap /var/lib/imap/socket
flush your mail queue using postqueue -f

See also