diff options
author | Jeremy Harris <jgh146exb@wizmail.org> | 2019-10-17 21:45:32 +0100 |
---|---|---|
committer | Jeremy Harris <jgh146exb@wizmail.org> | 2019-10-17 21:45:32 +0100 |
commit | 86ede124f0ce622b4f73e05504abc11fece021e3 (patch) | |
tree | 1ec851a5ca9a6ec6986bbe1aeb1f5f00a7933b09 /test | |
parent | 6f47da8d2d526953e8e6403f448d1598c9140df1 (diff) |
OpenSSL: full-chain OCSP stapling. Bug 1466
Diffstat (limited to 'test')
-rw-r--r-- | test/aux-fixed/exim-ca/example.com/server1.example.com/fullchain.ocsp.resp.pem | 52 | ||||
-rwxr-xr-x | test/aux-fixed/exim-ca/genall | 27 | ||||
l--------- | test/confs/5615 | 1 | ||||
-rw-r--r-- | test/confs/5655 | 35 | ||||
-rw-r--r-- | test/log/5615 | 16 | ||||
-rw-r--r-- | test/log/5655 | 3 | ||||
-rw-r--r-- | test/scripts/5615-OCSP-OpenSSL-1.3/5615 | 54 | ||||
-rw-r--r-- | test/scripts/5615-OCSP-OpenSSL-1.3/REQUIRES | 4 | ||||
-rw-r--r-- | test/scripts/5655-OCSP-GnuTLS-1.3/5655 | 4 | ||||
-rw-r--r-- | test/src/server.c | 3 |
10 files changed, 161 insertions, 38 deletions
diff --git a/test/aux-fixed/exim-ca/example.com/server1.example.com/fullchain.ocsp.resp.pem b/test/aux-fixed/exim-ca/example.com/server1.example.com/fullchain.ocsp.resp.pem new file mode 100644 index 000000000..9667e069c --- /dev/null +++ b/test/aux-fixed/exim-ca/example.com/server1.example.com/fullchain.ocsp.resp.pem @@ -0,0 +1,52 @@ +OCSP Response Information: + Response Status: Successful + Response Type: Basic OCSP Response + Version: 1 + Responder ID: CN=clica CA rsa,O=example.com + Produced At: Thu Oct 10 20:08:22 UTC 2019 + Responses: + Certificate ID: + Hash Algorithm: SHA256 + Issuer Name Hash: 5af082e51d62fe01fd706baebeb878db64e68f76e74a36f36d914297ddee24b8 + Issuer Key Hash: 333db14364b98e78a33dd8a4fae8d8378ea9b0f5fbca97b25685aa0d32116091 + Serial Number: 65 + Certificate Status: good + This Update: Thu Oct 10 20:08:22 UTC 2019 + Next Update: Tue Oct 09 20:08:22 UTC 2029 + Certificate ID: + Hash Algorithm: SHA256 + Issuer Name Hash: bfa7275a566efd4be2df82dbd9d1290d470186f6ff2acd8c16659f342ab56109 + Issuer Key Hash: 208f9d28c7c0bc914144dfa8c0be3d5b3bfcebb622c8a8dc27e865fc06ca0e12 + Serial Number: 42 + Certificate Status: good + This Update: Thu Oct 10 20:08:22 UTC 2019 + Next Update: Tue Oct 09 20:08:22 UTC 2029 + Certificate ID: + Hash Algorithm: SHA256 + Issuer Name Hash: bfa7275a566efd4be2df82dbd9d1290d470186f6ff2acd8c16659f342ab56109 + Issuer Key Hash: 208f9d28c7c0bc914144dfa8c0be3d5b3bfcebb622c8a8dc27e865fc06ca0e12 + Serial Number: 41 + Certificate Status: good + This Update: Thu Oct 10 20:08:22 UTC 2019 + Next Update: Tue Oct 09 20:08:22 UTC 2029 + Extensions: + Signature Algorithm: RSA-SHA256 + +-----BEGIN OCSP RESPONSE----- +MIIC/AoBAKCCAvUwggLxBgkrBgEFBQcwAQEEggLiMIIC3jCCAcahLzAtMRQwEgYD +VQQKEwtleGFtcGxlLmNvbTEVMBMGA1UEAxMMY2xpY2EgQ0EgcnNhGA8yMDE5MTAx +MDIwMDgyMlowggGAMH4wVjANBglghkgBZQMEAgEFAAQgWvCC5R1i/gH9cGuuvrh4 +22Tmj3bnSjbzbZFCl93uJLgEIDM9sUNkuY54oz3YpPro2DeOqbD1+8qXslaFqg0y +EWCRAgFlgAAYDzIwMTkxMDEwMjAwODIyWqARGA8yMDI5MTAwOTIwMDgyMlowfjBW +MA0GCWCGSAFlAwQCAQUABCC/pydaVm79S+LfgtvZ0SkNRwGG9v8qzYwWZZ80KrVh +CQQgII+dKMfAvJFBRN+owL49Wzv867YiyKjcJ+hl/AbKDhICAUKAABgPMjAxOTEw +MTAyMDA4MjJaoBEYDzIwMjkxMDA5MjAwODIyWjB+MFYwDQYJYIZIAWUDBAIBBQAE +IL+nJ1pWbv1L4t+C29nRKQ1HAYb2/yrNjBZlnzQqtWEJBCAgj50ox8C8kUFE36jA +vj1bO/zrtiLIqNwn6GX8BsoOEgIBQYAAGA8yMDE5MTAxMDIwMDgyMlqgERgPMjAy +OTEwMDkyMDA4MjJaMA0GCSqGSIb3DQEBCwUAA4IBAQBm8uLIawRny88oLSzr7sxj +IgGjhC+S2OXWjAlTxErHoEsJ0JPKkQAt/s5YLy4IKiPbCg6CIm9KotgE4vnpMFjg +297pSrdYKdtb2iBPKq5afB2Iv6ET78L/j2HhBFyJaxlt6lhI0Ly6JE75IbUrdP24 +c5uIh+KpJaC60bTZehgcRnrw9fR7HJ5W9ln9mbOZDggNQeM9hmFLUmQYPQWxav2x +IjCYAZOfIp8ficETnLhuDuILsohFRnQnFAaf1YTgvW2zoKLMeLUWzMm8a6IoBpXQ +0ecpPJs2FFiaYL78EcRNN47YbClcfDQRAjTvlSZupk59YuxedlwiH6uc7Cwa3RnN +-----END OCSP RESPONSE----- diff --git a/test/aux-fixed/exim-ca/genall b/test/aux-fixed/exim-ca/genall index 8efda889f..6998108b0 100755 --- a/test/aux-fixed/exim-ca/genall +++ b/test/aux-fixed/exim-ca/genall @@ -75,12 +75,6 @@ do #### - # so, for full-chain OCSP we sill want an OCSP resp for the Signer cert and also (?) one for the - # CA cert itself. The existing bits below only create for the leaf certs, next layer down. - # - # First test will be just adding OCSP for the Signer cert. Presumably we could use the CA cert - # to sign that. - # create OCSP reqs & resps CADIR=$idir/CA @@ -160,11 +154,11 @@ EOF done # convert one good leaf-resp to PEM - $server=server1 + server=server1 RESP=$idir/$server.$iname/$server.$iname.ocsp.signernocert.good.resp ocsptool -S $RESP -j > $RESP.pem - # Then, ocsp request and responses for the signer cert + # Then, ocsp request and (valid, revoked) responses for the signer cert REQ=$CADIR/Signer.ocsp.req RESP=$CADIR/Signer.ocsp.signernocert.good.resp openssl ocsp -issuer $CADIR/CA.pem -sha256 -cert $CADIR/Signer.pem -no_nonce -reqout $REQ @@ -177,11 +171,18 @@ EOF -ndays 3652 -reqin $REQ -respout $RESP ocsptool -S $RESP -j > $RESP.pem - # Then, ocsp request and response for the CA cert - REQ=$CADIR/CA.ocsp.req - RESP=$CADIR/CA.ocsp.signernocert.good.resp - openssl ocsp -issuer $CADIR/CA.pem -sha256 -cert $CADIR/CA.pem -no_nonce -reqout $REQ - openssl ocsp $IVALID -rsigner $CADIR/CA.pem -rkey $CADIR/CA.key -CA $CADIR/CA.pem -resp_no_certs -noverify \ + # Finally, a full-chain all-good request and response + REQ=$idir/$server.$iname/fullchain.ocsp.req + leafcert=$idir/$server.$iname/$server.$iname.pem + signercert=$CADIR/Signer.pem + cacert=$CADIR/CA.pem + openssl ocsp -sha256 -no_nonce -reqout $REQ \ + -issuer $signercert -cert $leafcert \ + -issuer $cacert -cert $CADIR/Signer.pem -cert $CADIR/CA.pem + + RESP=$idir/$server.$iname/fullchain.ocsp.resp + authorities=$idir/$server.$iname/ca_chain.pem + openssl ocsp $IVALID -rsigner $CADIR/CA.pem -rkey $CADIR/CA.key -CA $authorities -resp_no_certs -noverify \ -ndays 3652 -reqin $REQ -respout $RESP ocsptool -S $RESP -j > $RESP.pem diff --git a/test/confs/5615 b/test/confs/5615 new file mode 120000 index 000000000..36c91e7a2 --- /dev/null +++ b/test/confs/5615 @@ -0,0 +1 @@ +5655
\ No newline at end of file diff --git a/test/confs/5655 b/test/confs/5655 index 0f6fe1b98..6fbd7c12a 100644 --- a/test/confs/5655 +++ b/test/confs/5655 @@ -1,5 +1,5 @@ # Exim test configuration 5655 -# OCSP stapling, server, multiple chain-element OCSP +# OCSP stapling, server, multiple chain-element OCSP. Both GnuTLS and OpenSSL. .include DIR/aux-var/tls_conf_prefix @@ -7,7 +7,6 @@ primary_hostname = server1.example.com # ----- Main settings ----- -acl_smtp_connect = accept logwrite = ${env {SSLKEYLOGFILE}} acl_smtp_mail = check_mail acl_smtp_rcpt = check_recipient @@ -22,23 +21,24 @@ CADIR = DIR/aux-fixed/exim-ca DRSA = CADIR/example.com DECDSA = CADIR/example_ec.com -tls_certificate = DRSA/server1.example.com/fullchain.pem \ - : DECDSA/server1.example_ec.com/server1.example_ec.com.pem -tls_privatekey = DRSA/server1.example.com/server1.example.com.unlocked.key \ - : DECDSA/server1.example_ec.com/server1.example_ec.com.unlocked.key +tls_certificate = DRSA/server1.example.com/fullchain.pem +tls_privatekey = DRSA/server1.example.com/server1.example.com.unlocked.key .ifndef CONTROL -tls_ocsp_file = PEM DIR/tmp/ocsp/triple.ocsp.pem \ - : DER DECDSA/server1.example_ec.com/server1.example_ec.com.ocsp.good.resp +tls_ocsp_file = PEM DRSA/server1.example.com/fullchain.ocsp.resp.pem .else -tls_ocsp_file = PEM DIR/tmp/ocsp/double_r.ocsp.pem \ - : DER DECDSA/server1.example_ec.com/server1.example_ec.com.ocsp.good.resp +tls_ocsp_file = PEM DIR/tmp/ocsp/double_r.ocsp.pem .endif .ifdef _HAVE_GNUTLS tls_require_ciphers = ${if eq {LIMIT}{TLS1.2} {NORMAL:!VERS-ALL:+VERS-TLS1.2} {}} .endif +.ifdef _HAVE_OPENSSL +.ifdef LIMIT +openssl_options = ${if eq {LIMIT}{TLS1.2} {+no_tlsv1_3} {}} +.endif +.endif # ------ ACL ------ @@ -79,21 +79,18 @@ remote_delivery: driver = smtp port = PORT_D hosts_require_tls = * -.ifdef _HAVE_GNUTLS +.ifdef _HAVE_GNUTLS tls_require_ciphers = ${if eq {LIMIT}{TLS1.2} \ {NONE:\ - ${if eq {OPT}{rsa} \ - {+SIGN-RSA-SHA256:+VERS-TLS-ALL:+ECDHE-RSA:+DHE-RSA:+RSA} \ - {+SIGN-ECDSA-SHA512:+VERS-TLS-ALL:+KX-ALL}}\ + +SIGN-RSA-SHA256:+VERS-TLS-ALL:+ECDHE-RSA:+DHE-RSA:+RSA\ :+CIPHER-ALL:+MAC-ALL:+COMP-NULL:+CURVE-ALL:+CTYPE-X509} \ {}} - tls_verify_certificates = CADIR/\ - ${if eq {OPT}{rsa} \ - {example.com/server1.example.com} \ - {example_ec.com/server1.example_ec.com}}\ - /ca_chain.pem .endif +.ifdef _HAVE_OPENSSL + tls_require_ciphers = RSA +.endif + tls_verify_certificates = CADIR/example.com/server1.example.com/ca_chain.pem hosts_require_ocsp = * tls_verify_cert_hostnames = : diff --git a/test/log/5615 b/test/log/5615 new file mode 100644 index 000000000..314fd91d8 --- /dev/null +++ b/test/log/5615 @@ -0,0 +1,16 @@ +1999-03-02 09:44:33 1: TLS1.2 Server sends good leaf-staple on request, to client requiring RSA auth +1999-03-02 09:44:33 10HmaX-0005vi-00 <= CALLER@server1.example.com U=CALLER P=local S=sss +1999-03-02 09:44:33 10HmaX-0005vi-00 => rsa.auth@test.ex R=client T=remote_delivery H=127.0.0.1 [127.0.0.1] X=TLS1.x:ke-RSA-AES256-SHAnnn:xxx CV=yes DN="/CN=server1.example.com" C="250 OK id=10HmaY-0005vi-00" +1999-03-02 09:44:33 10HmaX-0005vi-00 Completed +1999-03-02 09:44:33 2: TLS1.3 Server sends good 3-element staple on request, to client requiring RSA auth +1999-03-02 09:44:33 10HmaZ-0005vi-00 <= CALLER@server1.example.com U=CALLER P=local S=sss +1999-03-02 09:44:33 10HmaZ-0005vi-00 => rsa.auth@test.ex R=client T=remote_delivery H=127.0.0.1 [127.0.0.1] X=TLS1.x:ke-RSA-AES256-SHAnnn:xxx CV=yes DN="/CN=server1.example.com" C="250 OK id=10HmbA-0005vi-00" +1999-03-02 09:44:33 10HmaZ-0005vi-00 Completed + +******** SERVER ******** +1999-03-02 09:44:33 exim x.yz daemon started: pid=pppp, no queue runs, listening for SMTP on port PORT_D +1999-03-02 09:44:33 acl_mail: ocsp in status: 4 (verified) +1999-03-02 09:44:33 10HmaY-0005vi-00 <= <> H=localhost (server1.example.com) [127.0.0.1] P=esmtps X=TLS1.x:ke-RSA-AES256-SHAnnn:xxx CV=no S=sss id=E10HmaX-0005vi-00@server1.example.com +1999-03-02 09:44:33 exim x.yz daemon started: pid=pppp, no queue runs, listening for SMTP on port PORT_D +1999-03-02 09:44:33 acl_mail: ocsp in status: 4 (verified) +1999-03-02 09:44:33 10HmbA-0005vi-00 <= <> H=localhost (server1.example.com) [127.0.0.1] P=esmtps X=TLS1.x:ke-RSA-AES256-SHAnnn:xxx CV=no S=sss id=E10HmaZ-0005vi-00@server1.example.com diff --git a/test/log/5655 b/test/log/5655 index 9275ad1a5..9936c8592 100644 --- a/test/log/5655 +++ b/test/log/5655 @@ -15,13 +15,10 @@ ******** SERVER ******** 1999-03-02 09:44:33 exim x.yz daemon started: pid=pppp, no queue runs, listening for SMTP on port PORT_D -1999-03-02 09:44:33 TESTSUITE/spool/sslkeys 1999-03-02 09:44:33 acl_mail: ocsp in status: 4 (verified) 1999-03-02 09:44:33 10HmaY-0005vi-00 <= <> H=localhost (server1.example.com) [127.0.0.1] P=esmtps X=TLS1.x:ke-RSA-AES256-SHAnnn:xxx CV=no S=sss id=E10HmaX-0005vi-00@server1.example.com 1999-03-02 09:44:33 exim x.yz daemon started: pid=pppp, no queue runs, listening for SMTP on port PORT_D -1999-03-02 09:44:33 TESTSUITE/spool/sslkeys 1999-03-02 09:44:33 acl_mail: ocsp in status: 1 (notresp) 1999-03-02 09:44:33 10HmbA-0005vi-00 <= <> H=localhost (server1.example.com) [127.0.0.1] P=esmtps X=TLS1.x:ke-RSA-AES256-SHAnnn:xxx CV=no S=sss id=E10HmaZ-0005vi-00@server1.example.com 1999-03-02 09:44:33 exim x.yz daemon started: pid=pppp, no queue runs, listening for SMTP on port PORT_D -1999-03-02 09:44:33 TESTSUITE/spool/sslkeys 1999-03-02 09:44:33 TLS error on connection from localhost [127.0.0.1] (recv): The TLS connection was non-properly terminated. diff --git a/test/scripts/5615-OCSP-OpenSSL-1.3/5615 b/test/scripts/5615-OCSP-OpenSSL-1.3/5615 new file mode 100644 index 000000000..17d5f7a0e --- /dev/null +++ b/test/scripts/5615-OCSP-OpenSSL-1.3/5615 @@ -0,0 +1,54 @@ +# OCSP stapling, server, multiple chain-element OCSP +# +# +# +# +exim -z '1: TLS1.2 Server sends good leaf-staple on request, to client requiring RSA auth' +**** +# +exim -bd -oX PORT_D -DSERVER=server -DLIMIT=TLS1.2 +**** +# +exim -odf -DOPT=rsa -DLIMIT=TLS1.2 rsa.auth@test.ex +Subject: test + +. +**** +killdaemon +# +# +exim -z '2: TLS1.3 Server sends good 3-element staple on request, to client requiring RSA auth' +**** +# +# Works when the (single) proof file has an ocsp-response with 3 statusses. +# Contrast with with GnuTLS which can do either that or have 3 proof files +# each with one status. +# +exim -bd -oX PORT_D -DSERVER=server -DLIMIT=TLS1.3 +**** +exim -odf -DOPT=rsa rsa.auth@test.ex +Subject: test + +. +**** +killdaemon +# +## +## +#exim -z '3: TLS1.3 Server sends bad nonleaf staple, client detects it' +#**** +## +#EXIM_TESTHARNESS_DISABLE_OCSPVALIDITYCHECK=y exim -bd -oX PORT_D -DSERVER=server -DLIMIT=TLS1.3 -DCONTROL=bad +#**** +#exim -odf -DOPT=rsa rsa.auth@test.ex +#Subject: test +# +#. +#**** +#killdaemon +## +## +# +# +sudo rm -fr tmp/ +no_msglog_check diff --git a/test/scripts/5615-OCSP-OpenSSL-1.3/REQUIRES b/test/scripts/5615-OCSP-OpenSSL-1.3/REQUIRES new file mode 100644 index 000000000..7df03fbe8 --- /dev/null +++ b/test/scripts/5615-OCSP-OpenSSL-1.3/REQUIRES @@ -0,0 +1,4 @@ +support OpenSSL +support OCSP +running IPv4 +feature _HAVE_TLS1_3 diff --git a/test/scripts/5655-OCSP-GnuTLS-1.3/5655 b/test/scripts/5655-OCSP-GnuTLS-1.3/5655 index 25ebdfd6b..1df75fbf9 100644 --- a/test/scripts/5655-OCSP-GnuTLS-1.3/5655 +++ b/test/scripts/5655-OCSP-GnuTLS-1.3/5655 @@ -7,7 +7,6 @@ sudo chown -R EXIMUSER:EXIMGROUP tmp sudo chmod -R a+rwx DIR/tmp/ocsp perl chdir 'aux-fixed/exim-ca/example.com'; -system 'cat server1.example.com/server1.example.com.ocsp.signernocert.good.resp.pem CA/Signer.ocsp.signernocert.good.resp.pem CA/CA.ocsp.signernocert.good.resp.pem > DIR/tmp/ocsp/triple.ocsp.pem'; system 'cat server1.example.com/server1.example.com.ocsp.signernocert.good.resp.pem CA/Signer.ocsp.signernocert.revoked.resp.pem > DIR/tmp/ocsp/double_r.ocsp.pem'; **** # @@ -15,7 +14,7 @@ system 'cat server1.example.com/server1.example.com.ocsp.signernocert.good.resp. exim -z '1: TLS1.2 Server sends good leaf-staple on request, to client requiring RSA auth' **** # -exim -bd -oX PORT_D -DSERVER=server -DLIMIT=TLS1.2 +sudo exim -bd -oX PORT_D -DSERVER=server -DLIMIT=TLS1.2 **** # exim -odf -DOPT=rsa -DLIMIT=TLS1.2 rsa.auth@test.ex @@ -29,6 +28,7 @@ killdaemon exim -z '2: TLS1.3 Server sends good 3-element staple on request, to client requiring RSA auth' **** # +# Prefix with sudo to get SSLKEYLOGFILE to work. Only works on the server. exim -bd -oX PORT_D -DSERVER=server -DLIMIT=TLS1.3 **** exim -odf -DOPT=rsa rsa.auth@test.ex diff --git a/test/src/server.c b/test/src/server.c index 4cf126068..c1f1ecf21 100644 --- a/test/src/server.c +++ b/test/src/server.c @@ -159,7 +159,8 @@ putchar('\n'); #define udn 2 /* Unix domain socket number */ #define skn 2 /* Potential number of sockets */ -int main(int argc, char **argv) +int +main(int argc, char **argv) { int i; int port = 0; |