Last active
August 29, 2015 13:55
-
-
Save samjsharpe/8729314 to your computer and use it in GitHub Desktop.
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 | |
PSKYSCAPE="SKYSCAPEPASSWORD" | |
USKYSCAPE="SKYSCAPEUSERNAME" | |
PGDS="GDSPASSWORD" | |
UGDS="GDSUSERNAME" | |
function skyscape { | |
echo $PSKYSCAPE | sudo openconnect --passwd-on-stdin -b -q -u $USKYSCAPE --authgroup=CLIENT-VPN1 --no-cert-check vpn2.skyscapecloud.com >/dev/null 2>&1 | |
} | |
function gds { | |
echo "nameserver 192.168.9.1" | sudo tee /etc/resolver/gds >/dev/null | |
echo $PGDS | sudo openconnect --passwd-on-stdin -b -q -u $UGDS --usergroup github --no-cert-check vpn.digital.cabinet-office.gov.uk >/dev/null 2>&1 | |
} | |
case $1 in | |
skyscape) | |
skyscape | |
;; | |
gds) | |
gds | |
;; | |
kill) | |
sudo pkill openconnect | |
echo "nameserver 192.168.19.254" | sudo tee /etc/resolver/gds >/dev/null | |
;; | |
status) | |
ps auxwww | grep openconnect | grep -v grep | awk '{print $NF, "is connected"}' | |
;; | |
*) | |
skyscape | |
gds | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment