Last active
December 7, 2016 15:18
-
-
Save sugarjig/39b24745f728c44f8ad1192fed692365 to your computer and use it in GitHub Desktop.
A couple of simple scripts to start and stop an OpenConnect session with a password in macOS Keychain
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
# This will create a file "pid" in the current directory that will be used in the stop script | |
background | |
pid-file=pid | |
user=$USER | |
passwd-on-stdin |
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 | |
# Hard-code these values if you don't need to pass them in | |
# SERVER corresponds to the "Name" field in Keychain | |
# HOST is the URL used to connect to the VPN | |
SERVER=$1 | |
HOST=$2 | |
CONFIG=config | |
security find-internet-password -s $SERVER -w | openconnect --config=$CONFIG $HOST |
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 | |
kill -s INT $(cat pid) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment