Skip to content

Instantly share code, notes, and snippets.

@skrajewski
Forked from bhstahl/README.md
Created January 27, 2019 15:36
Show Gist options
  • Save skrajewski/c09cd3550aa60b42d9638c13c1f9e02d to your computer and use it in GitHub Desktop.
Save skrajewski/c09cd3550aa60b42d9638c13c1f9e02d to your computer and use it in GitHub Desktop.

Revisions

  1. @bhstahl bhstahl revised this gist Mar 21, 2017. 1 changed file with 3 additions and 2 deletions.
    5 changes: 3 additions & 2 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -26,7 +26,8 @@ $ vpn setup

    ```sh
    $ vpn start
    Launching global protect
    # Launching global protect
    $ vpn stop
    Quitting global protect
    # Quitting global protect
    ```
  2. @bhstahl bhstahl revised this gist Mar 21, 2017. No changes.
  3. @bhstahl bhstahl revised this gist Mar 21, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -7,7 +7,7 @@ $ mkdir ~/.bin
    2. Download the `vpn` file above to that directory

    ```sh
    curl tobefilledin --output ~/.bin/vpn
    curl https://gist.github.com/bhstahl/a90d747683ea0598c673e42d7f5a8900/raw/75cf1751c315795619399ef0e6b53a0297af3040/vpn --output ~/.bin/vpn
    ```

    3. Make it executable by adding this to your `.bash_profile`
  4. @bhstahl bhstahl created this gist Mar 21, 2017.
    32 changes: 32 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,32 @@
    1. Create a folder to hold your custom bash commands

    ```sh
    $ mkdir ~/.bin
    ```

    2. Download the `vpn` file above to that directory

    ```sh
    curl tobefilledin --output ~/.bin/vpn
    ```

    3. Make it executable by adding this to your `.bash_profile`

    ```sh
    export PATH="$PATH:~/.bin"
    ````

    4. Run the setup command to make sure global protect doesnt launch each time you use your computer

    ```sh
    $ vpn setup
    ```

    5. Then start/stop it on your own time

    ```sh
    $ vpn start
    Launching global protect
    $ vpn stop
    Quitting global protect
    ```
    38 changes: 38 additions & 0 deletions vpn
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,38 @@
    #!/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