Skip to content

Commit 06915f4

Browse files
added sscep tests
This tests the bare minimum of sscep. A better scep server is needed for further testing or the current scep server needs to be patched to not use des-cbc.
1 parent 25edd49 commit 06915f4

File tree

2 files changed

+173
-0
lines changed

2 files changed

+173
-0
lines changed

.github/scripts/test_sscep.sh

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
#!/bin/bash
2+
# test_sscep.sh
3+
#
4+
# Copyright (C) 2006-2025 wolfSSL Inc.
5+
#
6+
# This file is part of wolfProvider.
7+
#
8+
# wolfProvider is free software; you can redistribute it and/or modify
9+
# it under the terms of the GNU General Public License as published by
10+
# the Free Software Foundation; either version 3 of the License, or
11+
# (at your option) any later version.
12+
#
13+
# wolfProvider is distributed in the hope that it will be useful,
14+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
15+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16+
# GNU General Public License for more details.
17+
#
18+
# You should have received a copy of the GNU General Public License
19+
# along with this program; if not, write to the Free Software
20+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
21+
TEST_SSCEP_FAIL=0
22+
23+
cleanup(){
24+
[ -f ca.crt ] && rm -f ca.crt
25+
[ -d ca-dir ] && rm -rf ca-dir
26+
}
27+
28+
killall scepserver &> /dev/null
29+
cleanup
30+
31+
# begin by setting up and starting the scep server
32+
OPENSSL_CONF="" OPENSSL_MODULES="" scepserver ca -depot ca-dir -init
33+
OPENSSL_CONF="" OPENSSL_MODULES="" scepserver -depot ca-dir -port 8080 -debug &
34+
35+
sleep 1
36+
37+
# now test sscep
38+
39+
# getca
40+
sscep getca -u "http://localhost:8080/scep" -c ca.crt -v -d
41+
42+
if [ $? -eq 0 ] && [ -f ca.crt ] \
43+
&& diff -y ca.crt ca-dir/ca.pem
44+
then
45+
echo "[ PASSED ] getca"
46+
else
47+
echo "[ FAILED ] getca"
48+
TEST_SSCEP_FAIL=1
49+
fi
50+
51+
# getnextca
52+
# could not get certificate chaining to work. Not sure if it's the servers fault
53+
# or mine.
54+
55+
# enroll
56+
# first generate ca request (sscep has a script for this)
57+
timeout 10 ./mkrequest -ip 1.2.3.4
58+
59+
if [ $? -eq 0 ]; then
60+
# then enroll -> sscep WILL fail this.
61+
# scepserver uses des-cbc (which is not supported) when sending a cert back, so
62+
# to test just check that the .csr got over to the server. This way at least
63+
# some of its functionality can be tested
64+
sscep enroll -u "http://localhost:8080/scep" -c ca.crt -k local.key -r local.csr -l local.crt -v -d
65+
66+
if [ -f ca-dir/1.2.3.4*.pem ];
67+
then
68+
echo "[ PASSED ] enroll"
69+
else
70+
echo "[ FAILED ] enroll"
71+
TEST_SSCEP_FAIL=1
72+
fi
73+
else
74+
echo "[ FAILED ] enroll"
75+
TEST_SSCEP_FAIL=1
76+
fi
77+
78+
killall scepserver &> /dev/null
79+
80+
cleanup
81+
82+
$GITHUB_WORKSPACE/.github/scripts/check-workflow-result.sh $TEST_SSCEP_FAIL "$WOLFPROV_FORCE_FAIL_STR" sscep
83+
exit $?

.github/workflows/sscep.yml

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
name: sscep Tests
2+
3+
# START OF COMMON SECTION
4+
on:
5+
push:
6+
branches: [ 'master', 'main', 'release/**' ]
7+
pull_request:
8+
branches: [ '*' ]
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
13+
# END OF COMMON SECTION
14+
15+
jobs:
16+
build_wolfprovider:
17+
uses: ./.github/workflows/build-wolfprovider.yml
18+
with:
19+
wolfssl_ref: ${{ matrix.wolfssl_ref }}
20+
openssl_ref: ${{ matrix.openssl_ref }}
21+
strategy:
22+
matrix:
23+
wolfssl_ref: [ 'master', 'v5.8.0-stable' ]
24+
openssl_ref: [ 'openssl-3.5.0' ]
25+
26+
test_sscep:
27+
runs-on: ubuntu-22.04
28+
needs: build_wolfprovider
29+
timeout-minutes: 10
30+
strategy:
31+
matrix:
32+
sscep_ref: [ 'master', 'v0.10.0' ]
33+
wolfssl_ref: [ 'master', 'v5.8.0-stable' ]
34+
openssl_ref: [ 'openssl-3.5.0' ]
35+
force_fail: [ 'WOLFPROV_FORCE_FAIL=1', '' ]
36+
37+
steps:
38+
- name: Checkout wolfProvider
39+
uses: actions/checkout@v4
40+
with:
41+
fetch-depth: 1
42+
43+
- name: Retrieving wolfSSL/wolfProvider from cache
44+
uses: actions/cache/restore@v4
45+
id: wolfprov-cache
46+
with:
47+
path: |
48+
wolfssl-install
49+
wolfprov-install
50+
openssl-install/lib64
51+
openssl-install/include
52+
openssl-install/bin
53+
54+
key: wolfprov-${{ matrix.wolfssl_ref }}-${{ matrix.openssl_ref }}-${{ github.sha }}
55+
fail-on-cache-miss: true
56+
57+
- name: Install sscep dependencies
58+
run: |
59+
sudo apt-get update
60+
61+
sudo apt-get install -y scep psmisc
62+
63+
- name: Download sscep
64+
uses: actions/checkout@v4
65+
with:
66+
repository: certnanny/sscep
67+
ref: ${{ matrix.sscep_ref }}
68+
path: sscep
69+
70+
- name: Build sscep
71+
working-directory: sscep
72+
run: |
73+
# force sscep to use the openssl binary in wolfProvider
74+
sudo ln -sf $GITHUB_WORKSPACE/openssl-install/bin/openssl /usr/bin/openssl
75+
76+
export openssl_CFLAGS="-I$GITHUB_WORKSPACE/openssl-install/include/"
77+
export openssl_LIBS="-L$GITHUB_WORKSPACE/openssl-install/lib64 -lssl -lcrypto"
78+
79+
autoreconf -vfi
80+
./configure
81+
make -j $(nproc)
82+
sudo make install
83+
84+
- name: Run sscep tests
85+
run: |
86+
source $GITHUB_WORKSPACE/scripts/env-setup
87+
export ${{ matrix.force_fail }}
88+
export WOLFPROV_FORCE_FAIL_STR="${{ matrix.force_fail }}"
89+
90+
cd sscep && $GITHUB_WORKSPACE/.github/scripts/test_sscep.sh

0 commit comments

Comments
 (0)