[PATCH 3 of 5] Tests: guarded session ticket tests for old OpenSSL versions
Maxim Dounin
mdounin at mdounin.ru
Wed May 1 01:53:09 UTC 2024
# HG changeset patch
# User Maxim Dounin <mdounin at mdounin.ru>
# Date 1714527782 -10800
# Wed May 01 04:43:02 2024 +0300
# Node ID c20055d3b8275fbc29f872ba8059d7b625be78c5
# Parent f1b147125456b5904e9a8d080c338e0207602f16
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
@@ -141,7 +141,13 @@ local $TODO = 'no TLSv1.3 sessions, old
local $TODO = 'no TLSv1.3 sessions in LibreSSL'
if $t->has_module('LibreSSL') && 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
@@ -168,7 +168,13 @@ local $TODO = 'no TLSv1.3 sessions, old
local $TODO = 'no TLSv1.3 sessions in LibreSSL'
if $t->has_module('LibreSSL') && 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
@@ -145,7 +145,13 @@ local $TODO = 'no TLSv1.3 sessions, old
local $TODO = 'no TLSv1.3 sessions in LibreSSL'
if $t->has_module('LibreSSL') && 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: {
More information about the nginx-devel
mailing list