File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -95,6 +95,7 @@ TLS_STATIC_TESTS= \
9595
9696# test specific to openssl
9797OSSL_TESTS = \
98+ tls-ossl-certvalid-no-trust-anchor.sh \
9899 tls-wrong-permittedPeer.sh \
99100 tls-wrong-authname.sh \
100101 tls-wrong-signedcert.sh
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ . ${srcdir:= $(pwd)} /test-framework.sh
3+
4+ if ! ./have_tlslib " openssl" ; then
5+ echo ' Skipping test, missing support for openssl in this build'
6+ exit 77
7+ fi
8+
9+ # Keep the default certificate directory empty, but point SSL_CERT_FILE at the
10+ # fixture CA. Without an explicit -x, only an implementation that incorrectly
11+ # loads ownCertFile or OpenSSL default paths can trust these peer certificates.
12+ mkdir -p " ${TESTDIR} /empty-ca-dir"
13+ export SSL_CERT_DIR=" ${TESTDIR} /empty-ca-dir"
14+ export SSL_CERT_FILE=" ${srcdir} /tls-certs/ossl-ca.pem"
15+
16+ errorlog=" ${TESTDIR} /error.log"
17+ startup_receiver -l openssl -T -a " certvalid" \
18+ -y " ${srcdir} /tls-certs/ossl-server-certchain.pem" \
19+ -z " ${srcdir} /tls-certs/ossl-server-key.pem" \
20+ -e " $errorlog "
21+
22+ echo ' Send certificate to server without configured trust anchors...'
23+ if ./send -l openssl -t 127.0.0.1 -p " $TESTPORT " -m " testmessage" \
24+ -T -a " certvalid" \
25+ -y " ${srcdir} /tls-certs/ossl-client-certchain.pem" \
26+ -z " ${srcdir} /tls-certs/ossl-client-key.pem" \
27+ -e " $errorlog " $OPT_VERBOSE 1>> " ${OUTFILE} " 2>&1 ; then
28+ printf ' FAIL: OpenSSL accepted a peer without an explicit trust anchor\n'
29+ stop_receiver
30+ exit 1
31+ fi
32+
33+ stop_receiver
34+ check_output " Server handshake failed" " $errorlog "
35+ terminate
You can’t perform that action at this time.
0 commit comments