I need to connect via TCP to a port that's behind a firewall, accessible through an SSH tunnel. I can achieve connection by opening a tunnel and hittting that port, but I want to build this tunneling in to my application.
我需要通过TCP连接到防火墙后面的一个端口,通过SSH通道可以访问该端口。我可以通过打开一个隧道并连接那个端口来实现连接,但是我想在我的应用程序中构建这个隧道。
Additionally, I want to be able to provide automatic login by use of having authorized keys on the server
此外,我希望能够通过使用服务器上的授权密钥来提供自动登录
This must work on the following platforms (in order of importance)
这必须在以下平台上工作(按重要性排序)
- iOS (trickiest because I can't fork an ssh tunnel like I can on other platforms)
- iOS(最棘手的原因是我不能在其他平台上使用ssh通道)
- OS X
- OS X
- Linux
- Linux
- Windows
- 窗户
What's the easy way to do this? I don't want to spend a great deal of effort obviously since this isn't the meat of my application. But I'll reuse it so I may care enough to "do things right"
最简单的方法是什么?显然,我不想花太多精力,因为这不是我的应用程序的核心。但是我会重新使用它所以我可能会很在意“做正确的事情”
4 个解决方案
#1
6
But libssh2 is BSD-licensed and appears to have the functionality needed
但是libssh2得到了bsd许可,并且似乎具有所需的功能
Looks like: libssh2_channel_direct_tcpip_ex will be the call
看起来:libssh2_channel_direct_tcpip_ex将是调用
Note that the LGPL'd libssh is a problem because on iOS apps you MUST statically link and CANNOT dynamically link to libraries. Therefore, using an LGPL'd library means my source becomes open source.
注意,LGPL的libssh是个问题,因为在iOS应用程序中,必须静态链接,不能动态链接到库。因此,使用LGPL库意味着我的源代码变成了开源的。
#2
#3
0
There is a commercial LIB if you want to have a look at, www.chilkatsoft.com/, it is a genric C++ lib for all languages, in it there is a support for SSH tunneling for IOS.
如果您想了解一下www.chilkatsoft.com/,这里有一个商业库,它是所有语言的genric c++库,其中支持IOS的SSH隧道。
#4
-1
Does the LGPL differentiate between linking dynamically and statically? I don't think so.
LGPL会动态地和静态地区分链接吗?我不这么想。
The library code (i.e. embedding your own SSH implementation) looks most versatile to me. Except the fact that you might inherit security problems.
库代码(例如嵌入自己的SSH实现)在我看来是最通用的。除了您可能继承安全问题这一事实。
On MacOSX/Linux/Unix, you can simply invoke 'ssh' and assume it exists (or make it as a precondition). On Windows, you would rely on putty and friends. I don't think that's a good idea.
在MacOSX/Linux/Unix上,您可以简单地调用“ssh”并假定它存在(或者将其作为先决条件)。在窗户上,你会依靠油灰和朋友。我不认为那是个好主意。
#1
6
But libssh2 is BSD-licensed and appears to have the functionality needed
但是libssh2得到了bsd许可,并且似乎具有所需的功能
Looks like: libssh2_channel_direct_tcpip_ex will be the call
看起来:libssh2_channel_direct_tcpip_ex将是调用
Note that the LGPL'd libssh is a problem because on iOS apps you MUST statically link and CANNOT dynamically link to libraries. Therefore, using an LGPL'd library means my source becomes open source.
注意,LGPL的libssh是个问题,因为在iOS应用程序中,必须静态链接,不能动态链接到库。因此,使用LGPL库意味着我的源代码变成了开源的。
#2
3
Libssh is a very good client implementation for SSH protocol. I have written a blog on this. There is also a sample application demonstrating the same. We use the same technique in MONyog (MySQL monitor).
Libssh是SSH协议的一个很好的客户端实现。我写了一个关于这个的博客。还有一个示例应用程序演示了相同的情况。我们在MONyog (MySQL monitor)中使用了相同的技术。
#3
0
There is a commercial LIB if you want to have a look at, www.chilkatsoft.com/, it is a genric C++ lib for all languages, in it there is a support for SSH tunneling for IOS.
如果您想了解一下www.chilkatsoft.com/,这里有一个商业库,它是所有语言的genric c++库,其中支持IOS的SSH隧道。
#4
-1
Does the LGPL differentiate between linking dynamically and statically? I don't think so.
LGPL会动态地和静态地区分链接吗?我不这么想。
The library code (i.e. embedding your own SSH implementation) looks most versatile to me. Except the fact that you might inherit security problems.
库代码(例如嵌入自己的SSH实现)在我看来是最通用的。除了您可能继承安全问题这一事实。
On MacOSX/Linux/Unix, you can simply invoke 'ssh' and assume it exists (or make it as a precondition). On Windows, you would rely on putty and friends. I don't think that's a good idea.
在MacOSX/Linux/Unix上,您可以简单地调用“ssh”并假定它存在(或者将其作为先决条件)。在窗户上,你会依靠油灰和朋友。我不认为那是个好主意。