test if token is loaded

This commit is contained in:
Jakobus Schürz 2021-05-11 11:59:30 +02:00
parent 3c67a1f7ba
commit cf31d57179

View file

@ -285,6 +285,8 @@ agent-load-identity-keys () {
for key in $(ls ${SSH_IDENTITIES_DIR}/${ssh_identity}/*|grep "\.so$"); do
logdebug "P11M: $P11M - key: $key"
[ "$(readlink - f $key)" == "$P11M" ] || key="$P11M"
logdebug "P11M: $P11M - key: $key"
logdebug "$(ssh-add -T $key)"
tokenfingerprint="$(ssh-keygen -l -D $key|tr -s ' '|awk '{print $2}')"
if [[ ${fingerprints[*]} =~ "$tokenfingerprint" ]]; then
logdebug "token: $key ($tokenfingerprint) is loaded"