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

fix(passwordless_login): login with ssh key only #306

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions client-linuxapp/src/serviceinfo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,25 @@ fn create_user(user: &str) -> Result<()> {
Ok(())
}

fn set_passwordless_login(user: &str) -> Result<()> {
let user_info = passwd::Passwd::from_name(user);
if user_info.is_none() {
bail!("User {} for passwordless login missing", user);
}
log::info!("Setting passwordless login for user: {}", user);
Command::new("passwd")
.arg("-d")
.arg(user)
.spawn()
.context("Error spawning passwordless setup command")?
.wait()
.context(format!(
"Error setting up passwordless login for user {}",
user
))?;
Ok(())
}

fn install_ssh_key(user: &str, key: &str) -> Result<()> {
let user_info = passwd::Passwd::from_name(user);
if user_info.is_none() {
Expand Down Expand Up @@ -627,6 +646,8 @@ async fn process_serviceinfo_in(si_in: &ServiceInfo, si_out: &mut ServiceInfo) -
))?;
install_ssh_key(sshkey_user.as_ref().unwrap(), sshkey_key.as_ref().unwrap())
.context("Error installing SSH key")?;
set_passwordless_login(sshkey_user.as_ref().unwrap())
.context("Error setting up passwordless login")?;
}

// Perform RHSM
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/tests/e2e.rs
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ where
.env("ALLOW_NONINTEROPERABLE_KDF", &"1");
Ok(())
},
Duration::from_secs(60),
Duration::from_secs(120),
)
.context("Error running client")?;
output.expect_success().context("client failed")?;
Expand Down