[Bug 2336] Expose dynamic port for -R 0:... via environment

bugzilla-daemon at mindrot.org bugzilla-daemon at mindrot.org
Sun Sep 19 19:40:09 AEST 2021


https://bugzilla.mindrot.org/show_bug.cgi?id=2336

Peder Stray <peder.stray at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |peder.stray at gmail.com

--- Comment #6 from Peder Stray <peder.stray at gmail.com> ---
Had a look at the code trying to figure out if this was something i
could patch myself, but I couldn't find an easy way to get hold of the
local host and port for the RemoteForward.

Anyway, I would really like some way to get hold of the port-number in
a more programmatic way, and in most cases the initial ones set up from
the command line is fine, but just having a list of the ports in the
same order as the command line parameters is not enough, as this order
could be changed by aliases, added to by the config by RemoteForward,
and posibly other mans.

I, at least, would need to know which port mapped to which host:port on
the other side of the tunnel, so an environment variable with all the
-R (and RemoteForward) parameters in a list with the 0-ports replaced
would be a nice solution.

Some way to query the running ssh of all forwards would also be nice,
but I guess that is a bit harder to implement than the initial forwards
in a list.

Another possibility for the initial connections would be to expand the
syntax for -R to include a name (in place of the 0-port or some other
mean), and then store the allocated port (or the whole R-argument) in
an environment variable with that name.

Looking forward to seeing the 0-port feature beeing more useful for
programmatic use :)

-- 
You are receiving this mail because:
You are watching someone on the CC list of the bug.
You are watching the assignee of the bug.


More information about the openssh-bugs mailing list