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

reinstall: warn if no users with authorized ssh keys are found #1092

Merged
merged 1 commit into from
Feb 12, 2025
Merged
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
13 changes: 11 additions & 2 deletions system-reinstall-bootc/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ pub(crate) mod users;

const ROOT_KEY_MOUNT_POINT: &str = "/bootc_authorized_ssh_keys/root";

const NO_SSH_PROMPT: &str = "None of the users on this system found have authorized SSH keys, if
your image doesn't use cloud-init or other means to set up users, you may not be able to log in
after reinstalling. Do you want to continue?";

fn run() -> Result<()> {
bootc_utils::initialize_tracing();
tracing::trace!("starting {}", env!("CARGO_PKG_NAME"));
Expand All @@ -20,8 +24,13 @@ fn run() -> Result<()> {

let config = config::ReinstallConfig::load().context("loading config")?;

let mut reinstall_podman_command =
podman::command(&config.bootc_image, &prompt::get_root_key()?);
let root_key = &prompt::get_root_key()?;

if root_key.is_none() && !prompt::ask_yes_no(NO_SSH_PROMPT, false)? {
return Ok(());
}

let mut reinstall_podman_command = podman::command(&config.bootc_image, root_key);

println!();

Expand Down