Skip to content

Commit e14ec09

Browse files
authored
Merge pull request #2152 from davidc/main
(MODULES-11068) Allow apache::vhost ssl_honorcipherorder to take boolean parameter
2 parents 367a7c0 + 763154f commit e14ec09

File tree

4 files changed

+64
-6
lines changed

4 files changed

+64
-6
lines changed

manifests/vhost.pp

+14-2
Original file line numberDiff line numberDiff line change
@@ -1765,7 +1765,7 @@
17651765
$ssl_certs_dir = $apache::params::ssl_certs_dir,
17661766
$ssl_protocol = undef,
17671767
$ssl_cipher = undef,
1768-
$ssl_honorcipherorder = undef,
1768+
Variant[Boolean, Enum['on', 'On', 'off', 'Off'], Undef] $ssl_honorcipherorder = undef,
17691769
Optional[Enum['none', 'optional', 'require', 'optional_no_ca']] $ssl_verify_client = undef,
17701770
$ssl_verify_depth = undef,
17711771
Optional[Enum['none', 'optional', 'require', 'optional_no_ca']] $ssl_proxy_verify = undef,
@@ -2029,6 +2029,18 @@
20292029
include apache::mod::mime
20302030
}
20312031

2032+
if $ssl_honorcipherorder =~ Boolean or $ssl_honorcipherorder == undef {
2033+
$_ssl_honorcipherorder = $ssl_honorcipherorder
2034+
} else {
2035+
$_ssl_honorcipherorder = $ssl_honorcipherorder ? {
2036+
'on' => true,
2037+
'On' => true,
2038+
'off' => false,
2039+
'Off' => false,
2040+
default => true,
2041+
}
2042+
}
2043+
20322044
if $auth_kerb and $ensure == 'present' {
20332045
include apache::mod::auth_kerb
20342046
}
@@ -2688,7 +2700,7 @@
26882700
# - $ssl_crl_check
26892701
# - $ssl_protocol
26902702
# - $ssl_cipher
2691-
# - $ssl_honorcipherorder
2703+
# - $_ssl_honorcipherorder
26922704
# - $ssl_verify_client
26932705
# - $ssl_verify_depth
26942706
# - $ssl_options

spec/acceptance/apache_ssl_spec.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class { 'apache':
6565
ssl_certs_dir => '/tmp',
6666
ssl_protocol => 'test',
6767
ssl_cipher => 'test',
68-
ssl_honorcipherorder => 'test',
68+
ssl_honorcipherorder => true,
6969
ssl_verify_client => 'require',
7070
ssl_verify_depth => 'test',
7171
ssl_options => ['test', 'test1'],
@@ -89,7 +89,7 @@ class { 'apache':
8989
it { is_expected.to contain 'SSLProxyEngine On' }
9090
it { is_expected.to contain 'SSLProtocol test' }
9191
it { is_expected.to contain 'SSLCipherSuite test' }
92-
it { is_expected.to contain 'SSLHonorCipherOrder test' }
92+
it { is_expected.to contain 'SSLHonorCipherOrder On' }
9393
it { is_expected.to contain 'SSLVerifyClient require' }
9494
it { is_expected.to contain 'SSLVerifyDepth test' }
9595
it { is_expected.to contain 'SSLOptions test test1' }

spec/defines/vhost_spec.rb

+46
Original file line numberDiff line numberDiff line change
@@ -2082,6 +2082,52 @@
20822082
it { is_expected.to contain_concat__fragment('rspec.example.com-ssl') }
20832083
it { is_expected.not_to contain_concat__fragment('rspec.example.com-sslproxy') }
20842084
end
2085+
context 'ssl_honorcipherorder' do
2086+
let :params do
2087+
{
2088+
'docroot' => '/rspec/docroot',
2089+
'ssl' => true,
2090+
}
2091+
end
2092+
2093+
context 'ssl_honorcipherorder default' do
2094+
it { is_expected.to compile }
2095+
it { is_expected.to contain_concat__fragment('rspec.example.com-ssl').without_content(%r{^\s*SSLHonorCipherOrder}i) }
2096+
end
2097+
2098+
context 'ssl_honorcipherorder on' do
2099+
let :params do
2100+
super().merge({ 'ssl_honorcipherorder' => 'on' })
2101+
end
2102+
2103+
it { is_expected.to compile }
2104+
it { is_expected.to contain_concat__fragment('rspec.example.com-ssl').with_content(%r{^\s*SSLHonorCipherOrder\s+On$}) }
2105+
end
2106+
context 'ssl_honorcipherorder true' do
2107+
let :params do
2108+
super().merge({ 'ssl_honorcipherorder' => true })
2109+
end
2110+
2111+
it { is_expected.to compile }
2112+
it { is_expected.to contain_concat__fragment('rspec.example.com-ssl').with_content(%r{^\s*SSLHonorCipherOrder\s+On$}) }
2113+
end
2114+
context 'ssl_honorcipherorder off' do
2115+
let :params do
2116+
super().merge({ 'ssl_honorcipherorder' => 'off' })
2117+
end
2118+
2119+
it { is_expected.to compile }
2120+
it { is_expected.to contain_concat__fragment('rspec.example.com-ssl').with_content(%r{^\s*SSLHonorCipherOrder\s+Off$}) }
2121+
end
2122+
context 'ssl_honorcipherorder false' do
2123+
let :params do
2124+
super().merge({ 'ssl_honorcipherorder' => false })
2125+
end
2126+
2127+
it { is_expected.to compile }
2128+
it { is_expected.to contain_concat__fragment('rspec.example.com-ssl').with_content(%r{^\s*SSLHonorCipherOrder\s+Off$}) }
2129+
end
2130+
end
20852131
describe 'access logs' do
20862132
context 'single log file' do
20872133
let(:params) do

templates/vhost/_ssl.erb

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
<%- if @ssl_cipher -%>
1616
SSLCipherSuite <%= @ssl_cipher %>
1717
<%- end -%>
18-
<%- if @ssl_honorcipherorder -%>
19-
SSLHonorCipherOrder <%= @ssl_honorcipherorder %>
18+
<%- if not @ssl_honorcipherorder.nil? -%>
19+
SSLHonorCipherOrder <%= scope.call_function('apache::bool2httpd', [@_ssl_honorcipherorder]) %>
2020
<%- end -%>
2121
<%- if @ssl_verify_client -%>
2222
SSLVerifyClient <%= @ssl_verify_client %>

0 commit comments

Comments
 (0)