summaryrefslogtreecommitdiff
path: root/regress
diff options
context:
space:
mode:
authorDamien Miller <djm@cvs.openbsd.org>2024-10-24 03:28:35 +0000
committerDamien Miller <djm@cvs.openbsd.org>2024-10-24 03:28:35 +0000
commit48ac1c963a8432040dc5fc8754cc2e3c06a95952 (patch)
treec3bd314c6a0969e673e5a0c00adcc0bca815984c /regress
parent03c418572adb043530b53eac391bc31b50d38e46 (diff)
test SIGUSR1 dropping all keys from ssh-agent
Diffstat (limited to 'regress')
-rw-r--r--regress/usr.bin/ssh/agent.sh27
1 files changed, 25 insertions, 2 deletions
diff --git a/regress/usr.bin/ssh/agent.sh b/regress/usr.bin/ssh/agent.sh
index 5f1060608eb..f0022aca552 100644
--- a/regress/usr.bin/ssh/agent.sh
+++ b/regress/usr.bin/ssh/agent.sh
@@ -1,4 +1,4 @@
-# $OpenBSD: agent.sh,v 1.21 2023/03/01 09:29:32 dtucker Exp $
+# $OpenBSD: agent.sh,v 1.22 2024/10/24 03:28:34 djm Exp $
# Placed in the Public Domain.
tid="simple agent test"
@@ -157,7 +157,7 @@ done
## Deletion tests.
-trace "delete all agent keys"
+trace "delete all agent keys using -D"
${SSHADD} -D > /dev/null 2>&1
r=$?
if [ $r -ne 0 ]; then
@@ -181,6 +181,29 @@ r=$?
if [ $r -ne 0 ]; then
fail "ssh-add -l failed: exit code $r"
fi
+trace "delete all agent keys using SIGUSR1"
+kill -s USR1 $SSH_AGENT_PID
+r=$?
+if [ $r -ne 0 ]; then
+ fail "kill -s USR1 failed: exit code $r"
+fi
+# make sure they're gone
+${SSHADD} -l > /dev/null 2>&1
+r=$?
+if [ $r -ne 1 ]; then
+ fail "ssh-add -l returned unexpected exit code: $r"
+fi
+# re-add keys/certs to agent
+for t in ${SSH_KEYTYPES}; do
+ ${SSHADD} $OBJ/$t-agent-private >/dev/null 2>&1 || \
+ fail "ssh-add failed exit code $?"
+done
+# make sure they are there
+${SSHADD} -l > /dev/null 2>&1
+r=$?
+if [ $r -ne 0 ]; then
+ fail "ssh-add -l failed: exit code $r"
+fi
check_key_absent() {
${SSHADD} -L | grep "^$1 " >/dev/null