# dovecot with pam_ldap authentication



## daniel (Aug 18, 2011)

I am running dovecot v1.2.10 as imap-service on a FreeBSD server and I am facing problems authenticating using pam.
I always get the error message, although I do provide the right password:
pam_authenticate() failed: authentication error (password mismatch?)

I use /etc/pam.d/imap:

```
#
# PAM configuration for the "imap" service
#
# auth
auth            sufficient      /usr/local/lib/pam_ldap.so no_warn try_first_pass
auth            required        pam_unix.so             no_warn try_first_pass
# account
account         required        pam_unix.so
```

and my config says


```
srvfbsd01# dovecot -n
# 1.2.10: /usr/local/etc/dovecot.conf
# OS: FreeBSD 8.0-RELEASE-p2 amd64  
protocols: imap
ssl: no
disable_plaintext_auth: no
login_dir: /var/run/dovecot/login
login_executable: /usr/local/libexec/dovecot/imap-login
verbose_proctitle: yes
first_valid_uid: 1000
first_valid_gid: 0
mail_location: maildir:~/Maildir
namespace:
  type: private
  separator: .
  inbox: yes
  list: yes
  subscriptions: yes
namespace:
  type: public
  separator: .
  prefix: Public.
  location: maildir:/home/vmail/public
  list: yes
auth default:
  debug: yes
  passdb:
    driver: pam
    args: failure_show_msg=yes cache_key=%u imap
  passdb:
    driver: passwd-file
    args: /usr/local/etc/dovecot/vmail
  userdb:
    driver: passwd
  userdb:
    driver: passwd-file
    args: /usr/local/etc/dovecot/vmail
```

When I start and try to connect I get these log-messages:


```
Aug 18 12:48:10 srvfbsd01 dovecot: auth(default): passwd-file /usr/local/etc/dovecot/vmail: Read 6 users
Aug 18 12:48:10 srvfbsd01 dovecot: auth-worker(default): passwd-file /usr/local/etc/dovecot/vmail: Read 6 users
Aug 18 12:48:11 srvfbsd01 dovecot: auth(default): new auth connection: pid=3690
Aug 18 12:48:11 srvfbsd01 dovecot: auth(default): new auth connection: pid=3688
Aug 18 12:48:11 srvfbsd01 dovecot: auth(default): new auth connection: pid=3689
Aug 18 12:48:14 srvfbsd01 dovecot: auth(default): client in: AUTH       1       PLAIN   service=imap    lip=10.0.10.150 rip=10.0.10.71  lport=143       rport=3583
Aug 18 12:48:14 srvfbsd01 dovecot: auth(default): client out: CONT      1
Aug 18 12:48:14 srvfbsd01 dovecot: auth(default): client in: CONT<hidden>
Aug 18 12:48:14 srvfbsd01 dovecot: auth-worker(default): pam(daniel,10.0.10.71): lookup service=imap
Aug 18 12:48:14 srvfbsd01 dovecot: auth-worker(default): pam(daniel,10.0.10.71): #1/1 style=1 msg=Password: 
Aug 18 12:48:14 srvfbsd01 dovecot: auth-worker(default): pam(daniel,10.0.10.71): pam_authenticate() failed: authentication error (password mismatch?)
Aug 18 12:48:14 srvfbsd01 dovecot: auth(default): passwd-file(daniel,10.0.10.71): lookup: user=daniel file=/usr/local/etc/dovecot/vmail
Aug 18 12:48:14 srvfbsd01 dovecot: auth(default): passwd-file(daniel,10.0.10.71): unknown user
Aug 18 12:48:14 srvfbsd01 dovecot: auth(default): new auth connection: pid=3691
Aug 18 12:48:16 srvfbsd01 dovecot: auth(default): client out: FAIL      1       user=daniel
Aug 18 12:48:21 srvfbsd01 dovecot: auth(default): client in: AUTH       2       PLAIN   service=imap    lip=10.0.10.150 rip=10.0.10.71  lport=143       rport=3583      resp=<hidden>
Aug 18 12:48:21 srvfbsd01 dovecot: auth-worker(default): pam(daniel,10.0.10.71): lookup service=imap
Aug 18 12:48:21 srvfbsd01 dovecot: auth-worker(default): pam(daniel,10.0.10.71): #1/1 style=1 msg=Password: 
Aug 18 12:48:21 srvfbsd01 dovecot: auth-worker(default): pam(daniel,10.0.10.71): pam_authenticate() failed: authentication error (password mismatch?)
Aug 18 12:48:21 srvfbsd01 dovecot: auth(default): passwd-file(daniel,10.0.10.71): lookup: user=daniel file=/usr/local/etc/dovecot/vmail
Aug 18 12:48:21 srvfbsd01 dovecot: auth(default): passwd-file(daniel,10.0.10.71): unknown user
Aug 18 12:48:23 srvfbsd01 dovecot: auth(default): client out: FAIL      2       user=daniel
```

What might be missing?
Thanks, Daniel


----------

