Created
July 8, 2011 19:43
-
-
Save deleted/1072646 to your computer and use it in GitHub Desktop.
quick and dirty azilink client script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*swp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dev tun | |
remote 127.0.0.1 41927 tcp-client | |
proto tcp-client | |
ifconfig 192.168.56.2 192.168.56.1 | |
route 0.0.0.0 128.0.0.0 | |
route 128.0.0.0 128.0.0.0 | |
socket-flags TCP_NODELAY | |
#keepalive 10 30 | |
ping 10 | |
dhcp-option DNS 192.168.56.1 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# azilink for OS X | |
# based on http://pastie.org/405289 but works with Tunnelblick only | |
# (no need to install a separate copy of OpenVPN2 from macports | |
# or building from source by hand, thankfully) | |
# Requires: | |
# - azilink running on android phone (http://code.google.com/p/azilink/) | |
# (run the app and check the box to start the service). | |
# - adb on system path (comes with the Android SDK; | |
# add its tools folder to your PATH in ~/.profile or | |
# place or symlink the sdk's tools/adb file in e.g. usr/local/bin or somewhere else on the PATH) | |
# - Tunnelblick, a nice OS X packaging of OpenVPN (http://code.google.com/p/tunnelblick/) | |
# Install Tunnelblick to Applications. Tested with Tunnelblick 3.0b22 | |
init() { | |
#sudo kextload /Applications/Tunnelblick.app/Contents/Resources/tun.kext | |
adb=/home/ted/install/android-sdk-linux/platform-tools/adb | |
$adb forward tcp:41927 tcp:41927 | |
sudo openvpn --dev tun \ | |
--script-security 2\ | |
--remote 127.0.0.1 41927 \ | |
--proto tcp-client \ | |
--ifconfig 192.168.56.2 192.168.56.1 \ | |
--route 0.0.0.0 128.0.0.0 \ | |
--route 128.0.0.0 128.0.0.0 \ | |
--keepalive 10 30 \ | |
--up "$0 up" \ | |
--down "$0 down" | |
} | |
up() { | |
tun_dev=$1 | |
ns=192.168.56.1 | |
sudo /usr/sbin/scutil << EOF | |
open | |
d.init | |
get State:/Network/Interface/$tun_dev/IPv4 | |
d.add InterfaceName $tun_dev | |
set State:/Network/Service/openvpn-$tun_dev/IPv4 | |
d.init | |
d.add ServerAddresses * $ns | |
set State:/Network/Service/openvpn-$tun_dev/DNS | |
quit | |
EOF | |
} | |
down() { | |
tun_dev=$1 | |
sudo /usr/sbin/scutil << EOF | |
open | |
remove State:/Network/Service/openvpn-$tun_dev/IPv4 | |
remove State:/Network/Service/openvpn-$tun_dev/DNS | |
quit | |
EOF | |
} | |
case $1 in | |
up ) up $2 ;; # openvpn will pass tun/tap dev as $2 | |
down) down $2 ;; | |
* ) init ;; | |
esac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# azilink for OS X | |
# based on http://pastie.org/405289 but works with Tunnelblick only | |
# (no need to install a separate copy of OpenVPN2 from macports | |
# or building from source by hand, thankfully) | |
# Requires: | |
# - azilink running on android phone (http://code.google.com/p/azilink/) | |
# (run the app and check the box to start the service). | |
# - adb on system path (comes with the Android SDK; | |
# add its tools folder to your PATH in ~/.profile or | |
# place or symlink the sdk's tools/adb file in e.g. usr/local/bin or somewhere else on the PATH) | |
# - Tunnelblick, a nice OS X packaging of OpenVPN (http://code.google.com/p/tunnelblick/) | |
# Install Tunnelblick to Applications. Tested with Tunnelblick 3.0b22 | |
init() { | |
sudo kextload /Applications/Tunnelblick.app/Contents/Resources/tun.kext | |
adb forward tcp:41927 tcp:41927 | |
sudo /Applications/Tunnelblick.app/Contents/Resources/openvpn --dev tun \ | |
--script-security 2\ | |
--remote 127.0.0.1 41927 \ | |
--proto tcp-client \ | |
--ifconfig 192.168.56.2 192.168.56.1 \ | |
--route 0.0.0.0 128.0.0.0 \ | |
--route 128.0.0.0 128.0.0.0 \ | |
--keepalive 10 30 \ | |
--up "$0 up" \ | |
--down "$0 down" | |
} | |
up() { | |
tun_dev=$1 | |
ns=192.168.56.1 | |
sudo /usr/sbin/scutil << EOF | |
open | |
d.init | |
get State:/Network/Interface/$tun_dev/IPv4 | |
d.add InterfaceName $tun_dev | |
set State:/Network/Service/openvpn-$tun_dev/IPv4 | |
d.init | |
d.add ServerAddresses * $ns | |
set State:/Network/Service/openvpn-$tun_dev/DNS | |
quit | |
EOF | |
} | |
down() { | |
tun_dev=$1 | |
sudo /usr/sbin/scutil << EOF | |
open | |
remove State:/Network/Service/openvpn-$tun_dev/IPv4 | |
remove State:/Network/Service/openvpn-$tun_dev/DNS | |
quit | |
EOF | |
} | |
case $1 in | |
up ) up $2 ;; # openvpn will pass tun/tap dev as $2 | |
down) down $2 ;; | |
* ) init ;; | |
esac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
domain lan | |
search lan | |
nameserver 8.8.8.8 | |
nameserver 192.168.56.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
adb forward tcp:41927 tcp:41927 | |
sudo cp /home/ted/code/azilink/resolve.conf /etc/ | |
sudo openvpn --config azilink.ovpn |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment