mirror of
https://github.com/clearml/dropbear
synced 2025-03-09 21:41:07 +00:00
Add dbclient '-J &fd' option for a file descriptor
Based on patch by Harald Becker
This commit is contained in:
parent
802dace05e
commit
1656db9e58
15
cli-main.c
15
cli-main.c
@ -158,6 +158,21 @@ static void cli_proxy_cmd(int *sock_in, int *sock_out, pid_t *pid_out) {
|
||||
size_t ex_cmdlen;
|
||||
int ret;
|
||||
|
||||
/* File descriptor "-j &3" */
|
||||
if (*cli_opts.proxycmd == '&') {
|
||||
char *p = cli_opts.proxycmd + 1;
|
||||
int sock = strtoul(p, &p, 10);
|
||||
/* must be a single number, and not stdin/stdout/stderr */
|
||||
if (sock > 2 && sock < 1024 && *p == '\0') {
|
||||
*sock_in = sock;
|
||||
*sock_out = sock;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* Normal proxycommand */
|
||||
|
||||
/* So that spawn_command knows which shell to run */
|
||||
fill_passwd(cli_opts.own_user);
|
||||
|
||||
ex_cmdlen = strlen(cli_opts.proxycmd) + 6; /* "exec " + command + '\0' */
|
||||
|
11
dbclient.1
11
dbclient.1
@ -111,11 +111,22 @@ if 0 disables keepalives. If no response is received for 3 consecutive keepalive
|
||||
.B \-I \fIidle_timeout
|
||||
Disconnect the session if no traffic is transmitted or received for \fIidle_timeout\fR seconds.
|
||||
.TP
|
||||
|
||||
.\" TODO: how to avoid a line break between these two -J arguments?
|
||||
.B \-J \fIproxy_command
|
||||
.TP
|
||||
.B \-J \fI&fd
|
||||
.br
|
||||
Use the standard input/output of the program \fIproxy_command\fR rather than using
|
||||
a normal TCP connection. A hostname should be still be provided, as this is used for
|
||||
comparing saved hostkeys. This command will be executed as "exec proxy_command ..." with the
|
||||
default shell.
|
||||
|
||||
The second form &fd will make dbclient use the numeric file descriptor as a socket. This
|
||||
can be used for more complex tunnelling scenarios. Example usage with socat is
|
||||
|
||||
socat EXEC:'dbclient -J &38 ev',fdin=38,fdout=38 TCP4:host.example.com:22
|
||||
|
||||
.TP
|
||||
.B \-B \fIendhost:endport
|
||||
"Netcat-alike" mode, where Dropbear will connect to the given host, then create a
|
||||
|
Loading…
Reference in New Issue
Block a user