Skip to content

Instantly share code, notes, and snippets.

@SnacksOnAPlane
Last active August 29, 2015 14:08
Show Gist options
  • Save SnacksOnAPlane/04f5b7cb9508fc17e82a to your computer and use it in GitHub Desktop.
Save SnacksOnAPlane/04f5b7cb9508fc17e82a to your computer and use it in GitHub Desktop.
Setting up a pseudo-split VPN
N.B. This all assumes that you currently connect to the VPN through a VirtualBox Ubuntu machine. If you don't, no problem, but you're gonna have to make it work with whatever your setup is!
IN YOUR VBox VM
1. sudo apt-get install openconnect
2. Make an executable shell script in your home directory:
#!/bin/bash
openconnect -u yourusername_us https://myaccess.oraclevpn.com/
3. Try running it with sudo. Make sure it connects. Tweak until it does.
4. Shut down your VBox VM.
ON YOUR MAC
5. Open your VM settings, go to "Network -> Adapter 2". Enable it, and set it to "Host-only Adapter".
6. Start up your VBox VM.
IN YOUR VBox VM
7. sudo ifconfig, make sure that you now have eth1 showing with an IP
8. sudo apt-get install openssh-server
ON YOUR MAC
9. ssh into your VBox VM using the eth1 IP from 7. Make sure it works.
10. Add this into your ~/.ssh/config
Host vbox
HostName 192.168.56.101 (REPLACE WITH IP FROM 7)
User username
Host vm
ProxyCommand ssh -q vbox nc -q0 YOUR_ODC_VM_IP 22 (replace YOUR_ODC_VM_IP)
11. Test: ssh into both vbox and vm; make sure they both connect.
12. ssh vbox
IN SSH SESSION TO vbox
13. sudo apt-get install squid3
14. edit /etc/squid3/squid.conf, add the following lines:
acl local_net src 192.168.56.0/16
http_access allow local_net
forwarded_for delete
15. sudo service squid3 restart
16. Run your openconnect script, as created in 2.
ON YOUR MAC
17. In chrome, make a new user called "VPN" (should be in the "Users" menu)
18. Download a proxy-switching extension. I'm using "SwitchySharp".
19. Create a new proxy with your IP from 7, port 3128.
20. Using the globe menu by the URL bar, switch to the proxy you just created.
21. Browse to my.oracle.com or some other internal site to be sure it's working.
Now you should be able to ssh directly to your ODC VM via "ssh vm" or browse VPN sites with your "VPN" user in chrome. Enjoy!
For bonus points:
You no longer need graphical mode for your VM. Follow the instructions here: http://ubuntuhandbook.org/index.php/2014/01/boot-into-text-console-ubuntu-linux-14-04/ to always boot into text mode, for a much lighter experience.
WIP: getting this into a vagrant file.
@jswright61
Copy link

Prior to step 5 (Sep 4.5?)
on your mac go to Virtualbox->preferences, select network tab, then Host Only Networks pane, add new Host Only network and save

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment