[PATCH] Expose remote forwarding ports as environment variable
Darren Tucker
dtucker at zip.com.au
Thu May 16 16:16:01 EST 2013
On Wed, May 15, 2013 at 11:45:23PM +0200, Nico Schottelius wrote:
> Good evening gentlemen,
>
> the attached patch against openssh 6.2p1 exposes remote
> forwarding ports to the remote shell:
That's not going to be entirely accurate because the environment is
inherited at the time the shell is started, but port forwards can be
added and deleted at any time (either via escape sequences or the
control socket).
Taking the example from your web page, you can already do what you want
via the control socket:
$ ssh -Nf -MS/tmp/ctl localhost
$ p=`ssh -S/tmp/ctl -O forward -R 0:127.0.0.1:22 localhost`
Allocated port 24647 for remote forward to 127.0.0.1:22
$ ssh -S/tmp/ctl localhost "echo do something with port $p"
do something with port 24647
$ ssh -S/tmp/ctl -O exit localhost
--
Darren Tucker (dtucker at zip.com.au)
GPG key 8FF4FA69 / D9A3 86E9 7EEE AF4B B2D4 37C9 C982 80C7 8FF4 FA69
Good judgement comes with experience. Unfortunately, the experience
usually comes from bad judgement.
More information about the openssh-unix-dev
mailing list