gate ssh signing per agent: ssh permission, signing policy on the login role, ca key endpoint
This commit is contained in:
parent
aeb9317ad1
commit
910f9a6f50
1 changed files with 805 additions and 57 deletions
29
swarm-controller-api/src/ssh.rs
Normal file
29
swarm-controller-api/src/ssh.rs
Normal 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);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue