开发者

Dynamic SSH tunnel using ruby

I would like to transform this unix command into a ruby script

ssh -2 -f -c blowfish -N -C user@ip -D 8080

This is to enable all my web traffic to be encrypted in a ssh tunnel.

I tried with net-ssh library without success.

EDIT:

Here is what I tried :

 Net::SSH.start("my-ssh-server", "login") do|ssh|
   ssh.forward.local(8080, "localho开发者_JS百科st", 80)
   puts "Connected !"
   ssh.loop(0) { true }
 end

Here is the documentation of Net:SSH http://net-ssh.rubyforge.org/ssh/v1/chapter-6.html#s4 I think, I should use Direct Channels instead of Local-to-Remote. But the method session.forward.direct_channel is not implemented.

Thanks for your answers !


Stupid and simple:

fork("ssh -2 -f -c blowfish -N -C user@ip -D 8080")

Why not that way?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