better tokenhandling
This commit is contained in:
parent
210a838a31
commit
977f8c87c9
1 changed files with 17 additions and 7 deletions
|
@ -63,11 +63,21 @@ check_token(){
|
||||||
# Write public keys of all in agent stored keys to a temporary file
|
# Write public keys of all in agent stored keys to a temporary file
|
||||||
local tmppubkey="$(mktemp -p ${XDG_RUNTIME_DIR} pubkey.XXXXXX.pub)"
|
local tmppubkey="$(mktemp -p ${XDG_RUNTIME_DIR} pubkey.XXXXXX.pub)"
|
||||||
logtrace "tmppubkey: $tmppubkey"
|
logtrace "tmppubkey: $tmppubkey"
|
||||||
ssh-add -L > $tmppubkey || return $?
|
logdebug "C"
|
||||||
|
tmpIFS="${IFS}"
|
||||||
|
IFS=$'\n'
|
||||||
|
for tmppk in $(ssh-add -L)
|
||||||
|
do
|
||||||
|
printf "%s" "$tmppk" |tee "${tmppubkey}" || return $?
|
||||||
|
#echo "${tmppk}" > $tmppubkey || return $?
|
||||||
|
#ssh-add -L > $tmppubkey || return $?
|
||||||
# Check if public-keys in tmppubkey are working. They are not working, if you removed and add back hardware-token.
|
# Check if public-keys in tmppubkey are working. They are not working, if you removed and add back hardware-token.
|
||||||
loginfo "$(ssh-add -T ${tmppubkey}|| { ssh-add -e $PKCS11_MODULE; ssh-add -s $PKCS11_MODULE; } )"
|
loginfo "$(ssh-add -T ${tmppubkey}|| { ssh-add -e $PKCS11_MODULE; ssh-add -s $PKCS11_MODULE; } )"
|
||||||
logdebug "$(rm "${tmppubkey}")"
|
|
||||||
logdebug "$(ssh-add -l )"
|
logdebug "$(ssh-add -l )"
|
||||||
|
done
|
||||||
|
logdebug "$(rm "${tmppubkey}")"
|
||||||
|
IFS=$tmpIFS
|
||||||
|
unset tmpIFS
|
||||||
[ $DISPLAY_ORIG ] && logtrace "reset DISPLAY=$DISPLAY_ORIG"
|
[ $DISPLAY_ORIG ] && logtrace "reset DISPLAY=$DISPLAY_ORIG"
|
||||||
[ $DISPLAY_ORIG ] && export DISPLAY=$DISPLAY_ORIG
|
[ $DISPLAY_ORIG ] && export DISPLAY=$DISPLAY_ORIG
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue