Accueil | Rubriques | Howtos

Howto Cyrus

Serveur IMAP Cyrus

Tous d'abord, il faut peut-être savoir que les développeurs du SmeServeur n'aiment pas tellement ce serveur de courriels parce qu'il se comporte comme une boîte noire. Les courriels sont entreposés dans une structure de fichiers qu'il n'est pas possible de consulter librement.

Bien que les utilitaires d'administration soient pertinents et documentés sur Internet, ça laisse toujours planer un doute en cas de problème majeur.

Une bonne lecture du script d'installation s'impose avant d'agir et je recommande une installation de test pour se faire la main.

J'ai ajouté l'application "imapcopy.tar.gz" qui permet de transférer les contenus des BAL d'un serveur à l'autre.

Le script ci-bas automatise la conversion.

  • Le mot de passe du compte cyrus est demandé au début et il sera requis lors de l'administration courante du service.
  • Il se peut que les fichiers pour le server-manager aient besoin d'être convertis en UTF-8.
  • Les fichiers originaux seront sauvegardés avant d'être remplacés. Le sous-répertoire ainsi créé doit impérativement être conservé!

Les fichiers contenus dans l'archive attachée:

  • 00startup
  • 30cyrus-imap
  • 90local
  • create-accounts
  • cyrus
  • imapd
  • resetpassword
  • sherwood70
  • sm-panel-copy
  • Telnet.pm
  • template-begin
  • template-end
  • user-create-cyrus
  • user-delete-cyrus
     

Quelques exemples de l'administration de ce serveur Cyrus
et des répertoires utilisés:

Cyrus config:

/var/lib/imap

Cyrus mailboxes:

/var/spool/imap/

Backing up:

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

Login:

cyradm --user cyrus localhost

Administration:

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

Pour créer un répertoire partagé :

>cm partage

Pour voir la liste des répertoires partagés :

>lm

Pour gérer les acls sur les répertoire :

>lam partage

 

 

 

Le script:

#!/bin/sh
#
# =========================================================================
# Prepare files to use a different password

echo -n "Enter password for user cyrus ? "
read cyrus_password
echo Using password $cyrus_password
#cyrus_password=

# Give a change to abort
echo "Cancel installation with Control-C or type y to run the script:"
echo -n "Ok to install ? (y/ctl-C) [n] "
read okCancel

# =========================================================================

mv -f sherwood70 sherwood70.old
mv -f create-accounts create-accounts.old
mv -f user-create-cyrus user-create-cyrus.old
mv -f user-delete-cyrus user-delete-cyrus.old

sed "s/%imapmail%/$cyrus_password/" sherwood70.old > sherwood70
sed "s/%imapmail%/$cyrus_password/" create-accounts.old > create-accounts
sed "s/%imapmail%/$cyrus_password/" user-create-cyrus.old > user-create-cyrus
sed "s/%imapmail%/$cyrus_password/" user-delete-cyrus.old > user-delete-cyrus

=========================================================================
# PHASE # 1
# =========================================================================

# Save current files
cp -p /etc/e-smith/events/actions/user-create-unix uninstall/user-create-unix-b4cyrus
cp -p /etc/e-smith/events/actions/user-delete-unix uninstall/user-delete-unix-b4cyrus

#Stopping existing services (if running):

/etc/rc.d/init.d/saslauthd stop
/etc/rc.d/init.d/xinetd stop
service imap stop
service imaps stop

#Disabling existing IMAP & POP services:

/sbin/e-smith/config setprop imap status disabled
/sbin/e-smith/config setprop imaps status disabled
/sbin/e-smith/config setprop pop3 status disabled
/sbin/e-smith/config setprop pop3s status disabled

#Activating new services :

/sbin/e-smith/config set saslauthd service InitscriptOrder 70 access private status enabled
/sbin/e-smith/config set cyrus-imapd service InitscriptOrder 71 access private status enabled

# Initialisation des fichiers de configuration grace aux patrons
# Donne Acces au service cyrus imap qui ne demarre pas avec Xinetd

#Installing custom-templates:

mkdir -p /etc/e-smith/templates-custom/etc/hosts.deny/
cp ./00startup /etc/e-smith/templates-custom/etc/hosts.deny/



# =========================================================================
# PHASE # 2
# =========================================================================

#Installation des RPMs

yum -y install \
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

# =========================================================================
# PHASE # 3
# =========================================================================

# Configure Custom Templates

#Configuration de Cyrus

mkdir -p /etc/e-smith/templates-custom/etc/cyrus.conf/
cp ./cyrus /etc/e-smith/templates-custom/etc/cyrus.conf/
cp ./template-begin /etc/e-smith/templates-custom/etc/cyrus.conf/
cp ./template-end /etc/e-smith/templates-custom/etc/cyrus.conf/

