开发者

How to debug a ssh tunnel

开发者 https://www.devze.com 2023-02-10 21:45 出处:网络
I want to setup a simple ssh tunnel from a local machine to a machine on the internet. I\'m using ssh -D 8080 -f -C -q -N -p 12122 <username>@<hostname>

I want to setup a simple ssh tunnel from a local machine to a machine on the internet. I'm using

ssh -D 8080 -f -C -q -N -p 12122 <username>@<hostname>

Setup works fine (I think) cause ssh returs asking for the credentials, which I provide.

Then i do

export http_proxy=http://localhost:8080 and wget http://www.google.com

Wget returns that the request has been sent to the proxy, b开发者_JAVA技巧ut no data is received back. What i need is a way to look at how ssh is processing the request....


To get more information out of your SSH connection for debugging, leave out the -q and -f options, and include -vvv:

ssh -D 8080 -vvv -N -p 12122 <username>@<hostname>

To address your actual problem, by using ssh -D you're essentially setting up a SOCKS proxy which I believe is not supported by default in wget.

You might have better luck with curl which provides SOCKS suport via the --socks option.

If you really really need to use wget, you'll have to recompile your own version to include socks support. There should be an option for ./configure somewhere along the lines of --with-socks.

Alternatively, look into tsock which can intercept outgoing network connections and redirecting them through a SOCKS server.

0

精彩评论

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