improve output
This commit is contained in:
parent
e46bbc6868
commit
8d7f8f6708
1 changed files with 6 additions and 6 deletions
|
@ -175,13 +175,14 @@ agent_start_or_restart () {
|
||||||
logdebug "former agent is not running -> start it"
|
logdebug "former agent is not running -> start it"
|
||||||
logdebug "SSH_AGENT_OPTIONS: $SSH_AGENT_OPTIONS"
|
logdebug "SSH_AGENT_OPTIONS: $SSH_AGENT_OPTIONS"
|
||||||
[ -e $agentsocket ] && { logdebug -n "remove socketfile: $( rm -v "$agentsocket" )"; }
|
[ -e $agentsocket ] && { logdebug -n "remove socketfile: $( rm -v "$agentsocket" )"; }
|
||||||
|
[ -e $agentfile ] && { logdebug -n "remove agentfile: $( rm -v "$agentfile" )"; }
|
||||||
logtrace "$(ssh-agent -a $agentsocket ${SSH_AGENT_OPTIONS} > $agentfile )"
|
logtrace "$(ssh-agent -a $agentsocket ${SSH_AGENT_OPTIONS} > $agentfile )"
|
||||||
logdebug "agent started"
|
logdebug "agent started"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
else
|
else
|
||||||
logdebug "agent did not exist -> create it"
|
logdebug "agent did not exist -> create it"
|
||||||
logtrace "ssh-agent -a $agentsocket \> $agentfile"
|
logtrace "ssh-agent -a $agentsocket $SSH_AGENT_OPTIONS \> $agentfile"
|
||||||
logtrace "$(ssh-agent -a $agentsocket $SSH_AGENT_OPTIONS > $agentfile )"
|
logtrace "$(ssh-agent -a $agentsocket $SSH_AGENT_OPTIONS > $agentfile )"
|
||||||
logdebug "agent started"
|
logdebug "agent started"
|
||||||
fi
|
fi
|
||||||
|
@ -190,11 +191,11 @@ agent_start_or_restart () {
|
||||||
#logdebug "ssh-agent for identity »$ssh_identity«: $agentfile"
|
#logdebug "ssh-agent for identity »$ssh_identity«: $agentfile"
|
||||||
$createonly && logtrace "current loaded keys after action:
|
$createonly && logtrace "current loaded keys after action:
|
||||||
$(ssh_runinagent $agentfile ssh-add -l)"
|
$(ssh_runinagent $agentfile ssh-add -l)"
|
||||||
echo $agentfile
|
loginfo agentfile: $agentfile
|
||||||
|
printf "%s" "$agentfile"
|
||||||
ret=0
|
ret=0
|
||||||
else
|
else
|
||||||
logwarning "ssh-identity »$ssh_identity« is not configured. Please create $identitydir and add keys"
|
logwarning "ssh-identity »$ssh_identity« is not configured. Please create $identitydir and add keys"
|
||||||
printf "%s" "$agentfile"
|
|
||||||
ret=2
|
ret=2
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
|
@ -280,7 +281,7 @@ agent_load_identity_keys () {
|
||||||
# load tokens
|
# load tokens
|
||||||
for pubkey in $(ls ${SSH_IDENTITIES_DIR}/${ssh_identity}/id_*|grep "pub$\|public$"|grep -v "cert.pub"); do
|
for pubkey in $(ls ${SSH_IDENTITIES_DIR}/${ssh_identity}/id_*|grep "pub$\|public$"|grep -v "cert.pub"); do
|
||||||
if $( ls ${pubkey%.pub} 1>/dev/null 2>&1);then
|
if $( ls ${pubkey%.pub} 1>/dev/null 2>&1);then
|
||||||
logdebug "pubkey with privkey: $pubkey"
|
logdebug "pubkey with privkey: ${pubkey} | ${pubkey%.pub}"
|
||||||
else
|
else
|
||||||
logdebug "pubkey without privkey: $pubkey"
|
logdebug "pubkey without privkey: $pubkey"
|
||||||
pubkeysonly+=($pubkey)
|
pubkeysonly+=($pubkey)
|
||||||
|
@ -309,7 +310,7 @@ agent_load_identity_keys () {
|
||||||
export P11M=$PKCS11_MODULE
|
export P11M=$PKCS11_MODULE
|
||||||
logdebug "PKCS11_MODULE: ${PKCS11_MODULE:-not set} - key: $key"
|
logdebug "PKCS11_MODULE: ${PKCS11_MODULE:-not set} - key: $key"
|
||||||
grep -q "PKCS11_MODULE" "${agentfile}" >/dev/null 2>&1 && sed -i -e '/PKCS11_MODULE/d' "${agentfile}"
|
grep -q "PKCS11_MODULE" "${agentfile}" >/dev/null 2>&1 && sed -i -e '/PKCS11_MODULE/d' "${agentfile}"
|
||||||
echo "PKCS11_MODULE=$(readlink -f $key)" | tee -a "${agentfile}" >&2
|
printf "%s\n" "PKCS11_MODULE=$(readlink -f $key)" | tee -a "${agentfile}" >&2
|
||||||
|
|
||||||
tokenfingerprints=($(ssh-keygen -l -D $key|tr -s ' '|awk '{print $2}'))
|
tokenfingerprints=($(ssh-keygen -l -D $key|tr -s ' '|awk '{print $2}'))
|
||||||
|
|
||||||
|
@ -388,7 +389,6 @@ ssh_runinagent () {
|
||||||
ret=99
|
ret=99
|
||||||
fi
|
fi
|
||||||
|
|
||||||
loginfo "SSH_AUTH_SOCK: ${SSH_AUTH_SOCK}"
|
|
||||||
return $ret
|
return $ret
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue