From 8d1efe9fdff3973d3ebb57da16924a9c93f4f777 Mon Sep 17 00:00:00 2001 From: John Safranek Date: Wed, 24 Jul 2024 15:16:15 -0700 Subject: [PATCH] Testing Update 1. Update the sshd test to use the newer actions. 2. Parameterize the test for macos and ubuntu. 3. Parameterize the version of wolfssl used. 4. Parameterize the wolfSSH options used. 5. Update a couple test scripts to output their $0 variable instead of the wrong string. --- .github/workflows/os-check.yml | 11 ++-- .github/workflows/sshd-test.yml | 79 +++++++++++++++++------ apps/wolfsshd/test/sshd_forcedcmd_test.sh | 2 +- apps/wolfsshd/test/sshd_x509_test.sh | 2 +- keys/renewcerts.sh | 2 +- 5 files changed, 67 insertions(+), 29 deletions(-) diff --git a/.github/workflows/os-check.yml b/.github/workflows/os-check.yml index 5db5697d4..fb70e26ca 100644 --- a/.github/workflows/os-check.yml +++ b/.github/workflows/os-check.yml @@ -10,15 +10,13 @@ concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true -env: - WOLFSSL_REF: v5.7.0-stable - jobs: build_wolfssl: strategy: fail-fast: false matrix: os: [ ubuntu-latest, macos-latest ] + wolfssl: [ v5.7.2-stable, master ] name: Build wolfssl runs-on: ${{ matrix.os }} timeout-minutes: 4 @@ -28,7 +26,7 @@ jobs: id: cache-wolfssl with: path: build-dir/ - key: wolfssh-os-check-wolfssl-${{ env.WOLFSSL_REF }}-${{ matrix.os }} + key: wolfssh-os-check-wolfssl-${{ matrix.wolfssl }}-${{ matrix.os }} lookup-only: true - name: Checkout, build, and install wolfssl @@ -36,7 +34,7 @@ jobs: uses: wolfSSL/actions-build-autotools-project@v1 with: repository: wolfssl/wolfssl - ref: ${{ env.WOLFSSL_REF }} + ref: ${{ matrix.wolfssl }} path: wolfssl configure: --enable-all check: false @@ -47,6 +45,7 @@ jobs: fail-fast: false matrix: os: [ ubuntu-latest, macos-latest ] + wolfssl: [ v5.7.2-stable, master ] config: [ '', '--enable-all', @@ -63,7 +62,7 @@ jobs: uses: actions/cache@v4 with: path: build-dir/ - key: wolfssh-os-check-wolfssl-${{ env.WOLFSSL_REF }}-${{ matrix.os }} + key: wolfssh-os-check-wolfssl-${{ matrix.wolfssl }}-${{ matrix.os }} fail-on-cache-miss: true - name: Checkout, build, and test wolfssh diff --git a/.github/workflows/sshd-test.yml b/.github/workflows/sshd-test.yml index 1a715ccc5..53330bdc1 100644 --- a/.github/workflows/sshd-test.yml +++ b/.github/workflows/sshd-test.yml @@ -6,27 +6,66 @@ on: pull_request: branches: [ '*' ] +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: - build: + build_wolfssl: + strategy: + fail-fast: false + matrix: + os: [ ubuntu-latest ] + wolfssl: [ v5.7.2-stable ] + name: Build wolfssl + runs-on: ${{ matrix.os }} + timeout-minutes: 4 + steps: + - name: Checking cache for wolfssl + uses: actions/cache@v4 + id: cache-wolfssl + with: + path: build-dir/ + key: wolfssh-sshd-wolfssl-${{ matrix.wolfssl }}-${{ matrix.os }} + lookup-only: true - runs-on: ubuntu-latest + - name: Checkout, build, and install wolfssl + if: steps.cache-wolfssl.outputs.cache-hit != 'true' + uses: wolfSSL/actions-build-autotools-project@v1 + with: + repository: wolfssl/wolfssl + ref: ${{ matrix.wolfssl }} + path: wolfssl + configure: --enable-all + check: false + install: true + build_wolfssh: + strategy: + fail-fast: false + matrix: + os: [ ubuntu-latest ] + wolfssl: [ v5.7.2-stable ] + name: Build and test wolfsshd + runs-on: ${{ matrix.os }} + timeout-minutes: 10 + needs: build_wolfssl steps: - - uses: actions/checkout@v2 - with: - repository: wolfSSL/wolfssl.git - ref: master - - name: build wolfSSL - run: ./autogen.sh && ./configure --enable-all --prefix=/usr && make && sudo make install - - uses: actions/checkout@v2 - - name: autogen - run: ./autogen.sh - - name: configure - run: ./configure --enable-all CPPFLAGS="-DWOLFSSH_NO_FPKI -DWOLFSSH_NO_SFTP_TIMEOUT -DWOLFSSH_MAX_SFTP_RW=4000000" - - name: make - run: make - - name: make check - run: make check - - name: run wolfSSHd tests - run: sudo ./run_all_sshd_tests.sh root - working-directory: ./apps/wolfsshd/test + - name: Checking cache for wolfssl + uses: actions/cache@v4 + with: + path: build-dir/ + key: wolfssh-sshd-wolfssl-${{ matrix.wolfssl }}-${{ matrix.os }} + fail-on-cache-miss: true + + - name: Checkout and build wolfsshd + uses: wolfSSL/actions-build-autotools-project@v1 + with: + repository: wolfssl/wolfssh + path: wolfssh + configure: --enable-debug --enable-all LDFLAGS="-L${{ github.workspace }}/build-dir/lib" CPPFLAGS="-I${{ github.workspace }}/build-dir/include -DWOLFSSH_NO_FPKI -DWOLFSSH_NO_SFTP_TIMEOUT -DWOLFSSH_MAX_SFTP_RW=4000000" + check: true + + - name: Run wolfSSHd tests + working-directory: wolfssh/apps/wolfsshd/test + run: sudo ./run_all_sshd_tests.sh root diff --git a/apps/wolfsshd/test/sshd_forcedcmd_test.sh b/apps/wolfsshd/test/sshd_forcedcmd_test.sh index 645307f26..ce332e2c7 100755 --- a/apps/wolfsshd/test/sshd_forcedcmd_test.sh +++ b/apps/wolfsshd/test/sshd_forcedcmd_test.sh @@ -4,7 +4,7 @@ if [ -z "$1" ] || [ -z "$2" ]; then echo "expecting host and port as arguments" - echo "./sshd_exec_test.sh 127.0.0.1 22222" + echo "$0 127.0.0.1 22222" exit 1 fi diff --git a/apps/wolfsshd/test/sshd_x509_test.sh b/apps/wolfsshd/test/sshd_x509_test.sh index 991e5d849..26850fea3 100755 --- a/apps/wolfsshd/test/sshd_x509_test.sh +++ b/apps/wolfsshd/test/sshd_x509_test.sh @@ -7,7 +7,7 @@ cd ../../.. if [ -z "$1" ] || [ -z "$2" ] || [ -z "$3" ]; then echo "expecting host, port and user as arguments" - echo "./sshd_x509_text.sh 127.0.0.1 22222 user" + echo "$0 127.0.0.1 22222 user" exit 1 fi diff --git a/keys/renewcerts.sh b/keys/renewcerts.sh index 5c630bdfe..3964fe520 100755 --- a/keys/renewcerts.sh +++ b/keys/renewcerts.sh @@ -6,7 +6,7 @@ else USER_NAME=$1 cp fred-key.der $USER_NAME-key.der cp fred-key.pem $USER_NAME-key.pem - sed -i "s/fred/$USER_NAME/g" renewcerts.cnf + sed -i.bak "s/fred/$USER_NAME/g" renewcerts.cnf fi # renew CA