How to I authenticate with Dovecot + IMAP + PAM on CentOS?

10,475

It had something to do with this, but I don't understand why.

service auth-worker {
  user = $default_internal_user
}
service auth {
  unix_listener /var/spool/postfix/private/auth {
    mode = 0660
    user = postfix
  }
}
Share:
10,475

Related videos on Youtube

Chloe
Author by

Chloe

Updated on September 18, 2022

Comments

  • Chloe
    Chloe over 1 year

    I set up Dovecot IMAP to use PAM as suggested here:

    http://wiki2.dovecot.org/PasswordDatabase/PAM

    PAM/dovecot

    [root@ip-172-31-15-65 pam.d]# cat dovecot
    #%PAM-1.0
    auth    required        pam_unix.so nullok
    account required        pam_unix.so
    

    /etc/dovecot/conf.d/auth-system.conf.ext

    passdb {
      driver = pam
      args = failure_show_msg=yes
    
    userdb {
      driver = passwd
    

    When I try to test and debug as recommended here http://www.courier-mta.org/authlib/README.authdebug.html

    [root@ip-172-31-15-65 pam.d]# telnet localhost 143
    Trying 127.0.0.1...
    Connected to localhost.
    Escape character is '^]'.
    * OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE STARTTLS AUTH=PLAIN AUTH=LOGIN] Dovecot ready.
    a login starrychloe vzcnfZVGW995G9nfuJWp
    a NO [ALERT] Password:
    

    /var/log/dovecot-info.log

    Apr 06 05:12:28 auth: Debug: auth client connected (pid=5395)
    Apr 06 05:12:41 auth: Debug: client in: AUTH    1       PLAIN   service=imap    secured lip=127.0.0.1   rip=127.0.0.1   lport=143  rport=56956      resp=<hidden>
    Apr 06 05:12:41 auth: Debug: Loading modules from directory: /usr/lib64/dovecot/auth
    Apr 06 05:12:41 auth: Debug: Module loaded: /usr/lib64/dovecot/auth/libauthdb_ldap.so
    Apr 06 05:12:41 auth: Debug: Module loaded: /usr/lib64/dovecot/auth/libdriver_sqlite.so
    Apr 06 05:12:41 auth: Debug: Module loaded: /usr/lib64/dovecot/auth/libmech_gssapi.so
    Apr 06 05:12:41 auth: Debug: pam(starrychloe,127.0.0.1): lookup service=dovecot
    Apr 06 05:12:41 auth: Debug: pam(starrychloe,127.0.0.1): #1/1 style=1 msg=Password:
    Apr 06 05:12:43 auth: Info: pam(starrychloe,127.0.0.1): pam_authenticate() failed: Authentication failure (password mismatch?)
    Apr 06 05:12:45 auth: Debug: client out: FAIL   1       user=starrychloe        reason=Password:
    Apr 06 05:13:03 imap-login: Info: Disconnected (auth failed, 1 attempts): user=<starrychloe>, method=PLAIN, rip=127.0.0.1, lip=127.0.0.1, secured
    

    Yet I can log in via SSH

    [root@ip-172-31-15-65 conf.d]# ssh starrychloe@localhost
    starrychloe@localhost's password:
    Last login: Sun Apr  6 04:18:05 2014 from xxxxxxx.cable.mindspring.com
    [starrychloe@ip-172-31-15-65 ~]$
    

    I did restart Dovecot.

    I've already changed the password.