From 65848e57399e4f966a11e83e34bbd81245d35424 Mon Sep 17 00:00:00 2001 From: Michael Vorburger Date: Sat, 19 Oct 2024 16:06:49 +0200 Subject: [PATCH] build: Fix bug in sshd test script on hosts with both IPv4 & IPv6 --- container/sshd/test | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/container/sshd/test b/container/sshd/test index b38a258..bd8e074 100755 --- a/container/sshd/test +++ b/container/sshd/test @@ -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 @@ -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*