Bugzilla – Attachment 2864 Details for
Bug 2607
accept location off ssh binary via environment variable or deduce it from /proc/
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
use /proc/self/exe or environment variable to launch port forwarding for ProxyJump
0001-add-environment-variable-SSH_CUSTOM_CMD-for-ProxyJum.patch (text/plain), 3.00 KB, created by
Stefan Tomanek
on 2016-08-23 06:06:01 AEST
(
hide
)
Description:
use /proc/self/exe or environment variable to launch port forwarding for ProxyJump
Filename:
MIME Type:
Creator:
Stefan Tomanek
Created:
2016-08-23 06:06:01 AEST
Size:
3.00 KB
patch
obsolete
>From 2795acae5b6191c7509878162897c177937ea5fa Mon Sep 17 00:00:00 2001 >From: Stefan Tomanek <stefan.tomanek@wertarbyte.de> >Date: Sun, 21 Aug 2016 17:04:22 +0200 >Subject: [PATCH] add environment variable SSH_CUSTOM_CMD for ProxyJump > >This change makes the ProxyJump functionality read the environment variable >SSH_CUSTOM_CMD to construct the proxy command line; this makes it possible to >specify the path to a custom ssh binary as well as add extra flags. Even if the >variable is unspecified or empty, the ssh binary used to establish the >conection is not necessarily the one found first in $PATH; this patch uses the >file /proc/self/exe available on many platforms to identify the binary of the >already running process to launch a ProxyJump forwarding. > >If these two approaches fail, it falls back to the existing behaviour of just >assuming "ssh" as command. >--- > configure.ac | 8 ++++++++ > ssh.1 | 5 +++++ > ssh.c | 17 ++++++++++++++++- > 3 files changed, 29 insertions(+), 1 deletion(-) > >diff --git a/configure.ac b/configure.ac >index a3c22c1..fbd54e8 100644 >--- a/configure.ac >+++ b/configure.ac >@@ -1448,6 +1448,14 @@ else > AC_MSG_RESULT([no]) > fi > >+AC_MSG_CHECKING([for /proc/self/exe link]) >+if test -L "/proc/self/exe" ; then >+ AC_DEFINE([HAVE_PROC_SELF_EXE], [1], [Define if you have /proc/self/exe]) >+ AC_MSG_RESULT([yes]) >+else >+ AC_MSG_RESULT([no]) >+fi >+ > # Check whether user wants S/Key support > SKEY_MSG="no" > AC_ARG_WITH([skey], >diff --git a/ssh.1 b/ssh.1 >index 4011c65..6fe1582 100644 >--- a/ssh.1 >+++ b/ssh.1 >@@ -330,6 +330,11 @@ Multiple jump hops may be specified separated by comma characters. > This is a shortcut to specify a > .Cm ProxyJump > configuration directive. >+When constructing the proxy command lines, the environment variable >+.Ev SSH_CUSTOM_CMD >+can be used to specify the >+.Nm >+binary to use. > .Pp > .It Fl K > Enables GSSAPI-based authentication and forwarding (delegation) of GSSAPI >diff --git a/ssh.c b/ssh.c >index 03a23fb..c97f230 100644 >--- a/ssh.c >+++ b/ssh.c >@@ -1096,6 +1096,20 @@ main(int ac, char **av) > */ > if (options.jump_host != NULL) { > char port_s[8]; >+#ifdef HAVE_PROC_SELF_EXE >+ char ssh_path[PATH_MAX]; >+#endif >+ char *ssh_cmd = getenv("SSH_CUSTOM_CMD"); >+ if (ssh_cmd && ssh_cmd[0] != '\0') { >+ debug("Using custom SSH command: '%s'", ssh_cmd); >+#ifdef HAVE_PROC_SELF_EXE >+ } else if (readlink("/proc/self/exe", ssh_path, PATH_MAX) != -1) { >+ debug("Located own ssh binary: '%s'", ssh_path); >+ ssh_cmd = ssh_path; >+#endif >+ } else { >+ ssh_cmd = "ssh"; >+ } > > /* Consistency check */ > if (options.proxy_command != NULL) >@@ -1104,7 +1118,8 @@ main(int ac, char **av) > options.proxy_use_fdpass = 0; > snprintf(port_s, sizeof(port_s), "%d", options.jump_port); > xasprintf(&options.proxy_command, >- "ssh%s%s%s%s%s%s%s%s%s%.*s -W %%h:%%p %s", >+ "%s%s%s%s%s%s%s%s%s%s%.*s -W %%h:%%p %s", >+ ssh_cmd, > /* Optional "-l user" argument if jump_user set */ > options.jump_user == NULL ? "" : " -l ", > options.jump_user == NULL ? "" : options.jump_user, >-- >2.1.4 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 2607
: 2864