Skip to content

Instantly share code, notes, and snippets.

@samjsharpe
Last active August 29, 2015 13:55
Show Gist options
  • Save samjsharpe/8729314 to your computer and use it in GitHub Desktop.
Save samjsharpe/8729314 to your computer and use it in GitHub Desktop.
#!/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