Main menu

Use SSH Tunnelling on Chrome OS

To download these tutorials for OFFLINE viewing or for archive purposes please (Click here to download)
(Clicking the “.zip” will open the Archive, un-zip the .mht files then use one of the plugins below to view them)

You can open .mht WebArchive files directly inside FireFox Or Google Chrome by installing a plugin

Chromebooks offer built-in support for SSH tunnelling with their included crosh shell and SSH command. An SSH tunnel allows you to use an SSH connection like a VPN or encrypted proxy, sending your browsing traffic through the secure tunnel.

This allows you to encrypt traffic when browsing on a public network, access geo-blocked content, or even tunnel your way around Internet censorship like the Great Firewall of China.

Step 1: Open the SSH Tunnel

When setting up SSH tunnelling on any operating system, there are two steps. First, you’ll need to establish a connection to the SSH server and open a tunnel.

To do this, open the crosh shell by pressing Ctrl+Alt+T anywhere in Chrome OS. The shell will open in a browser tab.

Next, use the appropriate ssh command to connect to an SSH server and establish a tunnel. You’ll do this by running the ssh command and then by typing every option on its own line, like so:

dynamic-forward [port number] (Enter a local port number for the ssh forwarding — for example, dynamic-forward 8800.)

key [key file name] (Enter a key file name if you need a key to connect to the SSH server and not just a password. Omit this line if the SSH server doesn’t require a key.)

connect

After you run the connect command, you’ll be prompted to enter the password to authenticate with the server or to unlock your key file.

You may also use Google’s official Secure Shell app for this. Launch the extension and enter the SSH server’s details in the sign-in window. In the arguments box, enter -D 8800 or another port number of your choice.

Step 2: Have Chrome OS Use the Tunnel

The tunnel is now open, but your Chromebook won’t automatically use it.You’ll need to specify the tunnel as a proxy in Chrome, which will cause Chrome to send its traffic through the tunnel.

There are some problems here, as Chrome OS won’t normally send DNS requests over the tunnel (see bug 29914) . This is because Chrome OS uses the SOCKS4 protocol for the tunnel by default, even though it supports the more secure SOCKS5 protocol. There’s no option to choose SOCKS5 when setting up a proxy in Chrome OS’s user interface (see bug 199603).

If you don’t care that your DNS requests are sent out across your current connection, you can just enable the proxy the normal way. To do so, open your Chromebook’s Settings page and check the “Allow proxies for shared networks” option under Internet connection. Next, click the name of your Internet connection, click over to the Proxy tab, and select “Manual proxy configuration.” To the right of SOCKS host, enter “localhost” and the port you specified earlier.

To configure a SOCKS5 proxy the easy way, use the Proxy SwitchySharp extension. It allows you to enter the appropriate details and select SOCKS5, using the Chrome proxy API to change your proxy settings so Chrome will use a SOCKS5 proxy.

Use the SwitchSharp Options page to create a new proxy profile and name it something like “SSH Tunnel.” Under Manual Configuration and to the right of SOCKS Host, enter “localhost” as the address and enter the port number you chose earlier. Choose the “SOCKS v5″ option. When you use this proxy profile, it will forward your traffic over the SSH tunnel.

If you’d rather not use a browser extension, you can instead create your own proxy auto-configuration (PAC) file and point Chrome at it. To do this, simply use a text editor (Caret is a good offline text editor for Chrome OS) and enter the following text into it:

functionFindProxyForURL(url,host)

{

return“SOCKS5 localhost:8800″;

}

Of course, you should enter the port you chose earlier if you didn’t choose 8800. Save the text file with the .pac file extension — for example, you could just save it in your Downloads folder.

You can now re-visit the proxy configuration screen and choose “Automatic Proxy Configuration.” Enter the path to the .pac file, either stored on your Chromebook yourself or on a remote server. For example, the path to access your downloads folder on Chrome OS is file:///home/chronos/user/Downloads/. So, since we saved our file with the name ssh_tunnel.pac, we’d enter file:///home/chronos/user/Downloads/ssh_tunnel.pac here.

If you start seeing connection errors while using the proxy configuration, it may be because your SSH connection was closed. You’ll need to re-connect to the SSH server in the same way or un-set the proxy options, allowing your Chromebook to connect to the Internet directly again.