We also keep a host available with SSH exposed publicly (public key auth only). So, I use that host as an SSH SOCKS proxy and it works great for keeping me off the VPN.
So, if you're in a similar position or simply would like to use SSH as a sort of pseudo-VPN, these instructions might be helpful.
Non-Windows users can do the same thing, you just need to use the ssh command to connect to the remote host and use the -D parameter. Something like: ssh -D 1337 yourhost
- Create a new session in Putty
- Hostname: yourhost
- Port: 22
- Go under Category → Connection → Data
- Auto-login username: <your username>
- Leave this off
- Enable compression
- Attempt to authenticate using Pageant
- Allow agent forwarding
- Source port: 1337
- Destination: yourhost
- Radio button: Dynamic
- Click Add
- (Just shows D1337, this ok)
Now, to actually use the proxy, you can go a couple ways. Originally, I was doing it the manual way, but I found the Chrome extension SOCKS proxy which works great. It's hassle free and even make it so that DNS requests go over the proxy. The source code is very small and easily reviewed so you can see it's not doing anything nefarious.
If you can't or won't install an extension, here's the manual method.
- Run the inetcpl.cpl control panel. (NOT the new Windows 10 Proxy Settings page.)
- Go under the Connections tab
- LAN settings button
- Uncheck automatic detection
- Check Use a proxy server for your LAN
- Advanced button.
- Fill in ONLY the SOCKS information (not http, secure, or ftp. Uncheck Use the same proxy for all protocols)
- Socks: 127.0.0.1
- Port: 1337
Now, if you don't have to worry about resolving any private DNS records, you're good to go. My company has whole zones that aren't resolvable from the public internet. For these, DNS queries have to originate from the company network. Chrome, by default, will not send DNS requests over the SOCKS proxy, so there's an additional step required.
I suggest copying your existing Chrome icon and giving it a different name. Edit this icon and append to the end of the Target: field, after the final quote (not inside the quotes) the following:
--proxy-server="socks5://127.0.0.1:1337" --host-resolver-rules="MAP * ~NOTFOUND , EXCLUDE 127.0.0.1"
I haven't test it myself, but I've heard that Firefox automatically pushes DNS requests over the proxy.
So one of the big limitations of this is that it doesn't really help in a heavy Active Directory environment where your PC has to communicate with things over a domain, such as shared drives.
However, you can tunnel RDP through your SSH host as well. Configure additional tunnels, one per RDP destination. Back in your new Putty session:
- Category → Connection → SSH → Tunnels
- Source port: 38001
- (This is a made up value of no significance. You'll have to make one up for each RDP destination.)
- Destination: rdphost:3389
- Relaunch your Putty session
- Open RDP
- Use the destination address: 127.0.0.1:38001
- Repeat the port forwards with different port numbers for each RDP host you to access.