Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@bhstahl
Last active April 14, 2020 19:51
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save bhstahl/a90d747683ea0598c673e42d7f5a8900 to your computer and use it in GitHub Desktop.
Save bhstahl/a90d747683ea0598c673e42d7f5a8900 to your computer and use it in GitHub Desktop.
A cli for launching/stopping Global Protect (and stopping it from auto-launching on restart)
  1. Create a folder to hold your custom bash commands
$ mkdir ~/.bin
  1. Download the vpn file above to that directory
curl https://gist.githubusercontent.com/bhstahl/a90d747683ea0598c673e42d7f5a8900/raw/75cf1751c315795619399ef0e6b53a0297af3040/vpn --output ~/.bin/vpn
  1. Make it executable by adding this to your .bash_profile
export PATH="$PATH:~/.bin"
  1. Run the setup command to make sure global protect doesnt launch each time you use your computer
$ vpn setup
  1. Then start/stop it on your own time
$ vpn start
# Launching global protect

$ vpn stop
# Quitting global protect
#!/bin/bash
function setup() {
sudo mv /Library/LaunchDaemons/com.paloaltonetworks.gp.pangpsd.plist /Library/Application\ Support/PaloAltoNetworks/GlobalProtect/
sudo mv /Library/LaunchAgents/com.paloaltonetworks.gp.pangps.plist /Library/Application\ Support/PaloAltoNetworks/GlobalProtect/
sudo mv /Library/LaunchAgents/com.paloaltonetworks.gp.pangpa.plist /Library/Application\ Support/PaloAltoNetworks/GlobalProtect/
}
function up() {
launchctl load /Library/Application\ Support/PaloAltoNetworks/GlobalProtect/com.paloaltonetworks.gp.pangps.plist
launchctl load /Library/Application\ Support/PaloAltoNetworks/GlobalProtect/com.paloaltonetworks.gp.pangpa.plist
}
function down() {
launchctl remove com.paloaltonetworks.gp.pangps
launchctl remove com.paloaltonetworks.gp.pangpa
}
case $1 in
up)
echo "Launching global protect"
up
;;
down)
echo "Quitting global protect"
down
;;
setup)
echo "Disabling global protect from startup items"
setup
;;
*)
echo "'$1' is not a valid verb. The only valid verbs are 'up' and 'down'."
exit 1
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment