如何在 CentOS 上使用 Dovecot + IMAP + PAM 进行身份验证?

如何在 CentOS 上使用 Dovecot + IMAP + PAM 进行身份验证?

我按照此处的建议设置了 Dovecot IMAP 以使用 PAM:

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

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。

我已经改了密码。

答案1

这与此有关,但我不明白为什么。

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

相关内容