Skip to content

Commit

Permalink
build: Fix bug in sshd test script on hosts with both IPv4 & IPv6
Browse files Browse the repository at this point in the history
  • Loading branch information
vorburger committed Oct 19, 2024
1 parent f7583b6 commit 65848e5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions container/sshd/test
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ shellcheck add-uid-key

docker rm -f -t=1 test-sshd || true
docker run -d -p 2222 --name test-sshd sshd
PORT="$(docker port test-sshd | sed 's/2222\/tcp -> 0.0.0.0://')"
PORT="$(docker port test-sshd | head -n1 | sed 's/2222\/tcp -> 0.0.0.0://')"

rm -f /tmp/test-$$-id_rsa*
ssh-keygen -f /tmp/test-$$-id_rsa -P "" -C test
Expand All @@ -15,8 +15,8 @@ docker exec test-sshd /usr/local/sbin/add-uid-key fooba /bin/bash "$(cat /tmp/te
sleep 2

# intentionally testing twice, just to make sure that ssdh isn't in debugging mode and quit after first use
ssh -i /tmp/test-$$-id_rsa -o "UserKnownHostsFile=/dev/null" -o "StrictHostKeyChecking=no" -p $PORT fooba@localhost echo "1. hello, world."
ssh -i /tmp/test-$$-id_rsa -o "UserKnownHostsFile=/dev/null" -o "StrictHostKeyChecking=no" -p $PORT fooba@localhost echo "2. hello, world."
ssh -i /tmp/test-$$-id_rsa -o "UserKnownHostsFile=/dev/null" -o "StrictHostKeyChecking=no" -p "$PORT" fooba@localhost echo "1. hello, world."
ssh -i /tmp/test-$$-id_rsa -o "UserKnownHostsFile=/dev/null" -o "StrictHostKeyChecking=no" -p "$PORT" fooba@localhost echo "2. hello, world."

docker rm --force --time=1 test-sshd
rm -f /tmp/test-$$-id_rsa*
Expand Down

0 comments on commit 65848e5

Please sign in to comment.