Results 1 to 5 of 5

Thread: Inconsistent results when using SSH for local port forwarding

  1. #1
    Join Date
    May 2013
    Beans
    6

    Inconsistent results when using SSH for local port forwarding

    Hi,

    I'm trying to test my understanding of port forwarding and there's an issue that currently has me stumped. I've installed the OpenSSH client and daemon on my local machine and I'd like to try routing my HTTP and HTTPS traffic through a tunnel. I connect to my own machine via SSH as follows:
    Code:
    ssh -L 8080:www.google.com:80 vince@sokrates
    . That way, when I go to localhost:8080 I end up at Google. I guess it's not fool-proof yet because my browser indicates that HTTPS is used here and I'm not doing anything with port 443 yet, but I digress... The problem is that this approach doesn't work for every website. For instance, if I try www.ubuntuforums.org, I get redirected to canonical.com. And if I try ubuntu.com, I get an error page. So clearly, I'm missing some of the finer details.

    Does anyone know what could cause this lack of transparency?

    Thanks!

    V.

  2. #2
    Join Date
    Jul 2005
    Beans
    2,050

    Re: Inconsistent results when using SSH for local port forwarding

    ~
    Last edited by ahallubuntu; June 24th, 2013 at 09:56 PM.

  3. #3
    Join Date
    Feb 2009
    Location
    Dallas, TX
    Beans
    6,895
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: Inconsistent results when using SSH for local port forwarding

    Hi VforVincent.

    The usual way to tunnelling all browser traffic is by using both a dynamic application-level port forwarding (option -D), and the browser capabilities to proxy its traffic.

    First, create the tunnel:
    Code:
    ssh -D8080 vince@sokrates
    Then, in Firefox:
    Code:
    Preferences -> Advanced -> Network -> Connection Settings
    there, set a manual proxy configuration:
    Code:
    Socks: 127.0.0.1      Port: 8080
    That should do it. Browse normally.

    Let us know how it goes.
    Regards.

  4. #4
    Join Date
    May 2013
    Beans
    6

    Re: Inconsistent results when using SSH for local port forwarding

    I'm trying to figure out how port forwarding works by going over a few use cases. Right now, I'm trying to simulate a setup where I'd like to do some secure browsing through a remote machine. I don't have the infrastructure available to really set this up (no public IP where I can set up an SSH server), so I'm running everything locally. Normally, you'd have a tunnel from my machine which is an SSH client (e.g. at work) to an SSH server (e.g. my machine at home) and I'd like to browse on the client without anyone being able to monitor my traffic. I know this sort of setup could get you in trouble if it violates security policies, but I have no plans to do anything of the sort.

  5. #5
    Join Date
    May 2013
    Beans
    6

    Re: Inconsistent results when using SSH for local port forwarding

    Hi Papibe,

    Looks like that did the trick. I hadn't come across dynamic port forwarding before yet. I'm a bit surprised that it's the recommended solution to this kind of problem, given that it doesn't get the same coverage local and remote forwarding get, but I'll read up on it to see what makes it more appropriate. Thanks!

    V.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •