PAM 認為 Kerberos 密碼已過期

PAM 認為 Kerberos 密碼已過期

我在小型網路中運行 Kerberos/LDAP 身份驗證多年。 Kerberos 保存在 LDAP 中,LDAP 又被複製到另一個網站。第二個網站的電腦對副本進行身份驗證,舊網站對原始伺服器進行身份驗證。最近,我新增了幾個新的使用者帳戶。

在原來的網站上,一切都運作順利。新用戶可以正常登入系統。

在第二個網站上,使用副本kinit user也可以正常運作。然而,login user聲稱密碼已過期,應立即更改。修改密碼後,使用者可以正常登入了。

檢查副本 KDC 上的設置,kadmin.local一切對我來說看起來都不錯:

kadmin.local:  getprinc user
Principal: [email protected]
Expiration date: [never]
Last password change: Di Nov 22 21:06:35 CET 2022
Password expiration date: [never]
Maximum ticket life: 0 days 10:00:00
Maximum renewable life: 7 days 00:00:00
Last modified: Di Nov 22 21:06:35 CET 2022 ([email protected])
Last successful authentication: Di Nov 22 21:19:27 CET 2022
Last failed authentication: So Nov 13 09:05:17 CET 2022
Failed password attempts: 0
Number of keys: 8
[ ... ]
Attributes: REQUIRES_PRE_AUTH
Policy: [none]

因此,密碼和主體都不會過期。因此kinit按預期工作:

root@client:~# kinit user
Password for [email protected]: 
root@client:~# klist
Ticket cache: FILE:/tmp/krb5cc_0
Default principal: [email protected]

Valid starting       Expires              Service principal
22.11.2022 21:25:17  23.11.2022 07:25:17  krbtgt/[email protected]
        renew until 23.11.2022 21:25:11

但是,login聲稱密碼已過期,必須更改:

root@ganesha:~# login user
Password: 
Sie müssen Ihr Passwort sofort ändern (Passwortablauf).
Current Kerberos password: 
Enter new Kerberos password: 
Retype new Kerberos password: 
Linux client 5.10.0-19-amd64 #1 SMP Debian 5.10.149-2 (2022-10-21) x86_64

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Letzte Anmeldung: Dienstag, den 22. November 2022, 20:59:02 CET auf pts/5
user@client:~$

登入後,主體的Last password changeLast modified都會更新。Last successful authentication不會改變。成功後也不會改變kinit。但對於成功的客戶loginkinit原始客戶來說,情況確實會改變。這可能是另一個問題,但舊用戶的情況是一樣的,在兩個網站上都能完美運作。使用時getprinc我看不出新舊用戶有什麼差別。

對於下列 PAM 設定應該對Debian 安裝的預設值login有效:authaccount

auth    optional   pam_faildelay.so  delay=3000000
auth    requisite  pam_nologin.so
auth    [success=2 default=ignore]      pam_krb5.so minimum_uid=1000
auth    [success=1 default=ignore]      pam_unix.so nullok try_first_pass
auth    requisite                       pam_deny.so
auth    required                        pam_permit.so
auth    optional   pam_group.so

account [success=1 new_authtok_reqd=done default=ignore]        pam_unix.so 
account requisite                       pam_deny.so
account required                        pam_permit.so
account required                        pam_krb5.so minimum_uid=1000

我設定了一個新的 Bullseye 用戶端,它透過 VPN 使用原始的 Kerberos 和 LDAP。它顯示了相同的行為。我做了一些 PAM 調試:

Jan 23 21:32:44 psyche login[2861]: pam_krb5(login:auth): user user authenticated as [email protected]
Jan 23 21:32:44 psyche login[2861]: pam_unix(login:account): expired password for user user (password aged)
Jan 23 21:32:53 psyche login[2861]: pam_krb5(login:chauthtok): user user changed Kerberos password
Jan 23 21:32:53 psyche login[2861]: pam_unix(login:session): session opened for user user(uid=10##) by admin(uid=0)

(login:account)當然,在所有系統上都能正常工作的舊用戶沒有條目,因此無需更改密碼。所以,它似乎與複製無關。更奇怪的是,有些系統login對這些用戶來說運作得很好。我查了一下/etc/pam.d/common-account,兩個系統上的都是一樣的。

我很欣賞關於檢查內容的任何想法。

感謝您的幫助。

答案1

實際原因與 Kerberos 無關。失敗的帳戶已shadowMax在 LDAP 中設定。雖然我一開始並不知道此設置,但即使shadowLastChangeplusshadowMax仍落後於當前日期,憑證也會被報告為過期。設定shadowMax為 -1 或完全刪除該值可以解決該問題。

這並不能完全解釋為什麼另一個網站的設定顯然完全忽略了該值,但這是另一個故事了。

相關內容