# HG changeset patch # User Maxim Dounin # Date 1714942996 -10800 # Node ID ab45ee8011df2453e2b1dbee9662d00f8e579e3b # Parent 6d3a8f4eb9b2ec3b9a48c81dfb051acf06e67bfa Tests: guarded session ticket tests for old OpenSSL versions. Much like SNI support, TLS session tickets are available starting with OpenSSL 0.9.8f if TLS extensions support is explicitly configured, and enabled by default since 0.9.8j. As such, SNI availability is checked to ensure TLS extensions support is compiled in. Additionally, the ssl_session_ticket_key.t tests for automatic ticket key rotation, which uses session ticket key callback, as introduced in OpenSSL 0.9.8h. diff --git a/lib/Test/Nginx.pm b/lib/Test/Nginx.pm --- a/lib/Test/Nginx.pm +++ b/lib/Test/Nginx.pm @@ -114,6 +114,7 @@ sub has_module($) { my %regex = ( sni => 'TLS SNI support enabled', + tickets => 'TLS SNI support enabled', mail => '--with-mail((?!\S)|=dynamic)', flv => '--with-http_flv_module', perl => '--with-http_perl_module', diff --git a/mail_ssl_session_reuse.t b/mail_ssl_session_reuse.t --- a/mail_ssl_session_reuse.t +++ b/mail_ssl_session_reuse.t @@ -143,7 +143,13 @@ local $TODO = 'no TLSv1.3 sessions in Li local $TODO = 'no TLSv1.3 sessions in Net::SSLeay (LibreSSL)' if Net::SSLeay::constant("LIBRESSL_VERSION_NUMBER") && test_tls13(); +TODO: { +local $TODO = 'no session tickets' unless $t->has_module('tickets'); + is(test_reuse(8993), 1, 'tickets reused'); + +} + is(test_reuse(8994), 1, 'tickets and cache reused'); TODO: { diff --git a/ssl_session_reuse.t b/ssl_session_reuse.t --- a/ssl_session_reuse.t +++ b/ssl_session_reuse.t @@ -170,7 +170,13 @@ local $TODO = 'no TLSv1.3 sessions in Li local $TODO = 'no TLSv1.3 sessions in Net::SSLeay (LibreSSL)' if Net::SSLeay::constant("LIBRESSL_VERSION_NUMBER") && test_tls13(); +TODO: { +local $TODO = 'no session tickets' unless $t->has_module('tickets'); + is(test_reuse(8443), 1, 'tickets reused'); + +} + is(test_reuse(8444), 1, 'tickets and cache reused'); TODO: { diff --git a/ssl_session_ticket_key.t b/ssl_session_ticket_key.t --- a/ssl_session_ticket_key.t +++ b/ssl_session_ticket_key.t @@ -27,7 +27,7 @@ plan(skip_all => 'Net::SSLeay version => eval { require IO::Socket::SSL; die if $IO::Socket::SSL::VERSION < 2.030; }; plan(skip_all => 'IO::Socket::SSL version => 2.030 required') if $@; -my $t = Test::Nginx->new()->has(qw/http http_ssl socket_ssl/) +my $t = Test::Nginx->new()->has(qw/http http_ssl tickets socket_ssl/) ->has_daemon('openssl')->plan(2) ->write_file_expand('nginx.conf', <<'EOF'); @@ -99,6 +99,8 @@ is(get_ticket_key_name(), $key, 'ticket select undef, undef, undef, 2.5; +local $TODO = 'no ticket key callback' + if $t->has_module('OpenSSL') and not $t->has_feature('openssl:0.9.8h'); local $TODO = 'no TLSv1.3 sessions, old Net::SSLeay' if $Net::SSLeay::VERSION < 1.88 && test_tls13(); local $TODO = 'no TLSv1.3 sessions, old IO::Socket::SSL' diff --git a/stream_ssl_session_reuse.t b/stream_ssl_session_reuse.t --- a/stream_ssl_session_reuse.t +++ b/stream_ssl_session_reuse.t @@ -147,7 +147,13 @@ local $TODO = 'no TLSv1.3 sessions in Li local $TODO = 'no TLSv1.3 sessions in Net::SSLeay (LibreSSL)' if Net::SSLeay::constant("LIBRESSL_VERSION_NUMBER") && test_tls13(); +TODO: { +local $TODO = 'no session tickets' unless $t->has_module('tickets'); + is(test_reuse(8443), 1, 'tickets reused'); + +} + is(test_reuse(8444), 1, 'tickets and cache reused'); TODO: {