Skip to content

Added comments based on my current understanding of the orchestration code for obtaining keytabs from AD #602

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

soenkeliebau
Copy link
Member

@soenkeliebau soenkeliebau commented May 21, 2025

Description

I read a small part of the code that is used to generate keytabs from AD and noted down my understanding in comments.
Not sure if correct or helpful to actually merge, but by opening a PR I hope to have a place for discussion.

Definition of Done Checklist

  • Not all of these items are applicable to all PRs, the author should update this template to only leave the boxes in that are relevant
  • Please make sure all these things are done and tick the boxes

Author

  • Code contains useful comments

@soenkeliebau soenkeliebau requested a review from nightkr May 21, 2025 15:50
@lfrancke lfrancke moved this to Development: Waiting for Review in Stackable Engineering May 28, 2025
@sbernauer sbernauer moved this from Development: Waiting for Review to Development: In Review in Stackable Engineering Jun 2, 2025
// TGT that is obtained for the operation in the memory of the short lives process
// spawned by `Command::new` above - this way it'll be wiped from memory once this exits
// With any shared or persistent ticket cache this might stick around and potentially be
// reused by later runs
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// reused by later runs
// reused by other volumes (which could cause privilege escalations and similar fun issues)

// Get a `ChildStdin` object for the spawned process and write the serialized request
// for a Principal into it in order for the child process to deserialize it and
// process the request
let mut stdin = child.stdin.take().context(ChildStdinSnafu)?;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The unwrap here is intentional..ish, the stdin pipe is created by spawn() so this should only be None if either:

  1. We forgot to call .stdin(Stdio::piped()) above
  2. We already called .stdin.take()
  3. Tokio is børked for some reason

All of those are internal bugs that are probably panic-worthy IMO (though expect would be better than unwrap).

Comment on lines +105 to +107
// This will always return Ok(...) regardless of exit code or output of the child process
// Failure here means that something went wrong with connecting to the process or obtaining
// exit code or output
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah.. we probably want to add a check for .output.status.success()

Comment on lines +113 to +116
// Check for success of the operation by deserializing stdout of the process to a `Response`
// struct - since `Response` is an empty struct with no fields this effectively means that
// any output will fail to deserialize and cause an `Error::RunProvisioner` to be propagated
// with the output of the child process
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah.. this is also to make sure we have the freedom to return structured values later on.

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

Successfully merging this pull request may close these issues.

2 participants