sshssh-tunnelhttp-tunneling

How to do HTTP Tunneling over SSH for specific URLs on Chrome?


I connect to my university server via ssh using the following command:

ssh myid@cs.bu.edu

Another server, hidden.bu.edu is firewalled in cs.bu.edu. To access hidden.bu.edu, I have added the following lines in my ~/.ssh/config in my home laptop.

Host hidden.bu.edu
    ProxyCommand ssh myid@cs.bu.edu -W %h:%p

Now I can just do ssh myid@hidden.bu.edu to log into hidden.bu.edu from my home laptop.

Now I have another HTTP hidden server webhidden.bu.edu which is only accessible from inside cs.bu.edu. I can use a VPN to access webhidden.bu.edu in Google Chrome, but I do not want to use any VPN software. Is it possible to tunnel webhidden.bu.edu in Google Chrome through cs.bu.edu over ssh, just like I use a proxy for ssh-ing hidden.bu.edu.

I know HTTP Tunneling might work, but I want to just enter webhidden.bu.edu in Google chrome and it should tunnel over my ssh config. This is also what happens in case of git server, just by adding the above lines in ~/.ssh/config. Is there something possible for HTTP requests?


Solution

  • In my ~/.ssh/config I create a proxy:

    Host buproxy
      HostName csa3.bu.edu
      User soham1 
      IdentityFile ~/.ssh/id_rsa
      DynamicForward 9500
      ControlMaster auto
      ControlPath ~/.ssh/sockets/%r@%h:%p
    

    I add the following for a proxy command on my shell:

    alias proxy-on='/usr/bin/ssh -fN buproxy'
    alias proxy-check='/usr/bin/ssh -O check my-proxy'
    

    Then I use proxy-on command on a shell terminal to turn on the proxy.

    After that, I use SwitchyOmega Google Chrome Extension to set up a SOCKS5 localhost:9500 proxy to browse any webpages via this ssh-proxy. I setup wildcard characters in SwitcyOmega to autoswitch particular websites such as *.acm.org, *.ieee.org.