Skip to content

Commit de930ca

Browse files
authored
fix(ssh): use sshd -G over -T and add error handling (#138)
fix(ssh): use sshd -G over -T and add error handling sshd -T requires sshd to be running which it may not be. This results in failure to provision correctly. Update module to use sshd -G instead. Since -G is only supported in newer versions of OpenSSH, ensure we default to .ssh/authorized_keys on failure. As a bonus, -G appears more performant that -T in my experiments. - Add authorized_keys_path_string parameter to provision_ssh() for dependency injection. This allows removal of mock_provision_ssh() and using the real function without the sshd invocation. - Add get_authorized_keys_path_from_sshd() with parameter for runner. This allows us to test the various failure modes when invoking sshd -G separately from provision_ssh() tests. Signed-off-by: Chris Patterson <[email protected]>
1 parent 5f2ff88 commit de930ca

File tree

2 files changed

+219
-123
lines changed

2 files changed

+219
-123
lines changed

libazureinit/src/provision/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ impl Provision {
131131
user: self.user.name,
132132
},
133133
)?;
134-
ssh::provision_ssh(&user, &self.user.ssh_keys)?;
134+
ssh::provision_ssh(&user, &self.user.ssh_keys, None)?;
135135
}
136136

137137
self.hostname_backends

0 commit comments

Comments
 (0)