Skip to content
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

RFE: Kerberos5: log failing client principal, not server #1948

Open
jmuf opened this issue Mar 9, 2023 · 3 comments
Open

RFE: Kerberos5: log failing client principal, not server #1948

jmuf opened this issue Mar 9, 2023 · 3 comments
Assignees
Milestone

Comments

@jmuf
Copy link
Contributor

jmuf commented Mar 9, 2023

recently came across many errors of the form

230308 17:28:44 5766 XrootdXeq: User authentication failed; Seckrb5: Unable to extract client name;; No translation available for requested principal (p=xrootd/eosproject-i02.cern.ch@CERN.CH).

This message is misleading - the thing that fails translating to a local account name is not the server principal (which is logged here) but rather the one supplied by the client (which is not). Would it be possible to instead log the failing client principal in this case ?
https://github.com/xrootd/xrootd/blob/master/src/XrdSeckrb5/XrdSecProtocolkrb5.cc#L503 has the failing condition but https://github.com/xrootd/xrootd/blob/master/src/XrdSeckrb5/XrdSecProtocolkrb5.cc#L530 then always logs (server) Principal.

(underlying issue in our case was "accidentally" re-using a Kerberos credential cache, in the default location..)

@xrootd-dev
Copy link

xrootd-dev commented Mar 9, 2023 via email

@abh3 abh3 self-assigned this Mar 10, 2023
@jmuf
Copy link
Contributor Author

jmuf commented Mar 15, 2023

It certainly would. Now, would you consider creating a pull request that fixes the problem? That way you get complete credit for not only identifying the problem but fixing it as well :-)

Looks simple, but have not done this, since the data to be printed (from deep inside the Kerberos service ticket) will be cleaned up before we hit that particular Fatal() log line - so would need to have two 'Fatal()' (then do the cleanup in two places), or copy to some temporary string (and clean that up). There probably is some project-wide "how to do this best"-approach here..

@amadio amadio added this to the 5.6 milestone Mar 23, 2023
@amadio amadio self-assigned this Jun 21, 2023
@amadio amadio modified the milestones: 5.6, 6.0 Jun 30, 2023
@abh3
Copy link
Member

abh3 commented Oct 12, 2023

The following krb5 function can convert the principal structure to a printable name:

https://web.mit.edu/kerberos/www/krb5-latest/doc/appdev/refs/api/krb5_unparse_name.html

This is a generalization of another more complicated method:

https://web.mit.edu/kerberos/www/krb5-latest/doc/appdev/refs/api/krb5_unparse_name_ext.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants