-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Steve Coffman
committed
Jun 22, 2019
1 parent
1e910a9
commit 0f67a9e
Showing
3 changed files
with
84 additions
and
6 deletions.
There are no files selected for viewing
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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/bash | ||
|
||
# Might be good to use this line and somedefaultname | ||
#export TOTP="$(keyfob otp ${AWS_MFA_NAME:-somedefaultname})" | ||
|
||
export TOTP="$(keyfob otp ${AWS_MFA_NAME})" | ||
if [[ -n "${TOTP:-}" ]] | ||
then | ||
aws-vault exec --mfa-token=${TOTP} -j engineer | ||
else | ||
echo "No MFA TOTP! 2fa did not find a MFA TOTP." | ||
fi |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Script will snarf secrets from 2fa file | ||
if [ ! -x "$(command -v keyfob)" ]; then | ||
echo "keyfob is not installed, so I'm going to go grab the mac one for you" | ||
wget -O - https://github.com/StevenACoffman/keyfob/releases/download/v0.1.0/keyfob_0.1.0_Darwin_x86_64.tar.gz | tar xzvf | ||
mv keyfob /usr/local/bin | ||
fi | ||
|
||
filename="${HOME}/.2fa" | ||
|
||
if [ -f $filename ]; then | ||
cat $filename | while read line | ||
do | ||
SIZE="$(echo $line | awk '{print $2}')" | ||
KEY="$(echo $line | awk '{print $1}')" | ||
VALUE="$(echo $line | awk '{print $3}')" | ||
echo "Processing $KEY" >/dev/tty | ||
keyfob add "${KEY}" "${VALUE}" | ||
done | ||
else | ||
echo "${filename} does not exist so not automatically copying any keys from 2fa" | ||
fi |