我在 Debian 11 服务器上有一个 openLDAP 服务,并且在 Ubuntu 22.04 PC 上设置了 PAM;我开始很困惑。我可以毫无问题地登录,但是当我想更改密码时,我看到一些奇怪的行为。起初,我可以更改密码,但我首先必须输入LDAP Password
,然后被要求两次新密码+重新输入。
然而现在,经过一番折腾之后/etc/pam.d/common-password
,它看起来像这样:
#
# /etc/pam.d/common-password - password-related modules common to all services
#
# This file is included from other service-specific PAM config files,
# and should contain a list of modules that define the services to be
# used to change user passwords. The default is pam_unix.
# Explanation of pam_unix options:
# The "yescrypt" option enables
#hashed passwords using the yescrypt algorithm, introduced in Debian
#11. Without this option, the default is Unix crypt. Prior releases
#used the option "sha512"; if a shadow password hash will be shared
#between Debian 11 and older releases replace "yescrypt" with "sha512"
#for compatibility . The "obscure" option replaces the old
#`OBSCURE_CHECKS_ENAB' option in login.defs. See the pam_unix manpage
#for other options.
# As of pam 1.0.1-6, this file is managed by pam-auth-update by default.
# To take advantage of this, it is recommended that you configure any
# local modules either before or after the default block, and use
# pam-auth-update to manage selection of other modules. See
# pam-auth-update(8) for details.
# here are the per-package modules (the "Primary" block)
#password requisite pam_pwquality.so retry=3
#password [success=2 default=ignore] pam_unix.so obscure use_authtok try_first_pass yescrypt
password [success=2 default=ignore] pam_unix.so obscure try_first_pass yescrypt debug
#password sufficient pam_sss.so use_authtok
password [success=1 default=ignore] pam_ldap.so minimum_uid=1000 use_authtok debug
# here's the fallback if no module succeeds
password requisite pam_deny.so
# prime the stack with a positive return value if there isn't one already;
# this avoids us returning an error just because nothing sets a success code
# since the modules above will each just jump around
password required pam_permit.so
# and here are more per-package modules (the "Additional" block)
password optional pam_gnome_keyring.so
# end of pam-auth-update config
我在尝试更改密码时看到了这一点:
(base) jan@enki:~$ passwd
(current) LDAP Password:
passwd: Authentication token manipulation error
passwd: password unchanged
这是/var/log/auth.log
(输出中的空行是因为我在另一个终端启动后按了几次 Enter 键passwd
):
(base) root@enki:/var/log# tail -f auth.log
...
Jan 27 16:12:59 enki passwd[392340]: pam_unix(passwd:chauthtok): username [jan] obtained
Jan 27 16:12:59 enki passwd[392340]: pam_unix(passwd:chauthtok): user "jan" does not exist in /etc/passwd
Jan 27 16:12:59 enki passwd[392340]: pam_ldap(passwd:chauthtok): nslcd request config (1)
Jan 27 16:12:59 enki passwd[392340]: pam_ldap(passwd:chauthtok): nslcd account check; user=jan
Jan 27 16:13:05 enki passwd[392340]: pam_ldap(passwd:chauthtok): nslcd authentication; user=jan
Jan 27 16:13:05 enki passwd[392340]: pam_ldap(passwd:chauthtok): authentication succeeded
Jan 27 16:13:05 enki passwd[392340]: pam_unix(passwd:chauthtok): username [jan] obtained
Jan 27 16:13:05 enki passwd[392340]: pam_unix(passwd:chauthtok): user "jan" does not exist in /etc/passwd
Jan 27 16:13:05 enki passwd[392340]: pam_ldap(passwd:chauthtok): nslcd request config (1)
Jan 27 16:13:05 enki passwd[392340]: pam_ldap(passwd:chauthtok): nslcd account check; user=jan
...
在我看来,身份pam_ldap
验证成功了,那么为什么会失败呢?其次,为什么我两次被要求输入新密码?