Skip to content

Commit

Permalink
build: Fix ssh-agent testing
Browse files Browse the repository at this point in the history
  • Loading branch information
vorburger committed Oct 19, 2024
1 parent d855a0a commit 1add61a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions container/devshell/test-ssh-agent
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ cd "$(dirname "$0")"
# currently that is not what this tests: instead it's testing SSH from where this runs into a container, with an agent.

# Test that the local SSH Agent works (on the laptop/build server, where this script runs; NOT in container)
if [ -z "$SSH_AUTH_SOCK" ]; then
SSH_AUTH_SOCK=${SSH_AUTH_SOCK:-default_value}
if [[ -z "$SSH_AUTH_SOCK" || "$SSH_AUTH_SOCK" == "default_value" ]]; then
echo "Starting SSH Agent..."
eval "$(ssh-agent -s)"
fi
ssh-add -l

# TODO instead of copy/paste from ../sshd/test, share common test harness structure..

Expand All @@ -21,6 +21,7 @@ sleep 2

rm -f /tmp/test-$$-id_rsa*
ssh-keygen -f /tmp/test-$$-id_rsa -P "" -C test
ssh-add /tmp/test-$$-id_rsa
docker exec test-"$1" /usr/local/sbin/add-uid-key tester /bin/bash "$(cat /tmp/test-$$-id_rsa.pub)"

# NB -A for Agent Forwarding!
Expand Down

0 comments on commit 1add61a

Please sign in to comment.