(command: &str, command_user: &str)
| 179 | |
| 180 | #[context("get_keys_from_command")] |
| 181 | fn get_keys_from_command(command: &str, command_user: &str) -> Result<Vec<PublicKey>> { |
| 182 | let user_config = uzers::get_user_by_name(command_user).context(format!( |
| 183 | "authorized_keys_command_user {command_user} not found" |
| 184 | ))?; |
| 185 | |
| 186 | let mut cmd = Command::new(command); |
| 187 | cmd.uid(user_config.uid()); |
| 188 | let output = cmd |
| 189 | .run_get_output() |
| 190 | .context(format!("running authorized_keys_command {command}"))?; |
| 191 | let keys = PublicKey::read_keys(output)?; |
| 192 | Ok(keys) |
| 193 | } |
| 194 | |
| 195 | #[context("get_all_users_keys")] |
| 196 | pub(crate) fn get_all_users_keys() -> Result<Vec<UserKeys>> { |
no test coverage detected