Last active
October 2, 2018 14:17
-
-
Save irfn/eea4616a29474f7590481326af3c00c4 to your computer and use it in GitHub Desktop.
Launch Tunnelblick profile with a token generated by a yubikey google authenticator profile
This file contains hidden or 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
#!/usr/bin/env bash | |
TOKEN=$(yubioath show $1 | sed "/$1/ s/[a-z ]*//g") | |
read -r -d '' SCRIPT_TEMPLATE <<-'END' | |
tell application "Tunnelblick"NL | |
connect "$PROFILE"NL | |
delay 1NL | |
tell application "System Events"NL | |
keystroke $TOKENNL | |
delay 1NL | |
key code 36NL | |
end tellNL | |
get state of first configuration where name = "$PROFILE"NL | |
repeat until result = "CONNECTED"NL | |
delay 1NL | |
get state of first configuration where name = "$PROFILE"NL | |
end repeatNL | |
end tell | |
END | |
echo $SCRIPT_TEMPLATE | sed -e "s/\$TOKEN/$TOKEN/g" -e "s/\$PROFILE/$2/g" | perl -pe "s/NL/\n/g" | osascript |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Above script can be used to Launch a vpn profile with a Authenticator token on OSX
Needs the following
Yubikey authenticator application:
brew cask install yubico-authenticator
Add a google authenticator profile in the Yubikey UI.
Launch via
./yubikey-tunnelblick.sh name-of-yubiney-profile name-of-tunnelblick-profile