Skip to content

Commit

Permalink
adjust term close test
Browse files Browse the repository at this point in the history
  • Loading branch information
JacobBarthelmeh committed Nov 26, 2024
1 parent e55c7cb commit 7550d1d
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions apps/wolfsshd/test/sshd_term_close_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,27 @@ ROOT_PWD=$(pwd)
cd ../../..

TEST_CLIENT="ssh"
USER=$(whoami)
PRIVATE_KEY="./keys/hansel-key-ecc.der"
PRIVATE_KEY="./keys/hansel-key-ecc.pem"
chmod 600 "$PRIVATE_KEY"

if [ -z "$1" ] || [ -z "$2" ]; then
if [ -z "$1" ] || [ -z "$2" ] || [ -z "$3" ]; then
echo "expecting host and port as arguments"
echo "$0 127.0.0.1 22222"
echo "$0 127.0.0.1 22222 $USER"
exit 1
fi

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/openssl-1.1.1/lib
# get the current wolfsshd pid count to compare with
WOLFSSHD_PID_COUNT=$(pgrep wolfsshd | wc -l)

COMMAND="timeout 2 $TEST_CLIENT -p $2 -i $PRIVATE_KEY $USER@$1"
COMMAND="timeout 2 $TEST_CLIENT -p $2 -i $PRIVATE_KEY $3@$1 \"sleep 10\""
echo "$COMMAND"
$COMMAND &
WOLFSSHD_PID_COUNT_AFTER=$(pgrep wolfsshd | wc -l)
if [ "$WOLFSSHD_PID_COUNT" = "$WOLFSSHD_PID_COUNT_AFTER" ]; then
echo "Expecting another wolfSSHd pid after connection"
echo "PID count before = $WOLFSSHD_PID_COUNT"
echo "PID count after = $WOLFSSHD_PID_COUNT_AFTER"
exit 1
fi
netstat -nt | grep ESTABLISHED
Expand Down

0 comments on commit 7550d1d

Please sign in to comment.