rme at bluemail.ch
2025-Oct-27 23:23 UTC
[Samba] KRB5 pam_winbind using KEYRING does not work
Hello Samba experts
I am having issues or misunderstanding how to use pam_winbind Kerberos
storing caches in keyring.
My /etc/security/pam_winbind.conf:
[Global]
debug = yes
debug_state = yes
silent = no
krb5_auth = yes
krb5_ccache_type = KEYRING
cached_login = yes
silent = no
mkhomedir = yes
My /etc/krb5.conf libdefaults and appdefaults:
[libdefaults]
default_realm = AD.DOMAIN.TLD
default_ccache_name = KEYRING:persistent:%{uid}
dns_lookup_realm = false
dns_lookup_kdc = true
[appdefaults]
pam = {
ticket_lifetime = 7d
renew_lifetime = 14d
forwardable = true
proxiable = false
minimum_uid = 1
}
My PAM configuration contains:
auth required pam_winbind.so
During user login I can see (ournalctl -g pam_winbind):
getting password (0x00005389)
Verify user 'testuser'
PAM config: krb5_ccache_type 'KEYRING'
enabling krb5 login flag
enabling cached login flag
enabling request for a KEYRING krb5 ccache
request wbcLogonUser succeeded
user 'testuser' granted access
Returned user was 'testuser'
However performing "klist" after login returning:
klist: Credentials cache keyring 'persistent:<UID>:<UID>'
not found.
And during logout I see this in the debug log of pam_winbind:
username [testuser] obtained
user has no KRB5CCNAME environment
request wbcLogoffUser succeeded
user 'testuser' OK
So either I am missing someting or pam_winbind does not set KRB5CCNAME
environment variable properly (I checked, it's not set). Using pam_krb5
it is set but as of my understanding I don't need pam_krb5 in addition
to pam_winbind. Or I should not need it.
To me it looks like pam_winbind is not properly adding the caches to
keyring and not setting the KRB5CCNAME variable. Therefore also krenew
is not working.
I know I can set krb_ccache_type=FILE and remove default_ccache_name
from libdefaults and get cache files written to /tmp/krb5cc_<UID> but I
would like to use keyring.
And yes, my keyring is working if I manually do a kinit woth the
settings above. I am just not getting caches written to keyring on PAM
login.
I also found the same issue discussed here:
<https://lists.samba.org/archive/samba/2020-August/231254.html> with no
solution.
Maybe I just miss something here so I would be glad to get some feedback
on how to properly use KEYRING with pam_winbind.
I am on Samba 4.23.2 running ARCH Linux.
Best regards and thanks in advance!
Rainer
On Tue, 28 Oct 2025 00:23:30 +0100 Rainer Meier via samba <samba at lists.samba.org> wrote:> Hello Samba experts > > I am having issues or misunderstanding how to use pam_winbind > Kerberos storing caches in keyring. > > However performing "klist" after login returning: > > klist: Credentials cache keyring 'persistent:<UID>:<UID>' not found. > > > And during logout I see this in the debug log of pam_winbind: > > username [testuser] obtained > user has no KRB5CCNAME environment > request wbcLogoffUser succeeded > user 'testuser' OK > > > So either I am missing someting or pam_winbind does not set > KRB5CCNAME environment variable properly (I checked, it's not set). > Using pam_krb5 it is set but as of my understanding I don't need > pam_krb5 in addition to pam_winbind. Or I should not need it. > > To me it looks like pam_winbind is not properly adding the caches to > keyring and not setting the KRB5CCNAME variable. Therefore also > krenew is not working. >I run Debian as standard, so normally the kerberos cache goes into /tmp and just works, but it should work. I don't have Samba running on Arch, the nearest I have is a Rocky Linux 10 VM running as a DC, so I set that up using your /etc/security/pam_winbind.conf settings and added 'default_ccache_name = KEYRING:persistent:%{uid}' to the '[libdefaults]' section of the /etc/krb5.conf file. I logged in and ran this: echo "$KRB5CCNAME" Which returned this: KEYRING:persistent:3000016 So I ran 'klist', which returned this: Ticket cache: KEYRING:persistent:3000016:3000016 Default principal: rowland at AD.HOME.ARPA Valid starting Expires Service principal 28/10/25 10:07:05 28/10/25 20:07:05 RL10$@AD.HOME.ARPA renew until 04/11/25 10:07:05 28/10/25 10:07:05 28/10/25 20:07:05 krbtgt/AD.HOME.ARPA at AD.HOME.ARPA renew until 04/11/25 10:07:05 I then altered /etc/krb5.conf to add some of your other settings: [libdefaults] default_realm = AD.HOME.ARPA dns_lookup_realm = false dns_lookup_kdc = true default_ccache_name = KEYRING:persistent:%{uid} [realms] AD.HOME.ARPA = { default_domain = ad.home.arpa ticket_lifetime = 7d renew_lifetime = 14d forwardable = true proxiable = false minimum_uid = 1 } [domain_realm] rl10 = AD.HOME.ARPA And logged out and in again, it still worked, try my /etc/krb5.conf (altered to your REALM etc). Rowland