Watch
0
0
Fork
You've already forked hyperhive
0

gate ssh signing per agent: ssh permission, signing policy on the login role, ca key endpoint

This commit is contained in:
atlas 2026-11-16 18:29:06 +01:00 • committed by mara
commit 910f9a6f50

View file

@ -0,0 +1,29 @@
//! `/api/ssh/ca` — the public key of the SSH CA that signs the agents'
//! certificates.
use serde::{Deserialize, Serialize};
/// The CA's public key, one `authorized_keys`-style line. A public value: a
/// machine puts it in its sshd config to trust the certificates the swarm
/// signs.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "schema", derive(utoipa::ToSchema))]
pub struct SshCa {
/// For example `ssh-ed25519 AAAA…`, with no trailing newline.
pub public_key: String,
}
#[cfg(test)]
mod tests {
use super::SshCa;
#[test]
fn the_ca_round_trips() {
let wire = r#"{"public_key":"ssh-ed25519 AAAA"}"#;
let value = SshCa {
public_key: "ssh-ed25519 AAAA".to_owned(),
};
assert_eq!(serde_json::to_string(&value).unwrap(), wire);
assert_eq!(serde_json::from_str::<SshCa>(wire).unwrap(), value);
}
}