OnpenLDAP et Dovecot

Fermé
xillion Messages postés 32 Date d'inscription jeudi 25 février 2010 Statut Membre Dernière intervention 12 octobre 2012 - 26 févr. 2010 à 13:08
xillion Messages postés 32 Date d'inscription jeudi 25 février 2010 Statut Membre Dernière intervention 12 octobre 2012 - 18 mars 2010 à 13:40
Bonjour,
Bonjour a tous: Je dois mettre en place un service de mail avec: Postfix Dovecot Ldap Pour le moment Ldap et dovecot sont installés. Le but étant de se connecter sur le serveur dovecot a passant par un utilisateur enregistré dans LDAP. Lors du test en telenet:

Flo-Debian:/home/florian# telnet 127.0.0.1 143
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
* OK Dovecot ready.
. login test@flo-debian.gescom test
. NO Temporary authentication failure.

fichier mail.err:
Feb 25 14:39:32 Flo-Debian dovecot: auth(default): ldap(test@flo-debian.gescom,127.0.0.1): ldap_search((&(objectClass=mailAccount)(mailenable=OK))) failed: No such object

Comment puis-je réussir mon authentification au pres de openLDAP ? l'utilisateur test a été crée et est visible depuis phpadminldap. Je travaille sous une Debian Lenny
Fichier de config: slapd.conf:

# Features to permit
#allow bind_v2

# Schema and objectClass definitions
include /etc/ldap/schema/core.schema
include /etc/ldap/schema/cosine.schema
include /etc/ldap/schema/nis.schema
include /etc/ldap/schema/inetorgperson.schema
include /etc/ldap/schema/mmc.schema
include /etc/ldap/schema/mail.schema


# Where the pid file is put. The init.d script
# will not stop the server if you change this.
pidfile /var/run/slapd/slapd.pid
# List of arguments that were passed to the server
argsfile /var/run/slapd/slapd.args

# Read slapd.conf(5) for possible values
loglevel 256

# Where the dynamically loaded modules are stored
modulepath /usr/lib/ldap
moduleload back_bdb

# The maximum number of entries that is returned for a search operation
sizelimit 500

# The tool-threads parameter sets the actual amount of cpu's that is used
# for indexing.
tool-threads 1

#######################################################################
# Specific Backend Directives for bdb:
# Backend specific directives apply to this backend until another
# 'backend' directive occurs
backend bdb

#######################################################################
# Specific Backend Directives for 'other':
# Backend specific directives apply to this backend until another
# 'backend' directive occurs
#backend

#######################################################################
# Specific Directives for database #1, of type bdb:
# Database specific directives apply to this databasse until another
# 'database' directive occurs
database bdb

# The base of your directory in database #1
suffix "dc=flo-debian,dc=gescom"

# rootdn directive for specifying a superuser on the database. This is needed
# for syncrepl.
rootdn "cn=admin,dc=flo-debian,dc=gescom"
rootpw gescom
# Where the database file are physically stored for database #1
directory "/var/lib/ldap"

# The dbconfig settings are used to generate a DB_CONFIG file the first
# time slapd starts. They do NOT override existing an existing DB_CONFIG
# file. You should therefore change these settings in DB_CONFIG directly
# or remove DB_CONFIG and restart slapd for changes to take effect.

# For the Debian package we use 2MB as default but be sure to update this
# value if you have plenty of RAM
dbconfig set_cachesize 0 2097152 0

# Sven Hartge reported that he had to set this value incredibly high
# to get slapd running at all. See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=303057 for more
# information.

# Number of objects that can be locked at the same time.
dbconfig set_lk_max_objects 1500
# Number of locks (both requested and granted)
dbconfig set_lk_max_locks 1500
# Number of lockers
dbconfig set_lk_max_lockers 1500

# Indexing options for database #1
index objectClass eq
index cn,sn pres,eq,sub,subany

# Save the time that the entry gets modified, for database #1
lastmod on

# Checkpoint the BerkeleyDB database periodically in case of system
# failure and to speed slapd shutdown.
checkpoint 512 30

# Where to store the replica logs for database #1
# replogfile /var/lib/ldap/replog

# The userPassword by default can be changed
# by the entry owning it if they are authenticated.
# Others should not be able to see it, except the
# admin entry below
# These access lines apply to database #1 only
access to attrs=userPassword,shadowLastChange
by dn="cn=admin,dc=flo-debian,dc=gescom" write
by anonymous auth
by self write
by * none

