Use pzero solutions on servers and clients in addition to ocsp responders
This commit is contained in:
@@ -8,6 +8,7 @@ WORKSPACE=`pwd`
|
||||
CERT_DIR="./certs/ocsp"
|
||||
resume_port=0
|
||||
ready_file=`pwd`/wolf_ocsp_s1_readyF$$
|
||||
ready_file2=`pwd`/wolf_ocsp_s1_readyF2$$
|
||||
printf '%s\n' "ready file: $ready_file"
|
||||
|
||||
test_cnf="ocsp_s1.cnf"
|
||||
@@ -41,6 +42,32 @@ restore_originals() {
|
||||
mv bak-server5-cert.pem server5-cert.pem
|
||||
}
|
||||
|
||||
wait_for_readyFile(){
|
||||
|
||||
counter=0
|
||||
|
||||
while [ ! -s $1 -a "$counter" -lt 20 ]; do
|
||||
echo -e "waiting for ready file..."
|
||||
sleep 0.1
|
||||
counter=$((counter+ 1))
|
||||
done
|
||||
|
||||
if test -e $1; then
|
||||
echo -e "found ready file, starting client..."
|
||||
else
|
||||
echo -e "NO ready file ending test..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
remove_single_rF(){
|
||||
if test -e $1; then
|
||||
printf '%s\n' "removing ready file: $1"
|
||||
rm $1
|
||||
fi
|
||||
}
|
||||
|
||||
#create a configure file for cert generation with the port 0 solution
|
||||
create_new_cnf() {
|
||||
copy_originals
|
||||
@@ -103,6 +130,10 @@ remove_ready_file() {
|
||||
printf '%s\n' "removing ready file"
|
||||
rm $ready_file
|
||||
fi
|
||||
if test -e $ready_file2; then
|
||||
printf '%s\n' "removing ready file: $ready_file2"
|
||||
rm $ready_file2
|
||||
fi
|
||||
}
|
||||
|
||||
cleanup()
|
||||
@@ -128,7 +159,7 @@ fi
|
||||
|
||||
# create a port 0 port to use with openssl ocsp responder
|
||||
./examples/server/server -R $ready_file -p $resume_port &
|
||||
sleep 1
|
||||
wait_for_readyFile $ready_file
|
||||
if [ ! -f $ready_file ]; then
|
||||
printf '%s\n' "Failed to create ready file: \"$ready_file\""
|
||||
exit 1
|
||||
@@ -175,20 +206,24 @@ sleep 1
|
||||
|
||||
printf '%s\n\n' "------------- TEST CASE 1 SHOULD PASS ------------------------"
|
||||
# client test against our own server - GOOD CERT
|
||||
./examples/server/server -c certs/ocsp/server1-cert.pem \
|
||||
-k certs/ocsp/server1-key.pem &
|
||||
sleep 1
|
||||
./examples/client/client -C -A certs/ocsp/root-ca-cert.pem -W 1
|
||||
./examples/server/server -c certs/ocsp/server1-cert.pem -R $ready_file2 \
|
||||
-k certs/ocsp/server1-key.pem -p $resume_port &
|
||||
wait_for_readyFile $ready_file2
|
||||
CLI_PORT=`cat $ready_file2`
|
||||
./examples/client/client -C -A certs/ocsp/root-ca-cert.pem -W 1 -p $CLI_PORT
|
||||
RESULT=$?
|
||||
[ $RESULT -ne 0 ] && printf '\n\n%s\n' "Client connection 2 failed" && exit 1
|
||||
printf '%s\n\n' "Test PASSED!"
|
||||
|
||||
printf '%s\n\n' "------------- TEST CASE 2 SHOULD REVOKE ----------------------"
|
||||
# client test against our own server - REVOKED CERT
|
||||
./examples/server/server -c certs/ocsp/server2-cert.pem \
|
||||
-k certs/ocsp/server2-key.pem &
|
||||
remove_single_rF $ready_file2
|
||||
./examples/server/server -c certs/ocsp/server2-cert.pem -R $ready_file2 \
|
||||
-k certs/ocsp/server2-key.pem -p $resume_port &
|
||||
wait_for_readyFile $ready_file2
|
||||
sleep 1
|
||||
./examples/client/client -C -A certs/ocsp/root-ca-cert.pem -W 1
|
||||
CLI_PORT=`cat $ready_file2`
|
||||
./examples/client/client -C -A certs/ocsp/root-ca-cert.pem -W 1 -p $CLI_PORT
|
||||
RESULT=$?
|
||||
[ $RESULT -ne 1 ] && printf '\n\n%s\n' "Client connection suceeded $RESULT" \
|
||||
&& exit 1
|
||||
@@ -199,20 +234,28 @@ printf '%s\n\n' "Test successfully REVOKED!"
|
||||
if [ $? -ne 0 ]; then
|
||||
printf '%s\n\n' "------------- TEST CASE 3 SHOULD PASS --------------------"
|
||||
# client test against our own server - GOOD CERT
|
||||
./examples/server/server -c certs/ocsp/server1-cert.pem \
|
||||
-k certs/ocsp/server1-key.pem -v 4 &
|
||||
sleep 1
|
||||
./examples/client/client -C -A certs/ocsp/root-ca-cert.pem -W 1 -v 4 -F 1
|
||||
remove_single_rF $ready_file2
|
||||
./examples/server/server -c certs/ocsp/server1-cert.pem -R $ready_file2 \
|
||||
-k certs/ocsp/server1-key.pem -v 4 \
|
||||
-p $resume_port &
|
||||
wait_for_readyFile $ready_file2
|
||||
CLI_PORT=`cat $ready_file2`
|
||||
./examples/client/client -C -A certs/ocsp/root-ca-cert.pem -W 1 -v 4 -F 1 \
|
||||
-p $CLI_PORT
|
||||
RESULT=$?
|
||||
[ $RESULT -ne 0 ] && printf '\n\n%s\n' "Client connection 3 failed" && exit 1
|
||||
printf '%s\n\n' "Test PASSED!"
|
||||
|
||||
printf '%s\n\n' "------------- TEST CASE 4 SHOULD REVOKE ------------------"
|
||||
# client test against our own server - REVOKED CERT
|
||||
./examples/server/server -c certs/ocsp/server2-cert.pem \
|
||||
-k certs/ocsp/server2-key.pem -v 4 &
|
||||
sleep 1
|
||||
./examples/client/client -C -A certs/ocsp/root-ca-cert.pem -W 1 -v 4 -F 1
|
||||
remove_single_rF $ready_file2
|
||||
./examples/server/server -c certs/ocsp/server2-cert.pem -R $ready_file2 \
|
||||
-k certs/ocsp/server2-key.pem -v 4 \
|
||||
-p $resume_port &
|
||||
wait_for_readyFile $ready_file2
|
||||
CLI_PORT=`cat $ready_file2`
|
||||
./examples/client/client -C -A certs/ocsp/root-ca-cert.pem -W 1 -v 4 -F 1 \
|
||||
-p $CLI_PORT
|
||||
RESULT=$?
|
||||
[ $RESULT -ne 1 ] && \
|
||||
printf '\n\n%s\n' "Client connection suceeded $RESULT" \
|
||||
|
||||
Reference in New Issue
Block a user