Import SSH revocation metadata
This commit is contained in:
parent
b9e7c61e67
commit
4c368253e4
11 changed files with 212 additions and 13 deletions
|
|
@ -22,6 +22,7 @@ geth-control = { path = "../geth-control" }
|
|||
geth-discovery = { path = "../geth-discovery" }
|
||||
geth-iroh = { path = "../geth-iroh" }
|
||||
geth-node = { path = "../geth-node" }
|
||||
geth-ssh-identity = { path = "../geth-ssh-identity" }
|
||||
geth-store = { path = "../geth-store" }
|
||||
geth-types = { path = "../geth-types" }
|
||||
rusqlite.workspace = true
|
||||
|
|
|
|||
|
|
@ -1365,10 +1365,53 @@ fn ssh_cert_request_approval_and_revocation_export_use_local_state() {
|
|||
other => panic!("unexpected response: {other:?}"),
|
||||
}
|
||||
assert!(
|
||||
std::fs::read_to_string(krl_spec_path)
|
||||
std::fs::read_to_string(&krl_spec_path)
|
||||
.expect("read krl spec")
|
||||
.contains("key: ssh:blake3:test")
|
||||
);
|
||||
|
||||
let import_home = tempfile::tempdir().expect("import tempdir");
|
||||
let import_paths = geth_config::GethPaths::from_home(import_home.path());
|
||||
let import_node = geth_node::init_node(&import_paths).expect("init import node");
|
||||
let response = geth_node::handle_request(
|
||||
&import_node,
|
||||
geth_control::ControlRequest::SshRevocationImport {
|
||||
path: krl_spec_path,
|
||||
format: "openssh-krl-spec".to_owned(),
|
||||
},
|
||||
)
|
||||
.expect("import krl spec");
|
||||
match response {
|
||||
geth_control::ControlResponse::SshRevocationImported {
|
||||
count,
|
||||
revocations,
|
||||
note,
|
||||
..
|
||||
} => {
|
||||
assert_eq!(count, 1);
|
||||
assert_eq!(
|
||||
revocations[0].kind,
|
||||
geth_ssh_identity::SshRevocationKind::PublicKey
|
||||
);
|
||||
assert!(note.contains("binary OpenSSH KRL files cannot be enumerated"));
|
||||
}
|
||||
other => panic!("unexpected response: {other:?}"),
|
||||
}
|
||||
|
||||
let response = geth_node::handle_request(
|
||||
&import_node,
|
||||
geth_control::ControlRequest::SshRevocationImport {
|
||||
path: home.path().join("revocations.jsonl"),
|
||||
format: "jsonl".to_owned(),
|
||||
},
|
||||
)
|
||||
.expect("import jsonl revocations");
|
||||
match response {
|
||||
geth_control::ControlResponse::SshRevocationImported { count, .. } => {
|
||||
assert_eq!(count, 1);
|
||||
}
|
||||
other => panic!("unexpected response: {other:?}"),
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
|||
Loading…
Reference in a new issue