From 92e6633e97cbd0582da4c61321449a7366e3f1c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakobus=20Sch=C3=BCrz?= Date: Fri, 17 Nov 2023 14:05:28 +0100 Subject: [PATCH] Merged detached head into master --- bin/startagent | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/bin/startagent b/bin/startagent index cbf77b4..c1d7e99 100755 --- a/bin/startagent +++ b/bin/startagent @@ -35,6 +35,7 @@ usage(){ Just to be asked for password again, if you plugged off hardware-token and plugged it in again. --rm|--remove remove keys and token instead of adding them. + -R|--restart-agent -h|--info Show this info @@ -103,7 +104,9 @@ set_and_load_identity_config() { if [ -e "${ssh_identity_dir}/config" ]; then logdebug "source ${ssh_identity_dir}/config" unset SSH_AUTH_SOCK SSH_AGENT_PID PKCS11_MODULE SSH_AGENT_ALLOW_FROM_REMOTE SSH_ADD_OPTION + set -a . "${ssh_identity_dir}/config" + set +a fi } @@ -116,6 +119,8 @@ start_or_restart_local_agent() { logdebug "SSH_AUTH_SOCK: ${SSH_AUTH_SOCK:-not set}" logdebug "SSH_AGENT_PID: ${SSH_AGENT_PID:-not set}" logdebug "PKCS11_MODULE: ${PKCS11_MODULE:-not set}" + # kill ssh-agent when wanted from options + ${restartagent:-false} && ssh-agent -k for i in $(pgrep -f ${SSH_AUTH_SOCK}) do logdebug "$(stat ${SSH_AUTH_SOCK})" @@ -348,6 +353,10 @@ keyonly=false remove=false while :; do case $1 in + -r|--restart-agent) + restartagent=true + shift + ;; -c|--create-only) createonly=true shift @@ -394,6 +403,7 @@ fi logdebug " PKCS11_MODULE=${PKCS11_MODULE:-not set}" logdebug " SSH_ADD_OPTIONS=${SSH_ADD_OPTIONS:-not set}" +logdebug " SSH_AGENT_OPTIONS=${SSH_AGENT_OPTIONS:-not set}" logdebug "SSH_AGENT_ALLOW_FROM_REMOTE=${SSH_AGENT_ALLOW_FROM_REMOTE:-false}" logdebug " PKCS11_MODULE=${PKCS11_MODULE:-not set}" logdebug " P11M=${P11M:-not set}"