changeset 1971:ab45ee8011df

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.
author Maxim Dounin <mdounin@mdounin.ru>
date Mon, 06 May 2024 00:03:16 +0300
parents 6d3a8f4eb9b2
children f3573393f36f
files lib/Test/Nginx.pm mail_ssl_session_reuse.t ssl_session_reuse.t ssl_session_ticket_key.t stream_ssl_session_reuse.t
diffstat 5 files changed, 22 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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',
--- 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: {
--- 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: {
--- 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'
--- 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: {