Cyrus : Différence entre versions

De DiouxX's Wiki
Aller à : navigation, rechercher
(saslauthd.conf)
(imapd.conf)
 
Ligne 67 : Ligne 67 :
 
# be determined by doing a reverse lookup on the interface IP, this
 
# be determined by doing a reverse lookup on the interface IP, this
 
# domain is used.
 
# domain is used.
defaultdomain: pass.be
+
defaultdomain: diouxx.be
 
</pre>
 
</pre>
 
<br>
 
<br>
Ligne 94 : Ligne 94 :
 
##
 
##
 
## HOSTNAME
 
## HOSTNAME
servername: deblan.admin.pass.be
+
servername: diouxx.be
 
##
 
##
 
</pre>
 
</pre>

Version actuelle datée du 4 octobre 2014 à 23:13

Cette page concerne l'installation et la configuration de Cyrus-Imap

Installation

On installe les paquets suivants :

Konsole.png
[root@ordi ~]# apt-get install cyrus-admin-2.2 cyrus-clients-2.2 cyrus-common-2.2 cyrus-imapd-2.2 libauthen-sasl-cyrus-perl libcyrus-imap-perl22


Konsole.png
[root@ordi ~]# apt-get install libsasl2-2 sasl2-bin


Configuration

Dans cette section, on va devoir éditer et/ou créer plusieurs fichiers.

imapd.conf

Le fichier /etc/imapd.conf permet de configurer différents processus qui rentrent en ligne de compte pour le protocole imap

Seuls les paramètres à modifiés sont lister :

# Uncomment the following and add the space-separated users who
# have admin rights for all services.
admins: cyrus


# Space-separated list of users that have imapd "admin" status, in
# addition to those in the admins: entry above
imap_admins: cyrus

# Space-separated list of users that have sieve "admin" status, in
# addition to those in the admins: entry above
sieve_admins: cyrus


# If enabled, cyrdeliver will look for Sieve scripts in user's home
# directories: ~user/.sieve.
sieveusehomedir: false

# If sieveusehomedir is false, this directory is searched for Sieve scripts.
sievedir: /var/spool/sieve


# If nonzero, normal users may create their own IMAP accounts by creating
# the mailbox INBOX.  The user's quota is set to the value if it is positive,
# otherwise the user has unlimited quota.
autocreatequota: -1


# Allow plaintext logins by default (SASL PLAIN)
allowplaintext: yes

# Force PLAIN/LOGIN authentication only
# (you need to uncomment this if you are not using an auxprop-based SASL
# mechanism.  saslauthd users, that means you!). And pay attention to
# sasl_minimum_layer and allowapop below, too.
sasl_mech_list: PLAIN


# The default domain for virtual domain support
# If the domain of a user can't be taken from its login and it can't
# be determined by doing a reverse lookup on the interface IP, this
# domain is used.
defaultdomain: diouxx.be


#
# SASL library options (these are handled directly by the SASL libraries,
# refer to SASL documentation for an up-to-date list of these)
#

# The mechanism(s) used by the server to verify plaintext passwords. Possible
# values are "saslauthd", "auxprop", "pwcheck" and "alwaystrue".  They
# are tried in order, you can specify more than one, separated by spaces.
#
# Do note that, since sasl will be run as user cyrus, you may have a lot of
# trouble to set this up right.
sasl_pwcheck_method: saslauthd


# Syslog prefix. Defaults to cyrus (so logging is done as cyrus/imap etc.)
syslog_prefix: cyrus


Il faut rajouter à la fin du fichier, le nom d'hôte

##
## HOSTNAME
servername: diouxx.be
##


cyrus.conf

Le fichier /etc/cyrus.conf permet de configurer les protocoles imap,pop, sieve ...

Ici, ne seront lister que les lignes a commenter/décommenter ou à modifier.

Commentez ou decommentez les lignes suivantes selon si vous voulez que le protocole soit actif ou non

imap            cmd="imapd -U 30" listen="imap" prefork=0 maxchild=100
imaps          cmd="imapd -s -U 30" listen="imaps" prefork=0 maxchild=100
pop3           cmd="pop3d -U 30" listen="pop3" prefork=0 maxchild=50
pop3s          cmd="pop3d -s -U 30" listen="pop3s" prefork=0 maxchild=50

Modifier la ligne suivante afin de permettre de se connecter au protocole sieve depuis une machine distante

#sieve          cmd="timsieved" listen="localhost:sieve" prefork=1 maxchild=100
sieve           cmd="timsieved" listen="sieve" prefork=1 maxchild=100


saslauthd.conf

Le fichier /etc/saslauthd.conf est un fichier à créée de toute pièce et qui va permettre de configurer le système d'authentification.

Voici à quoi, il doit ressembler. Les options à modifiés sont listers juste après.

# SERVEUR LDAP
LDAP_SERVERS: ldap://127.0.0.1:389

