2fa (335B)
1 #!/bin/sh 2 3 # 2-factor authentication based on oathtool 4 5 # Usage: 2fa service [time] 6 7 # Requires: secret, oathtool 8 9 secrets_folder="$HOME/box/secrets" 10 11 if [ -z "$1" ]; then 12 echo "usage: 2fa service [time]" 13 exit 1 14 fi 15 16 if [ -n "$2" ]; then 17 t="-N $2" 18 fi 19 20 secret="$(secret show "$secrets_folder/$1-2fa")" 21 oathtool -b --totp "$secret" $t