How to tunnel HTTP over SSH via SOCKS in Firefox

2

1

I`ve got SSH installed on my home laptop and it works fine. I set up the tunnel:

$ ssh -p 443 -C2TNv -D 8080 me@me.no-ip.org

Firefox settings:

manual config:
SOCKS; port 8080
V5

about:config:

network.proxy.socks_remote_dns: true

Terminal output:

OpenSSH_5.9p1, OpenSSL 0.9.8t 18 Jan 2012
debug1: Reading configuration data /etc/ssh_config
debug1: Connecting to me.no-ip.org [] port 443.
debug1: Connection established.
debug1: identity file /home/me/.ssh/id_rsa type -1
debug1: identity file /home/me/.ssh/id_rsa-cert type -1
debug1: identity file /home/me/.ssh/id_dsa type -1
debug1: identity file /home/me/.ssh/id_dsa-cert type -1
debug1: identity file /home/me/.ssh/id_ecdsa type -1
debug1: identity file /home/me/.ssh/id_ecdsa-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.9
debug1: match: OpenSSH_5.9 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.9
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 zlib@openssh.com
debug1: kex: client->server aes128-ctr hmac-md5 zlib@openssh.com
debug1: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: <removed>
debug1: Host '[me.no-ip.org]:443' is known and matches the host key.
debug1: Found key in /home/me/.ssh/known_hosts:2
debug1: ssh_ecdsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Next authentication method: publickey
debug1: Trying private key: /home/me/.ssh/id_rsa
debug1: Trying private key: /home/me/.ssh/id_dsa
debug1: Trying private key: /home/me/.ssh/id_ecdsa
debug1: Next authentication method: keyboard-interactive
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Next authentication method: password
me@me.no-ip.org's password:
debug1: Enabling compression at level 6.
debug1: Authentication succeeded (password).
Authenticated to me.no-ip.org ([removed]:443).
debug1: Local connections to LOCALHOST:8080 forwarded to remote address socks:0
debug1: Local forwarding listening on ::1 port 8080.
debug1: channel 0: new [port listener]
debug1: Local forwarding listening on 127.0.0.1 port 8080.
debug1: channel 1: new [port listener]
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.

Then visiting any website displays: "The proxy server is not accepting connections"

Please advise.

Tom

Posted 2012-05-07T09:46:39.317

Reputation: 61

Answers

4

I had to change the tunnel settings from within Putty. I had to check the bubbles Dynamic and IPv4; works fine now.

Tom

Posted 2012-05-07T09:46:39.317

Reputation: 61

1

You need a running sshd at the remote end, and you need to ssh to it, not the web server.

$ ssh -C2TNv -D8080 me@me.no-ip.org

The actual host and port to connect to is specified by the browser as part of each SOCKS request.

when you set up a SOCKS tunnel with ssh -D, this is what happens:

  • your app (the browser in this case) connects to the local socks port you have designated.
  • the local running ssh program acts as the SOCKS server, and gets the requested host and port from the browser.
  • the local ssh requests the remote sshd, running on the host you specified (me.no-ip.org in your case), to open a connection to the requested host and port.
  • the local ssh and remote sshd set up a tunnel between them to forward traffic between the local connection made by the browser and the remote connection made by the sshd. This is the tunnel.

Michael Slade

Posted 2012-05-07T09:46:39.317

Reputation: 139

Hi Michael. Thank you for your answer, but Im not sure I follow... Ive already got a sshd at the remote end and I managed to ssh to it. And then I`ve set-up the SOCKS tunnel with ssh -D, but "the proxy server is refusing connections" when I try to browse from my other laptop. Not sure what to do. Thank you for your time. – Tom – 2012-05-07T15:59:48.387

Uhm..when I try to ssh localhost I get: ssh: connect to host localhost port 22: Connection refused. sshd is up and running, any idea why am I getting connection refused? – Tom – 2012-05-07T17:27:28.010

how do you know it is running? – Michael Slade – 2012-05-07T17:41:57.557

I know it`s running becaus: $ net start sshd The requested service has already been started. After restarting the service I was able to ssh localhost, but still getting "proxy server not accepting connections" when trying to browse from my other laptop. – Tom – 2012-05-07T18:28:43.520

Finally.. I had to change to tunnel settings from within Putty. I had to check the bubbles Dynamic and IPv4; works fine now. Thanks for looking into this. All the best. – Tom – 2012-05-07T20:43:57.863