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

[Bug]: An unwanted user exists in keytab #191

Closed
whg517 opened this issue Jan 2, 2025 · 0 comments · Fixed by #192
Closed

[Bug]: An unwanted user exists in keytab #191

whg517 opened this issue Jan 2, 2025 · 0 comments · Fixed by #192

Comments

@whg517
Copy link
Member

whg517 commented Jan 2, 2025

Desc

Get two keytabs using two volumes in a pod. A keytab may appear containing all kerberos users.

The temporary file name found in the source code when keytab is generated is a unix timestamp, and keytab data is written to the same file name when concurrent operations occur.

solution

Use uuid as file name or hash based on kerberos service name. It is best to use uuid generation to generate random values.

ref

// Ktadd generates a keytab file for the given principals
// Usage: ktadd [-k[eytab] keytab] [-q] [-e keysaltlist] [-norandkey] [principal | -glob princ-exp] [...]
func (k *Kadmin) Ktadd(principals ...string) ([]byte, error) {
keytab := path.Join(os.TempDir(), strconv.FormatInt(time.Now().Unix(), 10)+".keytab")
defer func() {
if err := os.Remove(keytab); err != nil {
kadminLogger.Error(err, "Failed to remove keytab")
}
}()

@whg517 whg517 changed the title [Bub]: An unwanted user exists in keytab [Bug]: An unwanted user exists in keytab Jan 3, 2025
@whg517 whg517 linked a pull request Jan 3, 2025 that will close this issue
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 a pull request may close this issue.

1 participant