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

Allow use of non-default keytab for server service authentication #390

Closed
wants to merge 2 commits into from

Conversation

bdodge
Copy link
Contributor

@bdodge bdodge commented Jan 3, 2025

by specifying a key table file path, the kerberos credentials for the server service can be acquired without the need for a password or doing"kinit" in the shell and running as root to allow access to the krb5 default keytab

The programmatically does the equivalent of

kinit -kt -c cifs/

getting initial credentials from the KDC using the key table

Then to acquire cred to accept an client connection, gss_acquire_cred_from is used with the keytab and cache path instead of the defaults. Works great.

Also adds a daily renew of credentials to the server can run continuously in kerberos world

former behavior happens if no keytab path set in server context

Benefits

  • no password needed to pass to or store in server
  • no use of the default cache, so clients and other programs can kinit on the same machine without affecting the server
  • no need to run as root user (to get access to krb5.keytab for initiator creds)
  • no need to merge the key for the service in to the default keytab, can just use standalone

@sahlberg
Copy link
Owner

sahlberg commented Jan 5, 2025

Thanks!
Manually folded into a single commit and merged.

When you have a commit followed by a small fix to the previous commit
you should "git rebase -i HEAD~3" and use "fold" ro merge them into a single commit followed by a forced push to update the pull request.
That makes the git history look nicer.

(I also changed #if HAVE_LIBKRB5 to #ifdef HAVE_LIBKRB5 as the former does not work for CMake.)

@sahlberg sahlberg closed this Jan 5, 2025
@bdodge
Copy link
Contributor Author

bdodge commented Jan 5, 2025 via email

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

Successfully merging this pull request may close these issues.

2 participants