GithubHelp home page GithubHelp logo

Comments (3)

delano avatar delano commented on July 24, 2024

I created a SOCKS5 proxy and tested Net::SSH before applying the patch and I do see the hanging issue you described.

$ ssh -D 1080 -p 22 -vvv delano@localhost "sleep 1000000"

Using this test script:

# /usr/bin/ruby -Ilib -Itest -rrubygems issue-socks5.rb
$:.unshift 'lib'
require 'net/ssh'
require 'net/ssh/proxy/socks5'
pr = Net::SSH::Proxy::SOCKS5.new( 'localhost', 1080 )
ssh = Net::SSH.start('localhost', 'delano', :proxy => pr, :verbose => :debug)
ch = ssh.open_channel
puts ssh.exec! 'ls'

However, after applying the patch it still hangs for me.

I managed to fix the hang by adding a check to ServerVersion#negotiate! to make sure the socket is readable.

46,48

 break unless socket.available_for_read?
 b = socket.recv(1)

After that the SOCKS5 proxy seemed to work fine. Would you be able to send me the steps you use to reproduce the problem you're seeing?


$ ruby -v
ruby 1.9.1p129 (2009-05-12 revision 23412) [i386-darwin9.6.0]

$ openssl version
OpenSSL 0.9.8d 28 Sep 2006

from net-ssh.

delano avatar delano commented on July 24, 2024

From Gerald:

Ok I see now, your doing everything over localhost and there is no DNS
really in the equation at all. That might explain why the SOCKS5 patch code
wasn't really doing anything for you.

So what you need to do is have a ssh session with a socks proxy where when
you connect to some other host.

So this :

ssh = Net::SSH.start('localhost', 'delano', :proxy => pr, :verbose =>
:debug)

changes to:

ssh = Net::SSH.start('someotherhost.com', 'delano', :proxy => pr, :verbose
=> :debug)

then that would exercise the code in socks5.rb and might show you the null
condition.

from net-ssh.

delano avatar delano commented on July 24, 2024

Re-added refactored fix for hanging in ServerVersion#negotiate! when using SOCKS5 proxy [Gerald Talton]. Closed by d5a6437

from net-ssh.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.