You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/cli.rs
+23-1Lines changed: 23 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -103,6 +103,9 @@ pub struct Opts {
103
103
/// Which sudo command to use. Must accept at least two arguments: user name to execute commands as and the rest is the command to execute
104
104
#[clap(long)]
105
105
sudo:Option<String>,
106
+
/// Prompt for sudo password during activation.
107
+
#[clap(long)]
108
+
interactive_sudo:Option<bool>,
106
109
}
107
110
108
111
/// Returns if the available Nix installation supports flakes
@@ -538,7 +541,25 @@ async fn run_deploy(
538
541
log_dir.as_deref(),
539
542
);
540
543
541
-
let deploy_defs = deploy_data.defs()?;
544
+
letmut deploy_defs = deploy_data.defs()?;
545
+
546
+
if deploy_data.merged_settings.interactive_sudo.unwrap_or(false){
547
+
warn!("Interactive sudo is enabled! Using a sudo password is less secure than correctly configured SSH keys.\nPlease use keys in production environments.");
548
+
549
+
if deploy_data.merged_settings.sudo.is_some(){
550
+
warn!("Custom sudo commands should be configured to accept password input from stdin when using the 'interactive sudo' option. Deployment may fail if the custom command ignores stdin.");
551
+
}else{
552
+
// this configures sudo to hide the password prompt and accept input from stdin
553
+
// at the time of writing, deploy_defs.sudo defaults to 'sudo -u root' when using user=root and sshUser as non-root
554
+
let original = deploy_defs.sudo.unwrap_or("sudo".to_string());
0 commit comments