Add SSH proxy authorization probe
This commit is contained in:
parent
f7e85960f7
commit
e145bb47cd
11 changed files with 333 additions and 17 deletions
|
|
@ -710,10 +710,7 @@ fn request_for_command(command: Command) -> Result<ControlRequest> {
|
|||
DocumentCommand::Sync { node, name } => ControlRequest::DocumentSync { node, name },
|
||||
},
|
||||
Command::Ssh { command } => match command {
|
||||
SshCommand::Proxy { node } => ControlRequest::ModuleStub {
|
||||
module: "ssh-proxy".to_owned(),
|
||||
command: format!("proxy {node}"),
|
||||
},
|
||||
SshCommand::Proxy { node } => ControlRequest::SshProxyConnect { node },
|
||||
SshCommand::Cert { command } => match command {
|
||||
SshCertCommand::Request {
|
||||
public_key,
|
||||
|
|
@ -1596,6 +1593,37 @@ fn print_response(response: ControlResponse, json: bool) -> Result<()> {
|
|||
println!("reason: {reason}");
|
||||
println!("note: {note}");
|
||||
}
|
||||
ControlResponse::SshProxyConnected {
|
||||
peer_node_id,
|
||||
peer_agent_id,
|
||||
endpoint_id,
|
||||
connection,
|
||||
allowed,
|
||||
reason,
|
||||
note,
|
||||
} => {
|
||||
if allowed {
|
||||
println!("ssh proxy target: {peer_node_id}");
|
||||
if let Some(connection) = connection {
|
||||
println!("connected_at_ms: {}", connection.connected_at.0);
|
||||
if let Some(local_sshd_target) = connection.local_sshd_target {
|
||||
println!("remote_sshd_target: {local_sshd_target}");
|
||||
}
|
||||
println!(
|
||||
"admin_shell_available: {}",
|
||||
connection.admin_shell_available
|
||||
);
|
||||
println!("connection_note: {}", connection.note);
|
||||
}
|
||||
} else {
|
||||
println!("ssh proxy denied by {peer_node_id}");
|
||||
}
|
||||
println!("agent: {peer_agent_id}");
|
||||
println!("endpoint: {endpoint_id}");
|
||||
println!("allowed: {allowed}");
|
||||
println!("reason: {reason}");
|
||||
println!("note: {note}");
|
||||
}
|
||||
ControlResponse::NotImplemented { module, command } => {
|
||||
println!("{module} {command}: not implemented yet");
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue