Add authorized Unix pipe forwarding
This commit is contained in:
parent
6bc2666993
commit
3d0da22eae
8 changed files with 491 additions and 16 deletions
|
|
@ -407,6 +407,16 @@ pub enum PipeCommand {
|
|||
#[arg(long)]
|
||||
bearer_secret: Option<String>,
|
||||
},
|
||||
ForwardUnix {
|
||||
#[arg(long)]
|
||||
listen: PathBuf,
|
||||
#[arg(long)]
|
||||
node: String,
|
||||
#[arg(long)]
|
||||
target: PathBuf,
|
||||
#[arg(long)]
|
||||
bearer_secret: Option<String>,
|
||||
},
|
||||
Send {
|
||||
target: String,
|
||||
message: Option<String>,
|
||||
|
|
@ -635,6 +645,24 @@ pub async fn run() -> Result<()> {
|
|||
.await
|
||||
.context("run TCP forward through geth daemon")?;
|
||||
}
|
||||
Command::Pipe {
|
||||
command:
|
||||
PipeCommand::ForwardUnix {
|
||||
listen,
|
||||
node,
|
||||
target,
|
||||
bearer_secret,
|
||||
},
|
||||
} if !cli.json && !cli.jsonl => {
|
||||
println!(
|
||||
"forwarding unix {} -> {node}:{}",
|
||||
listen.display(),
|
||||
target.display()
|
||||
);
|
||||
geth_node::run_unix_forward(&paths, listen, node, target, bearer_secret)
|
||||
.await
|
||||
.context("run Unix socket forward through geth daemon")?;
|
||||
}
|
||||
command => {
|
||||
let request = request_for_command(command)?;
|
||||
let response = geth_node::send_control(&paths, request)
|
||||
|
|
@ -926,6 +954,17 @@ fn request_for_command(command: Command) -> Result<ControlRequest> {
|
|||
target_addr: target,
|
||||
bearer_secret,
|
||||
},
|
||||
PipeCommand::ForwardUnix {
|
||||
listen,
|
||||
node,
|
||||
target,
|
||||
bearer_secret,
|
||||
} => ControlRequest::PipeUnixForward {
|
||||
listen_path: listen,
|
||||
node,
|
||||
target_path: target,
|
||||
bearer_secret,
|
||||
},
|
||||
PipeCommand::Send {
|
||||
target,
|
||||
message,
|
||||
|
|
|
|||
Loading…
Reference in a new issue