Skip to content

Instantly share code, notes, and snippets.

@ben-axnick
Forked from patrobinson/.bash_profile
Created November 22, 2017 03:38
Show Gist options
  • Save ben-axnick/b88e688d388e0c8a3289c654329e7917 to your computer and use it in GitHub Desktop.
Save ben-axnick/b88e688d388e0c8a3289c654329e7917 to your computer and use it in GitHub Desktop.
Using yubikey 4c on Mac OS X (running Sierra)
GPG_ENV=$( gpg-agent --daemon 2>/dev/null )
if [ $? == 0 ]; then
eval $GPG_ENV
else
export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket)
fi
export GPG_TTY=$(tty)
function copy-code() {
echo $1 |sed -e 's/[^ ]* //' |pbcopy
}
# Create an alias for each oauth credential you have.
alias awscode='copy-code "$(ykman oath code aws-oauth-credential-name)"'
function aws-code() {
ykman oath code envato-aws-users |sed -e 's/[^ ]* //'
}
# create an alias for each amazon account you login to
alias login-aws-admin='aws-vault login -t "$(aws-code)" aws-administrator'
brew install gnupg swig pinentry-mac
pip install yubikey-manager
pinentry-program /usr/local/bin/pinentry-mac
enable-ssh-support
default-cache-ttl 600
max-cache-ttl 7200
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment