aboutsummaryrefslogtreecommitdiff
path: root/2fa
blob: 23725fd8a4e68df85c29e95a2dc07f5ba69fbb3c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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

Generated with cgit - Back to sebastiano.tronto.net