Smarter ssh authorized key search for system-reinstall-bootc#1146
Merged
Conversation
9f77b79 to
39e0527
Compare
cgwalters
reviewed
Feb 26, 2025
This is prep for running authorizedkeyscommand to collect the user's authorized keys. Signed-off-by: ckyrouac <[email protected]>
39e0527 to
9b036a8
Compare
cgwalters
reviewed
Feb 26, 2025
|
|
||
| // Safety: The UID should be valid because we got it from uzers | ||
| #[allow(unsafe_code)] | ||
| let user_uid = unsafe { Uid::from_raw(user.uid()) }; |
Collaborator
There was a problem hiding this comment.
(This is OK for now but I think per previous discussion we actually don't need to change uid for this, we can just use cap-std)
9b036a8 to
ae33afb
Compare
Prior to this, the prompt to select users other that root would result in an error. Now, all ssh keys will be gathered into a single file and passed to bootc install to-existing-root --root-ssh-authorized-keys. Signed-off-by: ckyrouac <[email protected]>
ae33afb to
870da95
Compare
Collaborator
Author
|
This is ready for a final review |
cgwalters
approved these changes
Feb 27, 2025
cgwalters
left a comment
Collaborator
There was a problem hiding this comment.
LGTM, let's ship it - I had two totally minor things that can just be rolled into a subsequent PR.
I'll try to use the prefix "nit-for-followup:" to mean "next time you (or someone else) does a PR let's consider fixing this then"
| serde = { workspace = true, features = ["derive"] } | ||
| serde_json = { workspace = true } | ||
| serde_yaml = "0.9.22" | ||
| tempfile = "3.10.1" |
Collaborator
There was a problem hiding this comment.
nit-for-followup: Let's use { workspace = true }
| fn prompt_single_user(user: &crate::users::UserKeys) -> Result<Vec<&crate::users::UserKeys>> { | ||
| let prompt = format!( | ||
| "Found only one user ({}) with {} SSH authorized keys. Would you like to import it and its keys to the system?", | ||
| "Found only one user ({}) with {} SSH authorized keys.\n\ |
Collaborator
There was a problem hiding this comment.
suggestion-for-followup: This would be more readable with indoc!
This was referenced Feb 27, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pushing this branch early for visibility. The first commit just parses the
sshd -Toutput into a struct.