-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pam_setcred fails when KRB5CCNAME=KEYRING:user:name #14
Comments
One piece of information missing from this bug report is what PAM application you're having this problem with. Is this login, sshd, sudo, or something else? I'd like to understand the sequence of PAM calls and changes to UID. If I understand the issue properly, pam_krb5.so picks up the wrong keyring because at that point in your PAM initialization stack, the code is still running as some user other than the target user, and thus picks up the wrong user keyring. Is that right? Calling If this is the case, then both of your problems seem to be that |
I am having problems with gdm3. Other applications I tested (e.g. login) reverse the order in which they call those functions and they end up OK. I have some logs that pam_krb5.so and pam_keyinit.so provide, though they only show that pam_keyinit.so starts with uid=0 and gid=1000. Looking at the code of gdm3 there are only two Disclaimer: using KEYRING:user:name as my credential cache is rather theoretical. I think KEYRING:session:name would be a better choice on those machines, where I need more than a principal, but I like to explore all possibilities. |
It sounds like there may be no way to make the user keyring work if it doesn't setuid until after it's finished with PAM, so I'll focus on what's causing problems with the session keyring. You say "reverse the order" and you said that sometimes the cache wasn't "copied" -- I assume what you mean by that is that when called in one order, you end up with an initialized keyring ticket cache with valid credentials, and with the other order, you don't. Do you end up with no keyring ticket cache at all? And could you be more specific about what order works and what order does not? |
I think what may be happening is that if If that's the case, the fix is to ensure a session keyring is explicitly created before running |
Yes, with a session keyring that's exactly what is happening (I posted a fix to linux-pam/linux-pam#149):
with no credentials. So summarising:
|
I think that's right. The root of the problem for the session keyring is that pam_keyinit.so doesn't implement One can make a counter-argument that pam_krb5.so should only create a persistent ticket cache during All of this stuff is sadly rather underspecified and there are a lot of broken applications out there. |
Using credential caches of type KEYRING (MIT Kerberos) has several issues:
KEYRING:persistent:uidnumber
should work as expected. I didn't test, because standard Debian kernels do not have persistent keyrings.KEYRING:session:name
does not always copy credentials. This issue is IMHO entirely due to some applications calling _pam_open_session and pam_setcred in reversed order and the limitations of pam_keyinit.so (cf. pam_keyinit lacks pam_sm_setcred linux-pam/linux-pam#149)KEYRING:user:name
may attach the credentials to the wrong keyring if the PAM application is not currently running with the user's credentials.The last issue concerns pam_krb5.so. I see several solutions, but I don't know if they are acceptable:
setreuid()/setgeuid()
call before callingkrb5_cc_resolve
. The module pam_keyinit.so does it without wondering about multi-threading, but the comments inpamk5_setcred
tell me this solution would be discarded.If you point me in the right direction I might provide a patch.
The text was updated successfully, but these errors were encountered: