You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by Kevin Winchester <ke...@anywaregroup.com> on 2012/10/12 13:53:26 UTC
SSHD: TCP/IP Port Forwarding Feature Request
Hi,
I have an application under development that uses SSHD TCP/IP Port
Forwarding for the client and server sides of a communication interface.
I have need of two features that I do not believe are possible
currently in the SSHD client:
1. At times, I would like to forward the same port on different local
addresses. The current TcpipForwardSupport class tracks the forwards by
port number, ignoring the local address, making this impossible. As of
my contribution in SSHD-192, I can replace TcpipForwardSupport with my
own factory-injected class. I plan to do this, but I thought I would
offer to add this functionality to the standard TcpipForwardSupport if
that is something that would be received favorably.
2. At other times in my application, I do not really care what local
port is used for forwarding. The InetSocketAddress class documentation
states that one can specify 0 as the port number to request this
functionality when binding. I am not sure if this will work through
SSHD/MINA. And if it does work, the trouble would be finding out what
local port was bound, since I would need to connect to it. Is there any
way to do this currently? What about if a new method were added to the
ClientSession interface, something like:
int startLocalPortForwarding(String localHostname, SshdSocketAddress
remote);
that would return the port number bound. Looking at the code, I guess
it might require a Future of some sort since the binding is likely not
done immediately, but that conveys the general idea.
As with my previous questions, I am happy to contribute in any way I can
to the development of these features. I would only request an
indication that these features would be acceptable, as well as some
guidance as to the preferred approach for achieving the requested
functionality.
Thanks,
Kevin
Re: SSHD: TCP/IP Port Forwarding Feature Request
Posted by Guillaume Nodet <gn...@gmail.com>.
On Fri, Oct 12, 2012 at 1:53 PM, Kevin Winchester <
kevin.winchester@anywaregroup.com> wrote:
> Hi,
>
> I have an application under development that uses SSHD TCP/IP Port
> Forwarding for the client and server sides of a communication interface. I
> have need of two features that I do not believe are possible currently in
> the SSHD client:
>
> 1. At times, I would like to forward the same port on different local
> addresses. The current TcpipForwardSupport class tracks the forwards by
> port number, ignoring the local address, making this impossible. As of my
> contribution in SSHD-192, I can replace TcpipForwardSupport with my own
> factory-injected class. I plan to do this, but I thought I would offer to
> add this functionality to the standard TcpipForwardSupport if that is
> something that would be received favorably.
>
Well, you can always create a patch and attach your patch if you already
have it. Worst case, it won't be applied ;-)
Though, I'm not sure to understand what you mean by "forwarding the same
port on different local addresses" ...
>
> 2. At other times in my application, I do not really care what local port
> is used for forwarding. The InetSocketAddress class documentation states
> that one can specify 0 as the port number to request this functionality
> when binding. I am not sure if this will work through SSHD/MINA. And if
> it does work, the trouble would be finding out what local port was bound,
> since I would need to connect to it. Is there any way to do this
> currently? What about if a new method were added to the ClientSession
> interface, something like:
>
> int startLocalPortForwarding(**String localHostname, SshdSocketAddress
> remote);
>
> that would return the port number bound. Looking at the code, I guess it
> might require a Future of some sort since the binding is likely not done
> immediately, but that conveys the general idea.
>
There's a really easy workaround though. You can open a server socket,
check the bound port, close the socket and use the port when calling sshd.
But yeah, I suppose we should enhance sshd to support that use case.
>
> As with my previous questions, I am happy to contribute in any way I can
> to the development of these features. I would only request an indication
> that these features would be acceptable, as well as some guidance as to the
> preferred approach for achieving the requested functionality.
>
> Thanks,
> Kevin
>
--
------------------------
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/
------------------------
FuseSource, Integration everywhere
http://fusesource.com
Re: SSHD: TCP/IP Port Forwarding Feature Request
Posted by Guillaume Nodet <gn...@gmail.com>.
On Fri, Oct 12, 2012 at 1:53 PM, Kevin Winchester <
kevin.winchester@anywaregroup.com> wrote:
> Hi,
>
> I have an application under development that uses SSHD TCP/IP Port
> Forwarding for the client and server sides of a communication interface. I
> have need of two features that I do not believe are possible currently in
> the SSHD client:
>
> 1. At times, I would like to forward the same port on different local
> addresses. The current TcpipForwardSupport class tracks the forwards by
> port number, ignoring the local address, making this impossible. As of my
> contribution in SSHD-192, I can replace TcpipForwardSupport with my own
> factory-injected class. I plan to do this, but I thought I would offer to
> add this functionality to the standard TcpipForwardSupport if that is
> something that would be received favorably.
>
Well, you can always create a patch and attach your patch if you already
have it. Worst case, it won't be applied ;-)
Though, I'm not sure to understand what you mean by "forwarding the same
port on different local addresses" ...
>
> 2. At other times in my application, I do not really care what local port
> is used for forwarding. The InetSocketAddress class documentation states
> that one can specify 0 as the port number to request this functionality
> when binding. I am not sure if this will work through SSHD/MINA. And if
> it does work, the trouble would be finding out what local port was bound,
> since I would need to connect to it. Is there any way to do this
> currently? What about if a new method were added to the ClientSession
> interface, something like:
>
> int startLocalPortForwarding(**String localHostname, SshdSocketAddress
> remote);
>
> that would return the port number bound. Looking at the code, I guess it
> might require a Future of some sort since the binding is likely not done
> immediately, but that conveys the general idea.
>
There's a really easy workaround though. You can open a server socket,
check the bound port, close the socket and use the port when calling sshd.
But yeah, I suppose we should enhance sshd to support that use case.
>
> As with my previous questions, I am happy to contribute in any way I can
> to the development of these features. I would only request an indication
> that these features would be acceptable, as well as some guidance as to the
> preferred approach for achieving the requested functionality.
>
> Thanks,
> Kevin
>
--
------------------------
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/
------------------------
FuseSource, Integration everywhere
http://fusesource.com