2016年11月30日 星期三

VPN for internal service

Have to setup VPN for internal service, using AWS as VPN server
----
AWS VPN in 10 mins:
https://www.webdigi.co.uk/blog/2015/how-to-setup-your-own-private-secure-free-vpn-on-the-amazon-aws-cloud-in-10-minutes/
---
but I don't want all traffic go through VPN, I have to setup routes
using Apple script as below:

property version : "2016-12-01"
property theShellScript : "#!/bin/sh
rm /etc/ppp/ip-up
sudo echo '#!/bin/sh' >> /etc/ppp/ip-up
sudo echo '/sbin/route add -net "destination.com" -interface $1' >> /etc/ppp/ip-up
sudo echo '/sbin/route add -net google.com -interface $1' >> /etc/ppp/ip-up
chmod 0755 /etc/ppp/ip-up
cat /etc/ppp/ip-up"
do shell script theShellScript with administrator privileges

What it does is to put a ip-up file in /etc/ppp, when vpn is connect, the ip-up script will be executed, and route for  "destination.com" will be route through VPN