# Ensure read access to the base for things like
# supportedSASLMechanisms. Without this you may
# have problems with SASL not knowing what
# mechanisms are available and the like.
# Note that this is covered by the 'access to *'
# ACL below too but if you change that as people
# are wont to do you'll still need this if you
# want SASL (and possible other things) to work
# happily.
access to dn.base="" by * read

# The admin dn has full write access, everyone else
# can read everything.
access to *
by dn="cn=admin,dc=flo-debian,dc=gescom" write
by * none
by * read

# For Netscape Roaming support, each user gets a roaming
# profile for which they have write access to
#access to dn=".*,ou=Roaming,o=morsnet"
# by dn="cn=admin,dc=flo-debian,dc=gescom" write
# by dnattr=owner write

#######################################################################
# Specific Directives for database #2, of type 'other' (can be bdb too):
# Database specific directives apply to this databasse until another
# 'database' directive occurs
#database

# The base of your directory for database #2
#suffix "dc=debian,dc=org"

- ldap.conf:

# LDAP Defaults

# See ldap.conf(5) for details
# This file should be world readable but not world writable.
host localhost
base dc=flo-debian,dc=gescom
#SIZELIMIT 12
#TIMELIMIT 15
#DEREF never

- dovecot.conf:

protocols = imap
auth default {
# Space separated list of wanted authentication mechanisms:
# plain login digest-md5 cram-md5 ntlm rpa apop anonymous gssapi
# NOTE: See also disable_plaintext_auth setting.
mechanisms = plain login

# LDAP database <doc/wiki/AuthDatabase.LDAP.txt>
passdb ldap {
# Path for LDAP configuration file
args = /etc/dovecot/dovecot-ldap.conf
}

userdb ldap {
# Path for LDAP configuration file
args = /etc/dovecot/dovecot-ldap.conf
}

user = root

master {
# Master socket provides access to userdb information. It's typically
# used to give Dovecot's local delivery agent access to userdb so it
# can find mailbox locations.
path = /var/run/dovecot/auth-master
#mode = 0600
# Default user/group is the one who started dovecot-auth (root)
user = vmail
group = mail
}

dovecot-ldap.conf:

#
# NOTE: If you're not using authentication binds, you'll need to give
# dovecot-auth read access to userPassword field in the LDAP server.
# With OpenLDAP this is done by modifying /etc/ldap/slapd.conf. There should
# already be something like this:

# access to attribute=userPassword
# by dn="<dovecot's dn>" read # add this
# by anonymous auth
# by self write
# by * none

# Space separated list of LDAP hosts to use. host:port is allowed too.
hosts = flo-debian.gescom

# LDAP URIs to use. You can use this instead of hosts list. Note that this
# setting isn't supported by all LDAP libraries.
#uris =

# Distinguished Name - the username used to login to the LDAP server
#dn = cn=test,ou=Users,dc=flo-debian,dc=gescom

# Password for LDAP server
#dnpass = test

# Use SASL binding instead of the simple binding. Note that this changes
# ldap_version automatically to be 3 if it's lower. Also note that SASL binds
# and auth_bind=yes don't work together.
#sasl_bind = no
# SASL mechanism name to use.
#sasl_mech =
# SASL realm to use.
#sasl_realm =
# SASL authorization ID, ie. the dnpass is for this "master user", but the
# dn is still the logged in user. Normally you want to keep this empty.
#sasl_authz_id =

# Use TLS to connect to the LDAP server.
#tls = no

# Use authentication binding for verifying password's validity. This works by
# logging into LDAP server using the username and password given by client.
# The pass_filter is used to find the DN for the user. Note that the pass_attrs
# is still used, only the password field is ignored in it. Before doing any
# search, the binding is switched back to the default DN.
auth_bind = yes
#
# If you use this setting, it's a good idea to use a different
# dovecot-ldap.conf for userdb (it can even be a symlink, just as long as the
# filename is different in userdb's args). That way one connection is used only
# for LDAP binds and another connection is used for user lookups. Otherwise
# the binding is changed to the default DN before each user lookup.
#
# For example:
# auth_bind_userdn = cn=%u,ou=people,o=org
#
#auth_bind_userdn =

# LDAP protocol version to use. Likely 2 or 3.
ldap_version = 3

# LDAP base. %variables can be used here.
base = dc=flo-debian, dc=gescom

# Dereference: never, searching, finding, always
deref = never

# Search scope: base, onelevel, subtree
scope = subtree

# User attributes are given in LDAP-name=dovecot-internal-name list. The
# internal names are:
# uid - System UID
# gid - System GID
# home - Home directory
# mail - Mail location
#
# There are also other special fields which can be returned, see
# https://wiki.dovecot.org/UserDatabase/ExtraFields
user_attrs = mailbox=home

# Filter for user lookup. Some variables can be used (see
# https://wiki.dovecot.org/Variables for full list):
# %u - username
# %n - user part in user@domain, same as %u if there's no domain
# %d - domain part in user@domain, empty if user there's no domain
user_filter = (&(objectClass=mailAccount)(mail=%u)(mailenable=OK))


# Password checking attributes:
# user: Virtual user name (user@domain), if you wish to change the
# user-given username to something else
# password: Password, may optionally start with {type}, eg. {crypt}
# There are also other special fields which can be returned, see
# https://wiki.dovecot.org/PasswordDatabase/ExtraFields
pass_attrs = mail=user,userPassword=password

# If you wish to avoid two LDAP lookups (passdb + userdb), you can use
# userdb prefetch instead of userdb ldap in dovecot.conf. In that case you'll
# also have to include user_attrs in pass_attrs field prefixed with "userdb_"
# string. For example:
#pass_attrs = uid=user,userPassword=password,homeDirectory=userdb_home,uidNumber=userdb_uid,gidNumber=userdb_gid

# Filter for password lookups
pass_filter = (&(objectClass=mailAccount)(mail=%u)(mailenable=OK))

# Default password scheme. "{scheme}" before password overrides this.
# List of supported schemes is in: https://wiki.dovecot.org/Authentication
#default_pass_scheme = CRYPT

# You can use same UID and GID for all user accounts if you really want to.
# If the UID/GID is still found from LDAP reply, it overrides these values.
user_global_uid = vmail
user_global_gid = mail






Merci a tous

21 réponses

xillion Messages postés 32 Date d'inscription jeudi 25 février 2010 Statut Membre Dernière intervention 12 octobre 2012
18 mars 2010 à 13:40
Bon ok:

Donc je dois mettre en place un service groupware (postfix, dovecot, ldap, egroupware)

Avant l'installation de egroupware j'ai voulu configurer mon serveur de mail:
serveur-imap : dovecot (machine virtuelle)
serveur-smtp: Postfix (machine virtuelle)
serveur-ldap: onpenLdap (machine virtuelle)

Donc je dois envoyer des mail en interne dans un 1er temps, je n'ai pas encore de dns en place.

Pour la config de dovecot j'ai suivit le tuto suivant:
http://www.vogelweith.com/debian_server/07_postfix.php

Pour ldap j'utilise un plugin MMC pour la création des user mail

Pour postfix voila mon fichier main.cf:
# See /usr/share/postfix/main.cf.dist for a commented, more complete version
# Debian specific: Specifying a file name will cause the first
# line of that file to be used as the name. The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname
smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
biff = no

readme_directory = no

# TLS parameters
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.
myhostname = smtp.network.local
mydomain = network.local
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydesination = $myhostname, localhost.$mydomain, localhost, $mydomain
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128,192.168.2.0/24
#mailbox_command = procmail -a "$EXTENSION"
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
queue_directory = /var/spool/postfix

#Structure of local mail directory :
home_mailbox = Maildir/
# Appending .domain is the MUA's job.
append_dot_mydomain = no
append_at_myorigin = yes

delay_warning_time = 4h
maximal_queue_lifetime = 10d
mailbox_size_limit = 0
message_size_limit = 15728640

# LDAP Transport
transport_map = ldap:/etc/postfix/ldap-transport.cf

# Virtual Domains Control
virtual_mailbox_domains = ldap:/etc/postfix/test.cf
virtual_mailbox_maps = ldap:/etc/postfix/ldap-accounts.cf
virtual_mailbox_base =
virtual_alias_maps = ldap:/etc/postfix/ldap-aliases.cf, ldap:/etc/postfix/ldap-maildrops.cf
virtual_alias_domains =
virtual_minimum_uid = 100
virtual_uid_maps = static:vmail
virtual_gid_maps = static:mail

# Requirements for the connecting server
smtpd_client_restrictions =
permit_mynetworks,
permit_sasl_authenticated,
reject_rbl_client bl.spamcop.net,
reject_rbl_client dnsbl.njabl.org,
reject_rbl_client cbl.abuseat.org,
reject_rbl_client sbl-xbl.spamhaus.org,
reject_rbl_client list.dsbl.org,
permit
# Requirements for the HELO statement
smtpd_helo_restrictions =
permit_mynetworks,
permit_sasl_authenticated,
reject_non_fqdn_hostname,
reject_invalid_hostname,
permit

# Requirements for the sender address
smtpd_sender_restrictions =
permit_mynetworks,
permit_sasl_authenticated,
reject_non_fqdn_sender,
#reject_unknown_sender_domain,
permit

# Requirement for the recipient address
smtpd_recipient_restrictions =
permit_mynetworks,
permit_sasl_authenticated,
reject_non_fqdn_recipient,
reject_unknown_recipient_domain,
reject_unauth_destination,
permit

# Enable SASL authentication for the smtpd daemon
#smtpd_sasl_auth_enable = yes
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
# Fix some outlook's bugs
broken_sasl_auth_clients = yes
# Reject anonymous connections
smtpd_sasl_security_options = noanonymous
smtpd_sasl_local_domain =

local_transport = dovecot
virtual_transport = dovecot
dovecot_destination_recipient_limit = 1

Pour le BIND avec ldap j'ai rerpis les fichiers sur le site que j'ai donner plus haut pour dovecot. J'ai fait un partage NFS pour les boites mail /home/vmail qui se trouve sur mon serveur dovecot et postfix.

Au satde ou j'en suis voila le message d'erreur du mail.info:
Mar 18 13:29:30 smtp postfix/master[1855]: terminating on signal 15
Mar 18 13:29:31 smtp postfix/master[2361]: daemon started -- version 2.5.5, configuration /etc/postfix
Mar 18 13:30:00 smtp postfix/master[2361]: terminating on signal 15
Mar 18 13:30:01 smtp postfix/master[2459]: daemon started -- version 2.5.5, configuration /etc/postfix
Mar 18 13:30:17 smtp postfix/smtpd[2467]: connect from unknown[192.168.2.7]
Mar 18 13:30:17 smtp postfix/smtpd[2467]: 8912254170: client=unknown[192.168.2.7]
Mar 18 13:30:17 smtp postfix/cleanup[2471]: 8912254170: message-id=<4BA21CC0.4020101@network.local>
Mar 18 13:30:17 smtp postfix/qmgr[2462]: 8912254170: from=<titi@network.local>, size=578, nrcpt=1 (queue active)
Mar 18 13:30:17 smtp postfix/smtpd[2467]: disconnect from unknown[192.168.2.7]
Mar 18 13:30:17 smtp postfix/smtp[2472]: 8912254170: to=<tutu@network.local>, relay=none, delay=0.16, delays=0.1/0.04/0.02/0, dsn=5.4.4, status=bounced (Host or domain name not found. Name service error for name=network.local type=A: Host not found)
Mar 18 13:30:17 smtp postfix/cleanup[2471]: A762D54172: message-id=<20100318123017.A762D54172@smtp.network.local>
Mar 18 13:30:17 smtp postfix/qmgr[2462]: A762D54172: from=<>, size=2484, nrcpt=1 (queue active)
Mar 18 13:30:17 smtp postfix/bounce[2473]: 8912254170: sender non-delivery notification: A762D54172
Mar 18 13:30:17 smtp postfix/qmgr[2462]: 8912254170: removed
Mar 18 13:30:17 smtp postfix/smtp[2472]: A762D54172: to=<titi@network.local>, relay=none, delay=0.05, delays=0.03/0.01/0.01/0, dsn=5.4.4, status=bounced (Host or domain name not found. Name service error for name=network.local type=A: Host not found)
Mar 18 13:30:17 smtp postfix/qmgr[2462]: A762D54172: removed

les fichier dovecot.conf:
dovecot: 2010-03-18 13:29:49 Info: auth(default): client in: CONT<hidden>
dovecot: 2010-03-18 13:29:49 Info: auth(default): pam(titi@network.local,192.168.2.7): lookup service=dovecot
dovecot: 2010-03-18 13:29:49 Info: auth(default): new auth connection: pid=2500
dovecot: 2010-03-18 13:29:51 Info: auth(default): pam(titi@network.local,192.168.2.7): pam_authenticate() failed: User not known to the underlying authentication module
dovecot: 2010-03-18 13:29:51 Info: auth(default): ldap(titi@network.local,192.168.2.7): bind search: base=dc=network, dc=local filter=(&(objectClass=mailAccount)(mail=titi@network.local)(mailenable=OK))
dovecot: 2010-03-18 13:29:51 Info: auth(default): ldap(titi@network.local,192.168.2.7): result: mail(user)=titi@network.local
dovecot: 2010-03-18 13:29:51 Info: auth(default): ldap(titi@network.local,192.168.2.7): bind: dn=uid=titi,ou=Users,dc=network,dc=local
dovecot: 2010-03-18 13:29:51 Info: auth(default): client in: AUTH 1 PLAIN service=IMAP secured lip=192.168.2.44 rip=192.168.2.7
dovecot: 2010-03-18 13:29:51 Info: auth(default): client out: CONT 1
dovecot: 2010-03-18 13:29:51 Info: auth(default): client in: CONT<hidden>
dovecot: 2010-03-18 13:29:51 Info: auth(default): pam(titi@network.local,192.168.2.7): lookup service=dovecot
dovecot: 2010-03-18 13:29:51 Info: auth(default): client out: OK 1 user=titi@network.local
dovecot: 2010-03-18 13:29:51 Info: auth(default): master in: REQUEST 4 2490 1
dovecot: 2010-03-18 13:29:51 Info: auth(default): passwd(titi@network.local,192.168.2.7): lookup
dovecot: 2010-03-18 13:29:51 Info: auth(default): passwd(titi@network.local,192.168.2.7): unknown user
dovecot: 2010-03-18 13:29:51 Info: auth(default): ldap(titi@network.local,192.168.2.7): user search: base=dc=network, dc=local scope=subtree filter=(&(objectClass=mailAccount)(mail=titi@network.local)(mailenable=OK)) fields=mailbox
dovecot: 2010-03-18 13:29:51 Info: auth(default): master out: USER 4 titi@network.local home=/home/vmail/titi/ uid=500 gid=8
dovecot: 2010-03-18 13:29:51 Info: IMAP(titi@network.local): Effective uid=500, gid=8, home=/home/vmail/titi/
dovecot: 2010-03-18 13:29:51 Info: IMAP(titi@network.local): maildir: data=/home/vmail/titi//Maildir
dovecot: 2010-03-18 13:29:51 Info: imap-login: Login: user=<titi@network.local>, method=PLAIN, rip=192.168.2.7, lip=192.168.2.44, TLS
dovecot: 2010-03-18 13:29:51 Info: IMAP(titi@network.local): maildir: root=/home/vmail/titi//Maildir, index=/home/vmail/titi//Maildir, control=, inbox=
dovecot: 2010-03-18 13:29:52 Info: auth(default): new auth connection: pid=2504
dovecot: 2010-03-18 13:29:53 Info: auth(default): pam(titi@network.local,192.168.2.7): pam_authenticate() failed: User not known to the underlying authentication module
dovecot: 2010-03-18 13:29:53 Info: auth(default): ldap(titi@network.local,192.168.2.7): bind search: base=dc=network, dc=local filter=(&(objectClass=mailAccount)(mail=titi@network.local)(mailenable=OK))
dovecot: 2010-03-18 13:29:53 Info: auth(default): ldap(titi@network.local,192.168.2.7): result: mail(user)=titi@network.local
dovecot: 2010-03-18 13:29:53 Info: auth(default): ldap(titi@network.local,192.168.2.7): bind: dn=uid=titi,ou=Users,dc=network,dc=local
dovecot: 2010-03-18 13:29:53 Info: auth(default): client out: OK 1 user=titi@network.local
dovecot: 2010-03-18 13:29:53 Info: auth(default): master in: REQUEST 5 2493 1
dovecot: 2010-03-18 13:29:53 Info: auth(default): passwd(titi@network.local,192.168.2.7): lookup
dovecot: 2010-03-18 13:29:53 Info: auth(default): passwd(titi@network.local,192.168.2.7): unknown user
dovecot: 2010-03-18 13:29:53 Info: auth(default): ldap(titi@network.local,192.168.2.7): user search: base=dc=network, dc=local scope=subtree filter=(&(objectClass=mailAccount)(mail=titi@network.local)(mailenable=OK)) fields=mailbox
dovecot: 2010-03-18 13:29:53 Info: auth(default): master out: USER 5 titi@network.local home=/home/vmail/titi/ uid=500 gid=8
dovecot: 2010-03-18 13:29:53 Info: imap-login: Login: user=<titi@network.local>, method=PLAIN, rip=192.168.2.7, lip=192.168.2.44, TLS
dovecot: 2010-03-18 13:29:53 Info: IMAP(titi@network.local): Effective uid=500, gid=8, home=/home/vmail/titi/
dovecot: 2010-03-18 13:29:53 Info: IMAP(titi@network.local): maildir: data=/home/vmail/titi//Maildir
dovecot: 2010-03-18 13:29:53 Info: IMAP(titi@network.local): maildir: root=/home/vmail/titi//Maildir, index=/home/vmail/titi//Maildir, control=, inbox=

L ip 2.7 est ma machine hote sur le quelle j'ai configuré thunderbir
0