Add authorized TCP pipe forwarding

This commit is contained in:
Eric Wendland 2026-05-21 01:12:01 +02:00
commit 6bc2666993
8 changed files with 645 additions and 81 deletions

View file

@ -397,6 +397,16 @@ pub enum PipeCommand {
#[arg(long)]
bearer_secret: Option<String>,
},
ForwardTcp {
#[arg(long)]
listen: String,
#[arg(long)]
node: String,
#[arg(long)]
target: String,
#[arg(long)]
bearer_secret: Option<String>,
},
Send {
target: String,
message: Option<String>,
@ -611,6 +621,20 @@ pub async fn run() -> Result<()> {
.await
.context("stream SSH proxy through geth daemon")?;
}
Command::Pipe {
command:
PipeCommand::ForwardTcp {
listen,
node,
target,
bearer_secret,
},
} if !cli.json && !cli.jsonl => {
println!("forwarding tcp {listen} -> {node}:{target}");
geth_node::run_tcp_forward(&paths, listen, node, target, bearer_secret)
.await
.context("run TCP forward through geth daemon")?;
}
command => {
let request = request_for_command(command)?;
let response = geth_node::send_control(&paths, request)
@ -891,6 +915,17 @@ fn request_for_command(command: Command) -> Result<ControlRequest> {
node,
bearer_secret,
},
PipeCommand::ForwardTcp {
listen,
node,
target,
bearer_secret,
} => ControlRequest::PipeTcpForward {
listen_addr: listen,
node,
target_addr: target,
bearer_secret,
},
PipeCommand::Send {
target,
message,