Cyrus-imap

From SME Server
Jump to: navigation, search

Cyrus-Imap

This is a rather complicated modification of SME7 to maintain. But it works fine. Recently, Zarafa became opensource and should be evaluated first.

It adds cyrus-imap and a server-manager panel to SME-Server

This howto works also for SME8.

How to install and use cyrus-imap on sme7 and sme8

Cyrus-imap enables folder sharing of mail items. Coupled with the Toltec connector, it can replace many functions of the Exchange Server with mail client Outlook.

By Sophie Romano (SopRom) http://www.logiciel-libre.org I am not a developper and this HowTo is mainly for the records!

This howto presents installation and usage of the cyrus-imap server on a Sme-Server system.

The cyrus-imap web site and other links:

Beware !

Replacing mail server

You'll be modifying the SME7 and some actions will be required from time to time, when updates are applied. For example, the file preline has its permissions resetted after some updates. Always test send/receive after a "yum update".

If you are new to SME7 and linux, it might be advisable to try this on a test machine.

Scripts

I am not a programmer. I assembled these scripts from the works of others (Lionel and Jon) and adapted them to SME7. There is no translation since the implementation of the new language engine.

Credits

The original scripts were developped by Mr. Lionel Debrus for SME6. Then, Jon Roberts from WestCountryBusiness adapted them for SME7. Since, Jon has switched to a different solution and might not be available to provide updates.

  • smeserver-cyrus.tgz (no rpms)
http://www.logiciel-libre.org/downloads/cyrus-imap-sme-howto/smeserver-cyrus.tgz
  • installation script
http://www.logiciel-libre.org/downloads/cyrus-imap-sme-howto/install-cyrus.sh
  • uninstallation script
http://www.logiciel-libre.org/downloads/cyrus-imap-sme-howto/uninstall-cyrus.sh
  • websieve
http://www.logiciel-libre.org/downloads/cyrus-imap-sme-howto/websieve-cgi-bin.tgz

Installation

Some services (imap, imaps, pop, pops) are disabled and replaced. After the installation of needed RPMS, templates are created and expanded, and newly replaced services are enabled. Finally, a panel is added to the server-manager menu.

The script will install these packages:

  • cyrus-imapd
  • cyrus-imapd
  • cyrus-imapd-devel
  • cyrus-imapd-murder
  • cyrus-imapd-nntp
  • cyrus-imapd-utils
  • cyrus-sasl-devel
  • cyrus-sasl-gssapi
  • cyrus-sasl-ntlm
  • cyrus-sasl-plain
  • perl-Cyrus
  • cyrus-sasl
  • cyrus-sasl-md5

Note that POP and IMAP are rendered inaccessible from the Internet with these changes because the services are disabled in the configuration.

Install

mkdir -p /root/cyrus/uninstall
cd  /root/cyrus
wget http://www.logiciel-libre.org/downloads/cyrus-imap-sme-howto/smeserver-cyrus.tgz
wget http://www.logiciel-libre.org/downloads/cyrus-imap-sme-howto/websieve-cgi-bin.tgz
tar -xz --directory="." -f smeserver-cyrus.tgz
cd smeserver-cyrus
wget http://www.logiciel-libre.org/downloads/cyrus-imap-sme-howto/install-cyrus.sh
wget http://www.logiciel-libre.org/downloads/cyrus-imap-sme-howto/restore_db.sh
chmod u+x install-cyrus.sh
cd uninstall
wget http://www.logiciel-libre.org/downloads/cyrus-imap-sme-howto/uninstall-cyrus.sh
chmod u+x uninstall-cyrus.sh
cd ..
./install-cyrus.sh

Updates

When updating (yum update) there is a problem from time to time with php-common.

The workaround is to remove php-common and reinstall it after the update:

rpm -e php-common
yum -y update
yum -y install php-common

Administration

The server-manager now has a new menu item at the bottom.

Cyrus-imap-sme-account.jpg

