ubuntuusers.de

dovecot ldap authentifizierung

Status: Gelöst | Ubuntu-Version: Ubuntu 16.04 (Xenial Xerus)
Antworten |

averlon

Anmeldungsdatum:
18. Mai 2011

Beiträge: 290

Hallo,

ich habe in der zwischenzeit viel versucht, aber komme nicht zu einem ergebnis.

Mein Postfix/Dovecot will die authentifizierung userdb gegenüber ldap nicht machen.

Der string der zur prüfung übergeben werden soll ist die e-Mail adresse. Es wird aber nur der user-teil übergeben.

auth: Error: put_filter: "(&(objectClass=posixAccount)(mail=redmine))"

Eigentlich sollte da "redmine@domain" stehen.

Meine dovecot config:

# 2.2.22 (fe789d2): /etc/dovecot/dovecot.conf
# Pigeonhole version 0.4.13 (7b14904)
# OS: Linux 3.13.0-95-generic x86_64 Ubuntu 16.04.1 LTS ext4
auth_debug = yes
auth_mechanisms = plain login
auth_username_format = %Ln
auth_verbose = yes
debug_log_path = /var/log/dovecot/dovecot-debug.log
info_log_path = /var/log/dovecot/dovecot-info.log
log_path = /var/log/dovecot/dovecot.log
mail_gid = avvmail
mail_location = maildir:/var/av_vmail/%d/%n:LAYOUT=fs
mail_privileged_group = avvmail
mail_uid = avvmail
namespace inbox {
  inbox = yes
  location =
  mailbox Drafts {
    auto = subscribe
    special_use = \Drafts
  }
  mailbox Sent {
    auto = subscribe
    special_use = \Sent
  }
  mailbox Spam {
    auto = subscribe
    special_use = \Junk
  }
  mailbox Trash {
    auto = subscribe
    special_use = \Trash
  }
  prefix =
}
passdb {
  args = /etc/dovecot/av_auth_ldap.conf
  driver = ldap
}
protocols = pop3 imap lmtp
service auth {
  unix_listener /var/spool/postfix/private/auth {
    group = postfix
    mode = 0660
    user = postfix
  }
  unix_listener auth-userdb {
    group = avvmail
    mode = 0666
    user = avvmail
  }
}
service lmtp {
  executable = lmtp -L
  unix_listener /var/spool/postfix/private/dovecot-lmtp {
    group = postfix
    mode = 0660
    user = postfix
  }
  user = avvmail
}
ssl = required
ssl_cert = </etc/ssl/certs/ssl-cert-snakeoil.pem
ssl_key = </etc/ssl/private/ssl-cert-snakeoil.key
ssl_protocols = !SSLv2 !SSLv3
userdb {
  args = /etc/dovecot/av_auth_ldap.conf
  driver = ldap
}
protocol lda {
  info_log_path = /var/log/dovecot/dovecot-lda.log
  log_path = /var/log/dovecot/dovecot-lda-errors.log
}
protocol lmtp {
  info_log_path = /var/log/dovecot/dovecot-lmtp.log
  postmaster_address = avadmin@av.loc
}

die datei "av_auth_ldap.conf" sieht so aus:

# This file is commonly accessed via passdb {} or userdb {} section in
# conf.d/auth-ldap.conf.ext

# This file is opened as root, so it should be owned by root and mode 0600.
#
# http://wiki2.dovecot.org/AuthDatabase/LDAP
#
# 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 = localhost

# 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.
# Leave it commented out to bind anonymously (useful with auth_bind=yes).
#dn =
dn = cn=search,dc=av,dc=loc

# Password for LDAP server, if dn is specified.
#dnpass =
dnpass = somepassword

# 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
# TLS options, currently supported only with OpenLDAP:
#tls_ca_cert_file =
#tls_ca_cert_dir =
#tls_cipher_suite =
# TLS cert/key is used only if LDAP server requires a client certificate.
#tls_cert_file =
#tls_key_file =
# Valid values: never, hard, demand, allow, try
#tls_require_cert =

