Welcome! Log In Create A New Profile

Advanced

Re: [PATCH 19 of 20] Tests: removed multiple server certificates from ssl_ocsp.t

Maxim Dounin
March 23, 2023 10:18AM
Hello!

On Wed, Mar 22, 2023 at 03:05:16PM +0400, Sergey Kandaurov wrote:

> > On 18 Mar 2023, at 18:15, Maxim Dounin <mdounin@mdounin.ru> wrote:
> >
> > # HG changeset patch
> > # User Maxim Dounin <mdounin@mdounin.ru>
> > # Date 1679148855 -10800
> > # Sat Mar 18 17:14:15 2023 +0300
> > # Node ID 782531c3cd79dcf700276e10bef00e524de009d1
> > # Parent c140f78fbc8f62c9694d3b969d1309570a96f2e7
> > Tests: removed multiple server certificates from ssl_ocsp.t.
> >
> > Multiple server certificates are not needed to test OCSP verification of
> > client certificates (in contrast to OCSP stapling, where server certificates
> > are verified, and different staples should be correctly returned with
> > different server certificates). And using multiple server certificates
> > causes issues when testing with LibreSSL due to broken sigalgs-based
> > server certificate selection in LibreSSL with TLSv1.3.
> >
> > Accordingly, the test is simplified to do not use multiple server
> > certificates.
> >
> > diff --git a/ssl_ocsp.t b/ssl_ocsp.t
> > --- a/ssl_ocsp.t
> > +++ b/ssl_ocsp.t
> > @@ -63,10 +63,7 @@ http {
> > ssl_verify_depth 2;
> > ssl_client_certificate trusted.crt;
> >
> > - ssl_ciphers DEFAULT:ECCdraft;
> > -
> > - ssl_certificate_key ec.key;
> > - ssl_certificate ec.crt;
> > +# ssl_ciphers DEFAULT:ECCdraft;
>
> This doesn't serve its purpose now and can be removed,
> now that you've removed multiple (ECC) certificates.
> It was used to run tests with ECC certificates/ciphers,
> as otherwise it would result in "no shared cipher" error.
>
> ECCdraft is an old alias used to enable ECC ciphersuites
> and run tests with ECC certificate on OpenSSL 0.9.8,
> before they became official in RFC 4492.
>
> - ECC ciphersuites were disabled by default in 0.9.8c,
> and ECCdraft alias was used to turn them back.
> - ECC ciphersuites were re-enabled in 0.9.9 (1.0.0)

Err, thanks for catching. I actually commented it out to make
sure it's safe to remove it now, but forgot to actually remove.
Removed.

> >
> > ssl_certificate_key rsa.key;
> > ssl_certificate rsa.crt;
> > @@ -273,13 +270,8 @@ system("openssl ocsp -index $d/certindex
> >
> > # server cert/key
> >
> > -system("openssl ecparam -genkey -out $d/ec.key -name prime256v1 "
> > - . ">>$d/openssl.out 2>&1") == 0 or die "Can't create EC pem: $!\n";
> > -system("openssl genrsa -out $d/rsa.key 2048 >>$d/openssl.out 2>&1") == 0
> > - or die "Can't create RSA pem: $!\n";
> > -
> > -foreach my $name ('ec', 'rsa') {
> > - system("openssl req -x509 -new -key $d/$name.key "
> > +foreach my $name ('rsa') {
> > + system('openssl req -x509 -new '
> > . "-config $d/openssl.conf -subj /CN=$name/ "
> > . "-out $d/$name.crt -keyout $d/$name.key "
> > . ">>$d/openssl.out 2>&1") == 0
> > @@ -288,7 +280,7 @@ foreach my $name ('ec', 'rsa') {
> >
> > $t->run_daemon(\&http_daemon, $t, port(8081));
> > $t->run_daemon(\&http_daemon, $t, port(8082));
> > -$t->run()->plan(14);
> > +$t->run()->plan(15);
> >
> > $t->waitforsocket("127.0.0.1:" . port(8081));
> > $t->waitforsocket("127.0.0.1:" . port(8082));
> > @@ -297,17 +289,17 @@ my $version = get_version();
> >
> > ###############################################################################
> >
> > -like(get('RSA', 'end'), qr/200 OK.*SUCCESS/s, 'ocsp leaf');
> > +like(get('end'), qr/200 OK.*SUCCESS/s, 'ocsp leaf');
> >
> > # demonstrate that ocsp int request is failed due to missing resolver
> >
> > -like(get('RSA', 'end', sni => 'resolver'),
> > +like(get('end', sni => 'resolver'),
> > qr/400 Bad.*FAILED:certificate status request failed/s,
> > 'ocsp many failed request');
> >
> > # demonstrate that ocsp int request is actually made by failing ocsp response
> >
> > -like(get('RSA', 'end', port => 8444),
> > +like(get('end', port => 8444),
> > qr/400 Bad.*FAILED:certificate status request failed/s,
> > 'ocsp many failed');
> >
> > @@ -323,11 +315,11 @@ system("openssl ocsp -index $d/certindex
> > . ">>$d/openssl.out 2>&1") == 0
> > or die "Can't create OCSP response: $!\n";
> >
> > -like(get('RSA', 'end', port => 8444), qr/200 OK.*SUCCESS/s, 'ocsp many');
> > +like(get('end', port => 8444), qr/200 OK.*SUCCESS/s, 'ocsp many');
> >
> > # store into ssl_ocsp_cache
> >
> > -like(get('RSA', 'end', port => 8446), qr/200 OK.*SUCCESS/s, 'cache store');
> > +like(get('end', port => 8446), qr/200 OK.*SUCCESS/s, 'cache store');
> >
> > # revoke
> >
> > @@ -346,23 +338,23 @@ system("openssl ocsp -index $d/certindex
> > . ">>$d/openssl.out 2>&1") == 0
> > or die "Can't create OCSP response: $!\n";
> >
> > -like(get('RSA', 'end'), qr/400 Bad.*FAILED:certificate revoked/s, 'revoked');
> > +like(get('end'), qr/400 Bad.*FAILED:certificate revoked/s, 'revoked');
> >
> > # with different responder where it's still valid
> >
> > -like(get('RSA', 'end', port => 8445), qr/200 OK.*SUCCESS/s, 'ocsp responder');
> > +like(get('end', port => 8445), qr/200 OK.*SUCCESS/s, 'ocsp responder');
> >
> > # with different context to responder where it's still valid
> >
> > -like(get('RSA', 'end', sni => 'sni'), qr/200 OK.*SUCCESS/s, 'ocsp context');
> > +like(get('end', sni => 'sni'), qr/200 OK.*SUCCESS/s, 'ocsp context');
> >
> > # with cached ocsp response it's still valid
> >
> > -like(get('RSA', 'end', port => 8446), qr/200 OK.*SUCCESS/s, 'cache lookup');
> > +like(get('end', port => 8446), qr/200 OK.*SUCCESS/s, 'cache lookup');
> >
> > # ocsp end response signed with invalid (root) cert, expect HTTP 400
> >
> > -like(get('ECDSA', 'ec-end'),
> > +like(get('ec-end'),
> > qr/400 Bad.*FAILED:certificate status request failed/s,
> > 'root ca not trusted');
> >
> > @@ -374,12 +366,12 @@ system("openssl ocsp -index $d/certindex
> > . ">>$d/openssl.out 2>&1") == 0
> > or die "Can't create EC OCSP response: $!\n";
> >
> > -like(get('ECDSA', 'ec-end'), qr/200 OK.*SUCCESS/s, 'ocsp ecdsa');
> > +like(get('ec-end'), qr/200 OK.*SUCCESS/s, 'ocsp ecdsa');
> >
> > -my ($s, $ssl) = get('ECDSA', 'ec-end');
> > +my ($s, $ssl) = get('ec-end');
> > my $ses = Net::SSLeay::get_session($ssl);
> >
> > -like(get('ECDSA', 'ec-end', ses => $ses),
> > +like(get('ec-end', ses => $ses),
> > qr/200 OK.*SUCCESS:r/s, 'session reused');
> >
> > # revoke with saved session
> > @@ -401,19 +393,22 @@ system("openssl ocsp -index $d/certindex
> >
> > # reusing session with revoked certificate
> >
> > -like(get('ECDSA', 'ec-end', ses => $ses),
> > +like(get('ec-end', ses => $ses),
> > qr/400 Bad.*FAILED:certificate revoked:r/s, 'session reused - revoked');
> >
> > # regression test for self-signed
> >
> > -like(get('RSA', 'root', port => 8447), qr/200 OK.*SUCCESS/s, 'ocsp one');
> > +like(get('root', port => 8447), qr/200 OK.*SUCCESS/s, 'ocsp one');
> > +
> > +# check for errors
> > +
> > +like(`grep -F '[crit]' ${\($t->testdir())}/error.log`, qr/^$/s, 'no crit');
> >
> > ###############################################################################
> >
> > sub get {
> > - my ($type, $cert, %extra) = @_;
> > - $type = 'PSS' if $type eq 'RSA' && $version > 0x0303;
> > - my ($s, $ssl) = get_ssl_socket($type, $cert, %extra);
> > + my ($cert, %extra) = @_;
> > + my ($s, $ssl) = get_ssl_socket($cert, %extra);
> > my $cipher = Net::SSLeay::get_cipher($ssl);
> > Test::Nginx::log_core('||', "cipher: $cipher");
> > my $host = $extra{sni} ? $extra{sni} : 'localhost';
> > @@ -428,7 +423,7 @@ sub get {
> > }
> >
> > sub get_ssl_socket {
> > - my ($type, $cert, %extra) = @_;
> > + my ($cert, %extra) = @_;
> > my $ses = $extra{ses};
> > my $sni = $extra{sni};
> > my $port = $extra{port} || 8443;
> > @@ -450,18 +445,6 @@ sub get_ssl_socket {
> >
> > my $ctx = Net::SSLeay::CTX_new() or die("Failed to create SSL_CTX $!");
> >
> > - if (defined $type) {
> > - my $ssleay = Net::SSLeay::SSLeay();
> > - if ($ssleay < 0x1000200f || $ssleay == 0x20000000) {
> > - Net::SSLeay::CTX_set_cipher_list($ctx, $type)
> > - or die("Failed to set cipher list");
> > - } else {
> > - # SSL_CTRL_SET_SIGALGS_LIST
> > - Net::SSLeay::CTX_ctrl($ctx, 98, 0, $type . '+SHA256')
> > - or die("Failed to set sigalgs");
> > - }
> > - }
> > -
> > Net::SSLeay::set_cert_and_key($ctx, "$d/$cert.crt", "$d/$cert.key")
> > or die if $cert;
> > my $ssl = Net::SSLeay::new($ctx) or die("Failed to create SSL $!");

--
Maxim Dounin
http://mdounin.ru/
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
https://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[PATCH 00 of 20] tests suite fixes for TLSv1.3

Maxim Dounin 534 March 18, 2023 10:18AM

[PATCH 03 of 20] Tests: separate SSL session reuse tests in mail

Maxim Dounin 154 March 18, 2023 10:18AM

Re: [PATCH 03 of 20] Tests: separate SSL session reuse tests in mail

Sergey Kandaurov 130 March 22, 2023 05:22AM

Re: [PATCH 03 of 20] Tests: separate SSL session reuse tests in mail

Maxim Dounin 122 March 23, 2023 10:18AM

Re: [PATCH 03 of 20] Tests: separate SSL session reuse tests in mail

Sergey Kandaurov 144 March 22, 2023 05:48AM

Re: [PATCH 03 of 20] Tests: separate SSL session reuse tests in mail

Maxim Dounin 129 March 23, 2023 10:16AM

Re: [PATCH 03 of 20] Tests: separate SSL session reuse tests in mail

Sergey Kandaurov 125 March 23, 2023 12:00PM

[PATCH 01 of 20] Tests: separate SSL session reuse tests

Maxim Dounin 203 March 18, 2023 10:18AM

Re: [PATCH 01 of 20] Tests: separate SSL session reuse tests

Sergey Kandaurov 189 March 22, 2023 04:58AM

Re: [PATCH 01 of 20] Tests: separate SSL session reuse tests

Maxim Dounin 131 March 23, 2023 10:12AM

Re: [PATCH 01 of 20] Tests: separate SSL session reuse tests

Sergey Kandaurov 123 March 23, 2023 12:00PM

Re: [PATCH 01 of 20] Tests: separate SSL session reuse tests

Maxim Dounin 172 March 23, 2023 01:26PM

Re: [PATCH 01 of 20] Tests: separate SSL session reuse tests

Sergey Kandaurov 185 March 24, 2023 08:40AM

[PATCH 08 of 20] Tests: enabled session reuse via TLS session tickets

Maxim Dounin 130 March 18, 2023 10:20AM

[PATCH 07 of 20] Tests: BoringSSL does not provide session ids with TLSv1.3

Maxim Dounin 139 March 18, 2023 10:20AM

[PATCH 09 of 20] Tests: restored proper port numbers in ssl_sni_sessions.t

Maxim Dounin 132 March 18, 2023 10:20AM

[PATCH 10 of 20] Tests: disabled ssl_sni_sessions.t with LibreSSL and BoringSSL

Maxim Dounin 149 March 18, 2023 10:20AM

[PATCH 05 of 20] Tests: separate SSL session reuse tests in stream

Maxim Dounin 144 March 18, 2023 10:20AM

Re: [PATCH 05 of 20] Tests: separate SSL session reuse tests in stream

Sergey Kandaurov 141 March 22, 2023 05:56AM

Re: [PATCH 05 of 20] Tests: separate SSL session reuse tests in stream

Maxim Dounin 122 March 23, 2023 10:18AM

[PATCH 06 of 20] Tests: LibreSSL and BoringSSL session reuse with TLSv1.3 in mail

Maxim Dounin 131 March 18, 2023 10:20AM

Re: [PATCH 06 of 20] Tests: LibreSSL and BoringSSL session reuse with TLSv1.3 in mail

Sergey Kandaurov 129 March 22, 2023 06:00AM

Re: [PATCH 06 of 20] Tests: LibreSSL and BoringSSL session reuse with TLSv1.3 in mail

Maxim Dounin 118 March 23, 2023 10:18AM

[PATCH 12 of 20] Tests: fixed ssl_session_ticket_key.t with LibreSSL and TLSv1.3

Maxim Dounin 113 March 18, 2023 10:20AM

[PATCH 13 of 20] Tests: fixed ssl_sni.t with LibreSSL and TLSv1.3

Maxim Dounin 170 March 18, 2023 10:20AM

[PATCH 11 of 20] Tests: fixed proxy_ssl.t with LibreSSL and TLSv1.3

Maxim Dounin 161 March 18, 2023 10:20AM

[PATCH 14 of 20] Tests: LibreSSL certificate negotiation with TLSv1.3

Maxim Dounin 200 March 18, 2023 10:20AM

[PATCH 15 of 20] Tests: LibreSSL does not send CA lists with TLSv1.3

Maxim Dounin 160 March 18, 2023 10:20AM

Re: [PATCH 15 of 20] Tests: LibreSSL does not send CA lists with TLSv1.3

Sergey Kandaurov 144 March 22, 2023 06:40AM

[PATCH 16 of 20] Tests: fixed stream_proxy_ssl.t with LibreSSL and TLSv1.3

Maxim Dounin 193 March 18, 2023 10:20AM

[PATCH 18 of 20] Tests: cleaned up ssl_ocsp.t

Maxim Dounin 159 March 18, 2023 10:20AM

[PATCH 20 of 20] Tests: fixed ssl_ocsp.t with LibreSSL and TLSv1.3

Maxim Dounin 166 March 18, 2023 10:20AM

Re: [PATCH 20 of 20] Tests: fixed ssl_ocsp.t with LibreSSL and TLSv1.3

Sergey Kandaurov 152 March 22, 2023 07:12AM

Re: [PATCH 20 of 20] Tests: fixed ssl_ocsp.t with LibreSSL and TLSv1.3

Maxim Dounin 134 March 23, 2023 10:20AM

[PATCH 19 of 20] Tests: removed multiple server certificates from ssl_ocsp.t

Maxim Dounin 150 March 18, 2023 10:20AM

Re: [PATCH 19 of 20] Tests: removed multiple server certificates from ssl_ocsp.t

Sergey Kandaurov 135 March 22, 2023 07:06AM

Re: [PATCH 19 of 20] Tests: removed multiple server certificates from ssl_ocsp.t

Maxim Dounin 126 March 23, 2023 10:18AM

[PATCH 17 of 20] Tests: fixed stream_ssl_variables.t.t with LibreSSL and TLSv1.3

Maxim Dounin 138 March 18, 2023 10:20AM

Re: [PATCH 00 of 20] tests suite fixes for TLSv1.3

Sergey Kandaurov 120 March 22, 2023 07:44AM

Re: [PATCH 00 of 20] tests suite fixes for TLSv1.3

Maxim Dounin 143 March 23, 2023 10:20AM

Re: [PATCH 00 of 20] tests suite fixes for TLSv1.3

Sergey Kandaurov 119 March 23, 2023 12:02PM

Re: [PATCH 00 of 20] tests suite fixes for TLSv1.3

Maxim Dounin 116 March 23, 2023 12:54PM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 283
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready