From: Ricardo Amorim Date: 2010-03-12T05:14:29+09:00 Subject: Re: SOCKSSocket working? (1) It works with tsocks. I tested using irb without setting SOCKS_SERVER and worked just fine: 16:58:54 libtsocks(12207): Call to connect received on completed request 3 => #, @passive=false, .... > (2) It doesnt show up in tcpdump. Actually, it seems that Net:::FTP only creates a SOCKSSocket but doesn't use SOCKS_SERVER at all. (3) Tried setting it using export and inside the script, doesnt work either way. (4) Yep, it is using the SOCKS flag. (5) I've searched for a SOCKS5 package in debian but the only one i've found is this libsocks4. I wonder if it supports SOCKS5 as well or do i have to manually compile/install one. Anyways, i'm just testing Net::FTP as it seems as the only one that supports SOCKSSocket. I actually need to use SOCKS to do HTTP requests. Would Net::SSH::Proxy::SOCKS help me with that? Regards, mksm On Wed, Mar 10, 2010 at 8:04 AM, Brian Candler wrote: > Ricardo Amorim wrote: >> I compiled ruby-1.8.7-p249 with --enable-socks and package libsocks4 >> installed in Debian lenny. >> >> Well, i'm trying to get SOCKS working with Net::FTP. I started "ssh -N >> -D 8000 user@otherhostip" and configured SOCKS_SERVER=127.0.0.1:8000. >> When i connect to a FTP server in irb, i can see the SOCKSSocket being >> initialized (@sock=#) but looking at ssh >> debug, it's not using actually using SOCKS. >> >> Am i doing something wrong or it is not working? > > I can't answer your question directly, as I tend to use the > Net::SSH::Proxy::SOCKS[45] classes supplied with Net::SSH (which may not > be drop-in replacement in Net::FTP). However I can suggest some things > to try: > > (1) run a standard ruby build under tsocks: > >    tsocks ruby myscript.rb > > (then all socket calls are transparently socksified). Using tsocks is > also a very good way to check that your ssh -D is working how you > expect, since you can use it with any client such as 'telnet' > > (2) use 'tcpdump -i lo tcp port 8000' to see whether your ruby code is > actually trying to use the socks server > > (3) try ENV['SOCKS_SERVER'] = '127.0.0.1:8000' > > (4) in your ruby build directory, look in ext/socket/mkmf.log > > Also when the compile is running, look for -DSOCKS on the gcc command > line when building the socket extension. If it's missing then there's a > problem. > > (5) give that you're rebuilding ruby to get SOCKS support, it may be > worth trying a socks5 library. socks4 is very ancient and it wouldn't > surprise me if it hadn't been well tested in a while. > -- > Posted via http://www.ruby-forum.com/. > >