Hello Matt. Matt Johnston <m...@ucc.asn.au> wrote: |> On Wed 28/2/2018, at 12:59 am, Steffen Nurpmeso <stef...@sdaoden.eu> \ |> wrote: |> And yes, i am still using such grumpy networks with VMs, so please |> let me post the "git am" mailbox that adds support for proxy-over- |> localhost. ... |Thanks for the patch, though I'm not sure it's worth adding this as \ |a special case - can't the same thing be |achieved with dbclient -J "nc localhost port" ?
Yes i think so, but this requires context switching or at least quite some I/O that is useless. Some boxes also do not have nc(1) by default. And all that just because of a little name switch (that is impossible without this patch). |Adding proxycommand as a -o option might be worthwhile though, so it \ |can pass to scp. ok?? Ok, so how about "-o ProxyLocalhost=PORT"? Find that attached at your will. Ciao, --steffen | |Der Kragenbaer, The moon bear, |der holt sich munter he cheerfully and one by one |einen nach dem anderen runter wa.ks himself off |(By Robert Gernhardt)
From b843dd88dac28007410e224d53d66b0599e0e86d Mon Sep 17 00:00:00 2001 Message-Id: <b843dd88dac28007410e224d53d66b0599e0e86d.1519938759.git.stef...@sdaoden.eu> From: Steffen Nurpmeso <stef...@sdaoden.eu> Date: Thu, 1 Mar 2018 22:11:45 +0100 Subject: [PATCH] Add -o ProxyLocalhost=PORT --- cli-main.c | 6 ++++-- cli-runopts.c | 12 ++++++++++++ dbclient.1 | 9 ++++++++- runopts.h | 1 + 4 files changed, 25 insertions(+), 3 deletions(-) diff --git a/cli-main.c b/cli-main.c index 713cb09..bf75fd8 100644 --- a/cli-main.c +++ b/cli-main.c @@ -86,8 +86,10 @@ int main(int argc, char ** argv) { } else #endif { - progress = connect_remote(cli_opts.remotehost, cli_opts.remoteport, - cli_connected, &ses, cli_opts.bind_address, cli_opts.bind_port); + progress = connect_remote((cli_opts.proxy_over_localhost + ? "localhost" : cli_opts.remotehost), + cli_opts.remoteport, cli_connected, &ses, + cli_opts.bind_address, cli_opts.bind_port); sock_in = sock_out = -1; } diff --git a/cli-runopts.c b/cli-runopts.c index abcfc9f..f5d1f37 100644 --- a/cli-runopts.c +++ b/cli-runopts.c @@ -138,6 +138,7 @@ void cli_getopts(int argc, char ** argv) { cli_opts.progname = argv[0]; cli_opts.remotehost = NULL; cli_opts.remoteport = NULL; + cli_opts.proxy_over_localhost = 0; cli_opts.username = NULL; cli_opts.cmd = NULL; cli_opts.no_cmd = 0; @@ -681,6 +682,9 @@ static void parse_hostname(const char* orighostarg) { port = strchr(cli_opts.remotehost, '/'); } if (port) { + if (cli_opts.proxy_over_localhost) + dropbear_exit("-o ProxyLocalhost mutually " + "exclusive with ^port"); *port = '\0'; cli_opts.remoteport = port+1; } @@ -891,6 +895,7 @@ static void add_extendedopt(const char* origstr) { #ifndef DISABLE_SYSLOG "\tUseSyslog\n" #endif + "\tProxyLocalhost\n" ); exit(EXIT_SUCCESS); } @@ -909,5 +914,12 @@ static void add_extendedopt(const char* origstr) { } #endif + if (match_extendedopt(&optstr, "ProxyLocalhost") == DROPBEAR_SUCCESS) { + /* No port validity check until use */ + cli_opts.proxy_over_localhost = 1; + cli_opts.remoteport = (/* unconst */char*)optstr; + return; + } + dropbear_log(LOG_WARNING, "Ignoring unknown configuration option '%s'", origstr); } diff --git a/dbclient.1 b/dbclient.1 index 1516e7c..597f20f 100644 --- a/dbclient.1 +++ b/dbclient.1 @@ -149,10 +149,17 @@ The following options have currently been implemented: .RS .TP .B ExitOnForwardFailure -Specifies whether dbclient should terminate the connection if it cannot set up all requested local and remote port forwardings. The argument must be “yes” or “no”. The default is “no”. +Specifies whether dbclient should terminate the connection if it cannot +set up all requested local and remote port forwardings. +The argument must be "yes" or "no". +The default is "no". .TP .B UseSyslog Send dbclient log messages to syslog in addition to stderr. +.TP +.B ProxyLocalhost +Connect to the given port on localhost, +but keep on using the given hostname for key comparison purposes. .RE .TP .B \-s diff --git a/runopts.h b/runopts.h index 3123383..cb00350 100644 --- a/runopts.h +++ b/runopts.h @@ -145,6 +145,7 @@ typedef struct cli_runopts { int wantpty; int always_accept_key; int no_hostkey_check; + int proxy_over_localhost; int no_cmd; int backgrounded; int is_subsystem; -- 2.16.2