credentials: redefine SEKRIT_DIR
Instead of adding a prefix to all keys.
This commit is contained in:
parent
a830563ebd
commit
aa6636e6a5
@ -33,13 +33,13 @@ clip()
|
|||||||
get_user()
|
get_user()
|
||||||
{
|
{
|
||||||
printf user
|
printf user
|
||||||
sekrit cp "services/$1/user" && printf "\n"
|
sekrit cp "$1/user" && printf "\n"
|
||||||
}
|
}
|
||||||
|
|
||||||
get_pass()
|
get_pass()
|
||||||
{
|
{
|
||||||
printf pass
|
printf pass
|
||||||
sekrit cp "services/$1/pass" && printf "\n"
|
sekrit cp "$1/pass" && printf "\n"
|
||||||
}
|
}
|
||||||
|
|
||||||
get_2fa()
|
get_2fa()
|
||||||
@ -50,7 +50,7 @@ get_2fa()
|
|||||||
isnic) otpcli_opts="-H sha512 -d 8"
|
isnic) otpcli_opts="-H sha512 -d 8"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
sekrit get "services/$1/2fa" | otpcli $otpcli_opts | clip && printf "\n"
|
sekrit get "$1/2fa" | otpcli $otpcli_opts | clip && printf "\n"
|
||||||
}
|
}
|
||||||
|
|
||||||
get_service()
|
get_service()
|
||||||
@ -61,25 +61,25 @@ get_service()
|
|||||||
sfa=$4
|
sfa=$4
|
||||||
|
|
||||||
if [ $user = no ] && [ $pass = no ] && [ $sfa = no ]; then
|
if [ $user = no ] && [ $pass = no ] && [ $sfa = no ]; then
|
||||||
sekrit has "services/$service/pass" ||
|
sekrit has "$service/pass" ||
|
||||||
err "unknown service $service"
|
err "unknown service $service"
|
||||||
pass=yes
|
pass=yes
|
||||||
sekrit has "services/$service/user" && user=yes
|
sekrit has "$service/user" && user=yes
|
||||||
sekrit has "services/$service/2fa" && sfa=yes
|
sekrit has "$service/2fa" && sfa=yes
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $user = check ]; then
|
if [ $user = check ]; then
|
||||||
sekrit has "services/$service/user" ||
|
sekrit has "$service/user" ||
|
||||||
err "service $service has no user"
|
err "service $service has no user"
|
||||||
user=yes
|
user=yes
|
||||||
fi
|
fi
|
||||||
if [ $pass = check ]; then
|
if [ $pass = check ]; then
|
||||||
sekrit has "services/$service/pass" ||
|
sekrit has "$service/pass" ||
|
||||||
err "service $service has no pass"
|
err "service $service has no pass"
|
||||||
pass=yes
|
pass=yes
|
||||||
fi
|
fi
|
||||||
if [ $sfa = check ]; then
|
if [ $sfa = check ]; then
|
||||||
sekrit has "services/$service/2fa" ||
|
sekrit has "$service/2fa" ||
|
||||||
err "service $service has no 2fa"
|
err "service $service has no 2fa"
|
||||||
sfa=yes
|
sfa=yes
|
||||||
fi
|
fi
|
||||||
@ -109,4 +109,6 @@ shift $((OPTIND - 1))
|
|||||||
[ $# -eq 1 ] && [ -n "$1" ] || usage
|
[ $# -eq 1 ] && [ -n "$1" ] || usage
|
||||||
key=$1
|
key=$1
|
||||||
|
|
||||||
get_service "$key" $user $pass $sfa
|
: ${SEKRIT_DIR:=~/keep/sekrit/services}
|
||||||
|
export SEKRIT_DIR
|
||||||
|
get_account "$key" $user $pass $mfa
|
||||||
|
Loading…
Reference in New Issue
Block a user