# DOMAINE
LDAP_DEFAULT_DOMAIN: diouxx.be

LDAP_TIMEOUT: 10
LDAP_TIME_LIMIT: 10
LDAP_CACHE_TTL: 30
LDAP_CACHE_MEM: 32768

# VERSION LDAP
LDAP_VERSION: 3

# SASL Pour l'accès au serveur
LDAP_USE_SASL: no
#LDAP_START_TLS: yes
#LDAP_TLS_CACERT_DIR: /root/openldap01.pem

# Méthode d'authentification (bind / custom / fastbind)
LDAP_AUTH_METHOD: bind

# Utilisateur utilisé pour la connexion - Si vide = Anonyme
LDAP_BIND_DN: uid=cyrus,ou=Applications,dc=diouxx,dc=be
# Et le mot de passe
LDAP_BIND_PW: password

# Base de départ de la recherche
#LDAP_SEARCH_BASE: ou=Users,dc=diouxx,dc=be
LDAP_SEARCH_BASE: dc=diouxx,dc=be
# Et profondeur (sub / one / base )
LDAP_SCOPE: sub

# Filtre de recherche : uid dans notre cas
LDAP_FILTER: uid=%u
# Et nom du champ contenant le mot de passe
LDAP_PASSWORD_ATTR: userPassword


  • LDAP_SERVERS : Indique le serveur LDAP a contacter (IP:PORT)
  • LDAP_DEFAULT_DOMAIN : Domaine du serveur LDAP
  • LDAP_BIND_DN : Nom de l'utilisateur qui va interroger le serveur LDAP
  • LDAP_BIND_PW : Password de l'utilisateur
  • LDAP_SEARCH_BASE : Base de la recherche


Warning.png
Attention !
Attention : Ce fichier est créé par défaut en lecture pour tout le monde sous Debian. Il est impératif de changer ses droit pour n’autoriser la lecture qu’à l’utilisateur root.


Konsole.png
[root@ordi ~]# chmod 600 /etc/saslauthd.conf


saslauthd

L’activation de l’authentification sasl et l’utilisation de se fichier se font par modification de /etc/default/saslauthd. Il faut bien penser à activer le démon (START=yes) et spécifier la méthode d’authentification utilisée par saslauthd.

Les paramètres à modifier sont donc :

  • START=yes
  • MECHANISMS="ldap"
  • PARAMS="-O /etc/saslauthd.conf"
#
# Settings for saslauthd daemon
# Please read /usr/share/doc/sasl2-bin/README.Debian for details.
#

# Should saslauthd run automatically on startup? (default: no)
START=yes

# Description of this saslauthd instance. Recommended.
# (suggestion: SASL Authentication Daemon)
DESC="SASL Authentication Daemon"

# Short name of this saslauthd instance. Strongly recommended.
# (suggestion: saslauthd)
NAME="saslauthd"

# Which authentication mechanisms should saslauthd use? (default: pam)
#
# Available options in this Debian package:
# getpwent  -- use the getpwent() library function
# kerberos5 -- use Kerberos 5
# pam       -- use PAM
# rimap     -- use a remote IMAP server
# shadow    -- use the local shadow password file
# sasldb    -- use the local sasldb database file
# ldap      -- use LDAP (configuration is in /etc/saslauthd.conf)
#
# Only one option may be used at a time. See the saslauthd man page
# for more information.
#
# Example: MECHANISMS="pam"
MECHANISMS="ldap"
PARAMS="-O /etc/saslauthd.conf"

# Additional options for this mechanism. (default: none)
# See the saslauthd man page for information about mech-specific options.
MECH_OPTIONS=""

# How many saslauthd processes should we run? (default: 5)
# A value of 0 will fork a new process for each connection.
THREADS=5

# Other options (default: -c -m /var/run/saslauthd)
# Note: You MUST specify the -m option or saslauthd won't run!
#
# WARNING: DO NOT SPECIFY THE -d OPTION.
# The -d option will cause saslauthd to run in the foreground instead of as
# a daemon. This will PREVENT YOUR SYSTEM FROM BOOTING PROPERLY. If you wish
# to run saslauthd in debug mode, please run it by hand to be safe.
#
# See /usr/share/doc/sasl2-bin/README.Debian for Debian-specific information.
# See the saslauthd man page and the output of 'saslauthd -h' for general
# information about these options.
#
# Example for postfix users: "-c -m /var/spool/postfix/var/run/saslauthd"
OPTIONS="-c -m /var/run/saslauthd"


Test de fonctionnement

Démarrage du démon saslauthd :

Konsole.png
[root@ordi ~]# /etc/init/d/saslauthd restart


Pour tester :

Konsole.png
[user@ordi ~]$ testsaslauthd -u User -p Password
0: OK « Success. »


Manipulation

Un script a été créé pour avoir plus facile a administrer les utilisateurs cyrus : Cyrus-mbox