Centos

如何在 CentOS 上使用 Dovecot + IMAP + PAM 進行身份驗證?

  • April 6, 2014

我按照此處的建議設置了 Dovecot IMAP 以使用 PAM:

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

帕姆/鴿舍

[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

當我嘗試按照此處的建議進行測試和調試時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

但是我可以通過 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 ~]$

我確實重新啟動了 Dovecot。

我已經改過密碼了。

它與此有關,但我不明白為什麼。

service auth-worker {
 user = $default_internal_user
}
service auth {
 unix_listener /var/spool/postfix/private/auth {
   mode = 0660
   user = postfix
 }
}

引用自:https://serverfault.com/questions/586993