Skip to content

Commit 0dd32de

Browse files
committed
reinstall: Remove options from ssh keys
These options could contain a command which will cause the new bootc system to be inaccessible. Signed-off-by: ckyrouac <[email protected]>
1 parent 865cc84 commit 0dd32de

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

system-reinstall-bootc/src/prompt.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use crate::{prompt, users::get_all_users_keys};
22
use anyhow::{ensure, Context, Result};
3-
use openssh_keys::PublicKey;
43

54
const NO_SSH_PROMPT: &str = "None of the users on this system found have authorized SSH keys, \
65
if your image doesn't use cloud-init or other means to set up users, \
@@ -92,9 +91,14 @@ pub(crate) fn get_ssh_keys(temp_key_file_path: &str) -> Result<()> {
9291
let keys = selected_users
9392
.into_iter()
9493
.flat_map(|user| &user.authorized_keys)
95-
.collect::<Vec<&PublicKey>>()
96-
.into_iter()
97-
.map(|key| key.to_key_format() + "\n")
94+
.map(|key| {
95+
let mut key_copy = key.clone();
96+
97+
// These options could contain a command which will
98+
// cause the new bootc system to be inaccessible.
99+
key_copy.options = None;
100+
key_copy.to_key_format() + "\n"
101+
})
98102
.collect::<String>();
99103

100104
tracing::trace!("keys: {:?}", keys);

0 commit comments

Comments
 (0)