mirror of https://github.com/wolfSSL/wolfssh.git
add test case
parent
2722cb9da8
commit
46832e46b4
|
@ -10,7 +10,7 @@ To run all tests do:
|
||||||
```
|
```
|
||||||
$ cd apps/wolfsshd/test/
|
$ cd apps/wolfsshd/test/
|
||||||
|
|
||||||
$ sudo ./run_all_sshd_tests.sh
|
$ sudo ./run_all_sshd_tests.sh <user>
|
||||||
Running all wolfSSHd tests
|
Running all wolfSSHd tests
|
||||||
Starting up local wolfSSHd for tests on 127.0.0.1:22222
|
Starting up local wolfSSHd for tests on 127.0.0.1:22222
|
||||||
SSHD running on PID 7979
|
SSHD running on PID 7979
|
||||||
|
|
|
@ -76,9 +76,10 @@ fi
|
||||||
# these tests require setting up an sshd
|
# these tests require setting up an sshd
|
||||||
if [ "$USING_LOCAL_HOST" == 1 ]; then
|
if [ "$USING_LOCAL_HOST" == 1 ]; then
|
||||||
run_test "sshd_forcedcmd_test.sh"
|
run_test "sshd_forcedcmd_test.sh"
|
||||||
|
run_test "sshd_window_full_test.sh"
|
||||||
else
|
else
|
||||||
printf "Skipping tests that need to setup local SSHD\n"
|
printf "Skipping tests that need to setup local SSHD\n"
|
||||||
SKIPPED=$((SKIPPED+1))
|
SKIPPED=$((SKIPPED+2))
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# these tests run with X509 sshd-config loaded
|
# these tests run with X509 sshd-config loaded
|
||||||
|
|
|
@ -0,0 +1,56 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# sshd local test
|
||||||
|
|
||||||
|
if [ -z "$1" ] || [ -z "$2" ]; then
|
||||||
|
echo "expecting host and port as arguments"
|
||||||
|
echo "./sshd_exec_test.sh 127.0.0.1 22222"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
PWD=`pwd`
|
||||||
|
|
||||||
|
if [ ! -z "$3" ]; then
|
||||||
|
USER="$3"
|
||||||
|
else
|
||||||
|
USER=`whoami`
|
||||||
|
fi
|
||||||
|
TEST_PORT="$2"
|
||||||
|
TEST_HOST="$1"
|
||||||
|
source ./start_sshd.sh
|
||||||
|
cat <<EOF > sshd_config_test_window
|
||||||
|
Port $TEST_PORT
|
||||||
|
Protocol 2
|
||||||
|
LoginGraceTime 600
|
||||||
|
PermitRootLogin yes
|
||||||
|
PasswordAuthentication yes
|
||||||
|
PermitEmptyPasswords no
|
||||||
|
UsePrivilegeSeparation no
|
||||||
|
UseDNS no
|
||||||
|
HostKey $PWD/../../../keys/server-key.pem
|
||||||
|
AuthorizedKeysFile $PWD/authorized_keys_test
|
||||||
|
EOF
|
||||||
|
|
||||||
|
start_wolfsshd "sshd_config_test_forcedcmd"
|
||||||
|
cd ../../..
|
||||||
|
|
||||||
|
TEST_CLIENT="./examples/client/client"
|
||||||
|
TEST_SFTP="./examples/sftpclient/wolfsftp"
|
||||||
|
PRIVATE_KEY="./keys/hansel-key-ecc.der"
|
||||||
|
PUBLIC_KEY="./keys/hansel-key-ecc.pub"
|
||||||
|
|
||||||
|
head -c 1G /dev/urandom > random-test.txt
|
||||||
|
|
||||||
|
PWD=`pwd`
|
||||||
|
$TEST_CLIENT -c "cd $PWD; $TEST_CLIENT -c \"cat $PWD/random-test.txt\" -u $USER -i $PRIVATE_KEY -j $PUBLIC_KEY -h $TEST_HOST -p $TEST_PORT" -u $USER -i $PRIVATE_KEY -j $PUBLIC_KEY -h $TEST_HOST -p $TEST_PORT > random-test-result.txt
|
||||||
|
|
||||||
|
diff random-test.txt random-test-result.txt
|
||||||
|
RESULT=$?
|
||||||
|
if [ "$RESULT" != 0 ]; then
|
||||||
|
echo "cat did not pass through all expected data"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
stop_wolfsshd
|
||||||
|
exit 0
|
||||||
|
|
Loading…
Reference in New Issue