Imap accounts are based on the users list already existing on the server. They have been migrated to the new location.

Also note that the normal users's folders are not deleted and their content are intact.

It is then advisable to apply this howto on a new list of account that did not receive mail yet.

It is possible to keep messages by transfering them to a different server with the imapcopy tool. Then, after this installation, reimport them with the same tool.


Managing Accounts

The standard SME folder structure for mail is in

/home/e-smith/files/users/<user>/Maildir.

With cyrus-imap, the new structure is in

/var/spool/imap/<user>/user/<user>.

The standard structure is not destroyed with the installation and content just stay there, unreachable. If mail options in the server-manager are switched back to pop enabled and imap enabled, the standard structure is reactivated. When disabled, the cyrus-iamp structure is active.

It is advisable to plan ahead if users are already defined and have content in their mail boxes. With installation, new imap accounts will be created, but old content will not be transfered to new folder structure. The tool imapcopy is handy to move users's content to a temporary imap server, and restored the same way after installation.

Access Rights - Explanation

   * l: List
   * r: Read
   * s: Set Read Flag
   * w: Write
   * i: Insert
   * p: Post
   * c: Create
   * d: Delete
   * a: Administrator

To assign permissions to everybody, the group name is "anyone".

Quotas

Quotas for each account is set to 100MB by default. This means that this space will be "reserved" on the server. So increasing default quota to 1GB for 20 users would reserve 20GB on the server.

Shared folders

With this installation (without Toltec Connector), sharing folders is done from the server-manager. Creating a folder and assigning access rights allows for other users and groups to see the account. EGroupware, Thunderbird, Outlook work with this. But note that Outlook will interfere with other clients with its character coding for languages like french.

Toltec's Outlook Connector

Although folder sharing works fine with EGroupware, Thunderbird, etc., it also provides the base for Exchange functionnalities. So with a connector (non-free) we can have Outlook clients share calendars, contacts, notes... Toltec makes one of these connectors. It's not expensive, it works.

File:Tolec.perm.jpg The connector is available from here and the manual from here (toltec.co.za). It has been tested with the Kolab server.

The cost is affordable at about 14USD per seat. This connector is for use where a group needs/wants/prefers/sticks to Outlook for whatever the reason. It provides for sharing calendars, address books, notes, todos, etc.

Beware of the Connector's concept of attachment to the server. Read the manual about this, it's important. Changing or reinstalling on the server will reset the internal ID of the server and all attached clients will see the server as a new one. Then all items on clients will be downloaded again!

Toltec Connector wants to see the server as a POP account and each station can provide for content to be shared. Permissions need to be set for each station providing content to someone or to others.

Cyradm

Critical data are stored in /var/spool/imap

CLI can be used to manage some options. See the man pages here.

Folders that matter are:

   * Cyrus config: /var/lib/imap
   * Cyrus mailboxes: /var/spool/imap

Backing up:

   /etc/init.d/cyrus-imapd stop
   cp /var/lib/imap /somewhere
   cp /var/spool/imap /somewhere
   /etc/init.d/cyrus-imapd start

Administration:

   cd /usr/lib/cyrus-imapd
   su cyrus
   ./mbexamine <box>
   ./mupdate
   ./reconstruct -r <box>
   ./chk_cyrus
   ./ipurge -f -d 0

Login with the password provided when installing:

   cyradm --user cyrus localhost
   cyradm --user admin localhost

Purge mailboxes :

   Force deletion of mail in all mailboxes: /usr/lib/cyrus-imapd/ipurge -f -d 0

Reconstruct:

   Reconstruct: /usr/lib/cyrus-imapd/reconstruct -r -f user.username

Uninstallation

To uninstall, run the script /root/cyrus/uninstall-cyrus.sh

cd /root/cyrus
chmod u+x uninstall-cyrus.sh
./uninstall-cyrus.sh
signal-event post-upgrade && signal-event; reboot