commit 60643f945cc58565a0ca8ee9f5ec554fa41bd0d9 parent 778574d025cf7a23b386d8cb110e265dd334dfc2 Author: Sebastiano Tronto <sebastiano@tronto.net> Date: Mon, 2 Dec 2024 19:05:24 +0100 added 2fa script Diffstat:
A | 2fa | | | 21 | +++++++++++++++++++++ |
1 file changed, 21 insertions(+), 0 deletions(-)
diff --git a/2fa b/2fa @@ -0,0 +1,21 @@ +#!/bin/sh + +# 2-factor authentication based on oathtool + +# Usage: 2fa service [time] + +# Requires: secret, oathtool + +secrets_folder="$HOME/box/secrets" + +if [ -z "$1" ]; then + echo "usage: 2fa service [time]" + exit 1 +fi + +if [ -n "$2" ]; then + t="-N $2" +fi + +secret="$(secret show "$secrets_folder/$1-2fa")" +oathtool -b --totp "$secret" $t