improve output

This commit is contained in:
Jakobus Schürz 2023-07-03 09:46:04 +02:00
parent e46bbc6868
commit 8d7f8f6708

View file

@ -175,13 +175,14 @@ agent_start_or_restart () {
logdebug "former agent is not running -> start it"
logdebug "SSH_AGENT_OPTIONS: $SSH_AGENT_OPTIONS"
[ -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 )"
logdebug "agent started"
;;
esac
else
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 )"
logdebug "agent started"
fi
@ -190,11 +191,11 @@ agent_start_or_restart () {
#logdebug "ssh-agent for identity »$ssh_identity«: $agentfile"
$createonly && logtrace "current loaded keys after action:
$(ssh_runinagent $agentfile ssh-add -l)"
echo $agentfile
loginfo agentfile: $agentfile
printf "%s" "$agentfile"
ret=0
else
logwarning "ssh-identity »$ssh_identity« is not configured. Please create $identitydir and add keys"
printf "%s" "$agentfile"
ret=2
fi
else
@ -280,7 +281,7 @@ agent_load_identity_keys () {
# load tokens
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
logdebug "pubkey with privkey: $pubkey"
logdebug "pubkey with privkey: ${pubkey} | ${pubkey%.pub}"
else
logdebug "pubkey without privkey: $pubkey"
pubkeysonly+=($pubkey)
@ -309,7 +310,7 @@ agent_load_identity_keys () {
export P11M=$PKCS11_MODULE
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}"
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}'))
@ -388,7 +389,6 @@ ssh_runinagent () {
ret=99
fi
loginfo "SSH_AUTH_SOCK: ${SSH_AUTH_SOCK}"
return $ret
}