# Use the given ldaprc path.
#ldaprc_path =

# LDAP library debug level as specified by LDAP_DEBUG_* in ldap_log.h.
# -1 = everything. You may need to recompile OpenLDAP with debugging enabled
# to get enough output.
#debug_level = 0
debug_level = 1

# 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 = no
#auth_bind = yes

# If authentication binding is used, you can save one LDAP request per login
# if users' DN can be specified with a common template. The template can use
# the standard %variables (see user_filter). Note that you can't
# use any pass_attrs if you use this setting.
#
# If you use this setting, it's a good idea to use a different
# dovecot-ldap.conf.ext 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.
# For example: dc=mail, dc=example, dc=org
#base =
base = ou=people,dc=av,dc=loc

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

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

# 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
# http://wiki2.dovecot.org/UserDatabase/ExtraFields
#user_attrs = homeDirectory=home,uidNumber=uid,gidNumber=gid
user_attrs = =home=/var/av_vmail/%d/%n/, =mail=maildir:/var/av_vmail/%d/%n/

# Filter for user lookup. Some variables can be used (see
# http://wiki2.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=posixAccount)(uid=%u))
user_filter = (&(objectClass=posixAccount)(mail=%u))

# 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
# http://wiki2.dovecot.org/PasswordDatabase/ExtraFields
#pass_attrs = uid=user,userPassword=password
pass_attrs = userPassword=password
#pass_attrs =\
# =user=%{ldap:mail}

# 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=posixAccount)(uid=%u))
pass_filter = (&(objectClass=posixAccount)(mail=%u))

# Attributes and filter to get a list of all users
#iterate_attrs = uid=user
#iterate_filter = (objectClass=posixAccount)

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

Eigentlich, so mein verständnis, müsste "mail=%u" die form "user@domain" übergeben. Tut aber nicht.

Vielleicht kann mir jemand auf die spur helfen.

Danke

misterunknown Team-Icon

Ehemalige
Avatar von misterunknown

Anmeldungsdatum:
28. Oktober 2009

Beiträge: 4403

Wohnort: Sachsen

Übergibst du denn die Domain mit, wenn du dich versuchst zu authentifizieren? Sieht für mich eher aus, als würde ein unvollständiger Nutzername übergeben. Von der Konfiguration her, sollte das passen.

averlon

(Themenstarter)

Anmeldungsdatum:
18. Mai 2011

Beiträge: 290

ja, sehe ich auch so, dass ein unvollständiger name übergeben wird.

Aber wo kommt das her? Wer übergibt hier wie was?

Wenn ich das wüßte, dann könnte ich ggf. suchen wo da was falsch konfiguriert ist.

Das könnte irgendwas mit postfix zu tun haben - aber wo?

misterunknown Team-Icon

Ehemalige
Avatar von misterunknown

Anmeldungsdatum:
28. Oktober 2009

Beiträge: 4403

Wohnort: Sachsen

averlon schrieb:

Aber wo kommt das her? Wer übergibt hier wie was?

Mit welchem Client versuchst du dich denn anzumelden? Was gibst du ein?

Das könnte irgendwas mit postfix zu tun haben - aber wo?

Kaum. Postfix nutzt an sich auch nur die Dovecot-Auth via SASL.

averlon

(Themenstarter)

Anmeldungsdatum:
18. Mai 2011

Beiträge: 290

Hallo, ich habe es zwar als gelöst markiert, habe aber keine beschreibung der lösung.

Ich habe die dovecot config neu aufgesetzt.

Danach wurde der username zwar richtig übergeben, aber es funktionierte immer noch nicht. Lag aber dann an berechtigungsproblemen im ldap.

Warum nach der neukonfiguration von dovecot der username richtig übergeben wurde bzw. was das bewirkt hat, weiß ich nicht.

Ergebnis: Jetzt kann ich zumindest mails empfangen. Senden habe ich noch nicht probiert. Kommt noch.

Antworten |