Determining the port assigned by -R 0
glenn at zewt.org
Mon Oct 24 01:05:38 EST 2011
On Fri, Oct 14, 2011 at 7:13 PM, Damien Miller <djm at mindrot.org> wrote:
> It's easier if you use the multiplexing socket.
> ssh -O forward -R0:xxx:yyy host
> will print the allocated port to stdout on success.
I suppose that works, but it'd be better to do this server-side. That way,
the script run on the server doesn't have to trust the client to pass along
correct information. For example, if a client tries forwarding thousands of
ports, the script could reliably detect that and close the connection.
(This is a remote diagnostics script; the remote client is untrusted.)
By the way, it'd be helpful to be able to specify eg. "PermitOpen none"; I
ended up arriving at the same hack that this guy used:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=543683. It's minor, but
it'd be nice to be able to do this correctly.
More information about the openssh-unix-dev