Skip to content

Commit 4d5d475

Browse files
author
Frédéric Lespez
committed
(MODULES-9018) Customize SSLStaplingCache parameter
- Add a stapling_cache parameter to apache::mod::ssl * if it is set to undef (the default value), the actual behavior will take place (SSLStaplingCache will be set to a value based on the OS) * if is is set to a string, this string will used as a value for SSLStaplingCache. - Adapt template ssl.conf.erb accordingly - Add unit tests got the stapling_cache parameter - Document the stapling_cache parameter
1 parent 98cf15c commit 4d5d475

File tree

4 files changed

+37
-8
lines changed

4 files changed

+37
-8
lines changed

REFERENCE.md

+14
Original file line numberDiff line numberDiff line change
@@ -5466,6 +5466,20 @@ Pass stapling related OCSP errors on to client.
54665466

54675467
Default value: `undef`
54685468

5469+
##### `stapling_cache`
5470+
5471+
Data type: `String`
5472+
5473+
Configures the storage type of the global/inter-process SSL Stapling Cache.
5474+
Only cache type 'shmcb' is supported.
5475+
Default based on the OS:
5476+
- Debian/Ubuntu: '${APACHE_RUN_DIR}/ocsp(32768)'.
5477+
- RedHat: '/run/httpd/ssl_stapling(32768)'.
5478+
- FreeBSD/Gentoo: '/var/run/ssl_stapling(32768)'.
5479+
- Suse: '/var/lib/apache2/ssl_stapling(32768)'.
5480+
5481+
Default value: `undef`
5482+
54695483
##### `ssl_mutex`
54705484

54715485
Data type: `Any`

manifests/mod/ssl.pp

+12-7
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@
9191
String $ssl_sessioncache = $::apache::params::ssl_sessioncache,
9292
$ssl_sessioncachetimeout = '300',
9393
Boolean $ssl_stapling = false,
94+
Optional[String] $stapling_cache = undef,
9495
Optional[Boolean] $ssl_stapling_return_errors = undef,
9596
$ssl_mutex = undef,
9697
$apache_version = undef,
@@ -141,12 +142,16 @@
141142
}
142143
}
143144

144-
$stapling_cache = $::osfamily ? {
145-
'debian' => "\${APACHE_RUN_DIR}/ocsp(32768)",
146-
'redhat' => '/run/httpd/ssl_stapling(32768)',
147-
'freebsd' => '/var/run/ssl_stapling(32768)',
148-
'gentoo' => '/var/run/ssl_stapling(32768)',
149-
'Suse' => '/var/lib/apache2/ssl_stapling(32768)',
145+
if $stapling_cache =~ Undef {
146+
$_stapling_cache = $::osfamily ? {
147+
'debian' => "\${APACHE_RUN_DIR}/ocsp(32768)",
148+
'redhat' => '/run/httpd/ssl_stapling(32768)',
149+
'freebsd' => '/var/run/ssl_stapling(32768)',
150+
'gentoo' => '/var/run/ssl_stapling(32768)',
151+
'Suse' => '/var/lib/apache2/ssl_stapling(32768)',
152+
}
153+
} else {
154+
$_stapling_cache = $stapling_cache
150155
}
151156

152157
if $::osfamily == 'Suse' {
@@ -179,7 +184,7 @@
179184
# $ssl_options
180185
# $ssl_openssl_conf_cmd
181186
# $ssl_sessioncache
182-
# $stapling_cache
187+
# $_stapling_cache
183188
# $ssl_mutex
184189
# $ssl_random_seed_bytes
185190
# $ssl_sessioncachetimeout

spec/classes/mod/ssl_spec.rb

+10
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,16 @@
275275

276276
it { is_expected.to contain_file('ssl.conf').with_content(%r{^ SSLStaplingReturnResponderErrors On$}) }
277277
end
278+
context 'with Apache version >= 2.4 - setting stapling_cache' do
279+
let :params do
280+
{
281+
apache_version: '2.4',
282+
stapling_cache: '/tmp/customstaplingcache(51200)',
283+
}
284+
end
285+
286+
it { is_expected.to contain_file('ssl.conf').with_content(%r{^ SSLStaplingCache "shmcb:/tmp/customstaplingcache\(51200\)"$}) }
287+
end
278288

279289
context 'setting ssl_pass_phrase_dialog' do
280290
let :params do

templates/mod/ssl.conf.erb

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
<%- if not @ssl_stapling_return_errors.nil? -%>
3535
SSLStaplingReturnResponderErrors <%= scope.call_function('apache::bool2httpd', [@ssl_stapling_return_errors]) %>
3636
<%- end -%>
37-
SSLStaplingCache "shmcb:<%= @stapling_cache %>"
37+
SSLStaplingCache "shmcb:<%= @_stapling_cache %>"
3838
<% end -%>
3939
SSLCipherSuite <%= @ssl_cipher %>
4040
SSLProtocol <%= @ssl_protocol.compact.join(' ') %>

0 commit comments

Comments
 (0)