Skip to content

Commit

Permalink
(MODULES-9014) Improve SSLSessionTickets handling
Browse files Browse the repository at this point in the history
- Make ssl_sessiontickets parameter optional
- Set default value for ssl_sessiontickets to undef (Compatible
  with all Apache versions)
- Update documentation and unit tests accordingly
  • Loading branch information
Frédéric Lespez committed May 15, 2019
1 parent c85441d commit ea8cc02
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 39 deletions.
6 changes: 3 additions & 3 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -5340,12 +5340,12 @@ Default value: `false`

##### `ssl_sessiontickets`

Data type: `Boolean`
Data type: `Optional[Boolean]`

Enable the use of TLS session tickets (RFC 5077).
Ignored on Ubuntu 14.04 since Apache 2.4.11 or newer is needed.
Available since Apache 2.4.11.

Default: `true`.
Default: `undef`.

##### `ssl_cryptodevice`

Expand Down
10 changes: 2 additions & 8 deletions manifests/mod/ssl.pp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
#
class apache::mod::ssl (
Boolean $ssl_compression = false,
Boolean $ssl_sessiontickets = true,
Optional[Boolean] $ssl_sessiontickets = undef,
$ssl_cryptodevice = 'builtin',
$ssl_options = [ 'StdEnvVars' ],
$ssl_openssl_conf_cmd = undef,
Expand Down Expand Up @@ -171,20 +171,14 @@
}
}

if $::operatingsystem == 'Ubuntu' and $::operatingsystemrelease == '14.04' {
$_ssl_sessiontickets = undef
} else {
$_ssl_sessiontickets = $ssl_sessiontickets
}

if versioncmp($_apache_version, '2.4') >= 0 {
include ::apache::mod::socache_shmcb
}

# Template uses
#
# $ssl_compression
# $_ssl_sessiontickets
# $ssl_sessiontickets
# $ssl_cryptodevice
# $ssl_ca
# $ssl_cipher
Expand Down
27 changes: 1 addition & 26 deletions spec/classes/mod/ssl_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@
}
end

it { is_expected.to contain_file('ssl.conf').with_content(%r{^ SSLSessionTickets On$}) }
it { is_expected.not_to contain_file('ssl.conf').with_content(%r{^ SSLSessionTickets (Off|On)$}) }
end
context 'with Apache version >= 2.4 - setting ssl_sessiontickets to false' do
let :params do
Expand Down Expand Up @@ -365,29 +365,4 @@
it { is_expected.to contain_file('ssl.conf').with_content(%r{^ SSLProxyProtocol -ALL \+TLSv1$}) }
end
end
# Template config parts varying by distro
context 'on Ubuntu 14.04' do
let :facts do
{
osfamily: 'Debian',
operatingsystem: 'Ubuntu',
operatingsystemrelease: '14.04',
lsbdistrelease: '14.04',
kernel: 'Linux',
id: 'root',
path: '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
is_pe: false,
}
end

context 'with Apache version >= 2.4 - setting ssl_sessiontickets to false' do
let :params do
{
apache_version: '2.4',
}
end

it { is_expected.not_to contain_file('ssl.conf').with_content(%r{^ SSLSessionTickets Off$}) }
end
end
end
4 changes: 2 additions & 2 deletions templates/mod/ssl.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
<%- if @ssl_compression -%>
SSLCompression <%= scope.call_function('apache::bool2httpd', [@ssl_compression]) %>
<%- end -%>
<%- unless @_ssl_sessiontickets.nil? -%>
SSLSessionTickets <%= scope.call_function('apache::bool2httpd', [@_ssl_sessiontickets]) %>
<%- unless @ssl_sessiontickets.nil? -%>
SSLSessionTickets <%= scope.call_function('apache::bool2httpd', [@ssl_sessiontickets]) %>
<%- end -%>
<%- else -%>
SSLMutex <%= @_ssl_mutex %>
Expand Down

0 comments on commit ea8cc02

Please sign in to comment.