-
-
Notifications
You must be signed in to change notification settings - Fork 93
nixos: add --target-host and --build-host options
#276
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
Changes from all commits
477b751
22f08fa
34e2aa5
20219ad
e7eebb5
280e852
067380d
83574dd
75e09d0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| use std::collections::HashSet; | ||
| use std::path::{Path, PathBuf}; | ||
| use std::process::{Command as StdCommand, Stdio}; | ||
| use std::str; | ||
|
|
||
| use color_eyre::{eyre, Result}; | ||
|
|
@@ -41,6 +42,27 @@ pub fn get_nix_version() -> Result<String> { | |
| Err(eyre::eyre!("Failed to extract version")) | ||
| } | ||
|
|
||
| /// Prompts the user for ssh key login if needed | ||
| pub fn ensure_ssh_key_login() -> Result<()> { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't want to be too nitpicky, but there are three things I would like to note here:
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not nipicky at all, youre right, i should make sure to not unwrap at the call site so that we arent ever dependant on ssh-add |
||
| // ssh-add -L checks if there are any currently usable ssh keys | ||
|
|
||
| if StdCommand::new("ssh-add") | ||
| .arg("-L") | ||
| .stdout(Stdio::null()) | ||
| .status()? | ||
| .success() | ||
| { | ||
| return Ok(()); | ||
| } | ||
| StdCommand::new("ssh-add") | ||
| .stdin(Stdio::inherit()) | ||
| .stdout(Stdio::inherit()) | ||
| .stderr(Stdio::inherit()) | ||
| .spawn()? | ||
| .wait()?; | ||
| Ok(()) | ||
| } | ||
|
|
||
| /// Determines if the Nix binary is actually Lix | ||
| /// | ||
| /// # Returns | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we sure that
cmd.to_cmdline_lossy()doesn't passunescapedinputs to the SSH command? I can't exactly imagine an "attack" vector here, but this seems a little dangerous.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did check that i did do escaping when implementing it, not as much for security as in the case of it would break on weird input like a
'or smth, i cant vouch for their implementation of escaping being correct, but they atleast do something