mkdir -p /etc/e-smith/templates-custom/etc/imapd.conf/
cp ./imapd /etc/e-smith/templates-custom/etc/imapd.conf/
cp ./template-begin /etc/e-smith/templates-custom/etc/imapd.conf/
cp ./template-end /etc/e-smith/templates-custom/etc/imapd.conf/

# On ajoute un script Perl pour gerer les connexions Telnet
# dont nous avons besoin pour ajouter/supprimer des comptes IMAP

mkdir /usr/lib/perl5/site_perl/5.8.5/Net
chmod 0554 Telnet.pm
cp -p ./Telnet.pm /usr/lib/perl5/site_perl/5.8.5/Net/

cp -p ./user-create-cyrus /etc/e-smith/events/actions/
cp -p ./user-delete-cyrus /etc/e-smith/events/actions/

chmod 0554 /etc/e-smith/events/actions/user-create-cyrus
chmod 0554 /etc/e-smith/events/actions/user-delete-cyrus

ln -s /etc/e-smith/events/actions/user-create-cyrus /etc/e-smith/events/user-create/S95user-create-cyrus
ln -s /etc/e-smith/events/actions/user-delete-cyrus /etc/e-smith/events/user-delete/S05user-delete-cyrus

# Create symlinks for starting & stopping services

#Configuring start up services

ln -s /etc/rc.d/init.d/e-smith-service /etc/rc.d/rc7.d/S71cyrus-imapd
ln -s /etc/rc.d/init.d/cyrus-imapd /etc/rc.d/rc0.d/K71cyrus-imap
ln -s /etc/rc.d/init.d/saslauthd /etc/rc.d/rc7.d/S71saslauthd
ln -s /etc/rc.d/init.d/saslauthd /etc/rc.d/rc0.d/K71saslauthd

# Configuring Qmail
# The original script changed permissions like this:
# chmod 4755 /var/qmail/bin/preline
# chmod 4755 /var/qmail/bin/sendmail

# ... but the standard permissions are already set to 0755 for files that exist so why change? asked Charlie...
# it was supposed to do this:
# this sticky bit is used to allow a called process
# to inherit/assume the user credentials of the calling process.

chmod o+x /usr/lib/cyrus-imapd/deliver

mkdir /etc/e-smith/templates-user-custom/.qmail/
cp ./90local /etc/e-smith/templates-user-custom/.qmail/

mkdir -p /etc/e-smith/templates-custom/etc/services
cp ./30cyrus-imap /etc/e-smith/templates-custom/etc/services/

# On remet a jour les fichiers de configuration a partir des templates.

#Expanding Templates

/sbin/e-smith/expand-template /etc/hosts.deny
/sbin/e-smith/expand-template /etc/xinetd.conf
/sbin/e-smith/expand-template /etc/cyrus.conf
/sbin/e-smith/expand-template /etc/imapd.conf
/sbin/e-smith/expand-template /etc/services

#Restarting services

/etc/rc.d/init.d/xinetd start
/etc/rc.d/init.d/saslauthd start
/etc/rc.d/init.d/cyrus-imapd start

#Configuring Server Manager

cp ./sherwood70 /etc/e-smith/web/functions/sherwood
chown root:admin /etc/e-smith/web/functions/sherwood
chmod 4750 /etc/e-smith/web/functions/sherwood

ln -s /etc/e-smith/web/functions/sherwood /etc/e-smith/web/panels/manager/cgi-bin/sherwood

#Setting IMAP administration password
# The cyrus user was created by rpm (?)
# Change password for cyrus using the variable set at the beginning AND MAKE SURE IT'S DONE!
echo $cyrus_password | `passwd cyrus --stdin >/dev/null 2>&1`

chmod 750 create-accounts

# create cyrus-imap account for current accounts
./create-accounts

# Install manager:
/sbin/e-smith/db /home/e-smith/db/navigation/navigation.en set sherwood panel Description "cyrus-IMAP" DescriptionWeight 6750 Heading Configuration HeadingWeight 6000

# create cyrus-imap individual account based on user names
# Translations where omitted since the new translation system because it is not compatible

#/sbin/e-smith/db /home/e-smith/db/navigation/navigation.fr set sherwood panel Description "Gestion Des comptes Imap" DescriptionWeight 8555 Heading Sherwood HeadingWeight 8000
#/sbin/e-smith/db /home/e-smith/db/navigation/navigation.fr-ca set sherwood panel Description "Gestion Des comptes Imap" DescriptionWeight 8555 Heading Sherwood HeadingWeight 8000

# Apply changes
signal-event email-update

# restart server
signal-event post-upgrade

# done
echo "Done."
signal-event reboot

Fichier attachéTaille
smeserver-cyrusimap.tgz67.62 Ko
imapcopy.tar_.gz294.78 Ko