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=#<SOCKSSocket:0x0000000248aca0>) 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/.