Skip to content

Commit 47f0d72

Browse files
authored
Merge pull request #2336 from ekohl/update-ssl-defaults
Update EL8+ and Debian SSL defaults
2 parents 88f611e + 67a8a17 commit 47f0d72

File tree

5 files changed

+33
-9
lines changed

5 files changed

+33
-9
lines changed

manifests/mod/ssl.pp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,11 @@
9898
Optional[Stdlib::Absolutepath] $ssl_cert = undef,
9999
Optional[Stdlib::Absolutepath] $ssl_key = undef,
100100
Optional[Stdlib::Absolutepath] $ssl_ca = undef,
101-
String $ssl_cipher = 'HIGH:MEDIUM:!aNULL:!MD5:!RC4:!3DES',
101+
String $ssl_cipher = $apache::params::ssl_cipher,
102102
Variant[Boolean, Enum['on', 'off']] $ssl_honorcipherorder = true,
103103
Array[String] $ssl_protocol = $apache::params::ssl_protocol,
104104
Array $ssl_proxy_protocol = [],
105-
Optional[String[1]] $ssl_proxy_cipher_suite = undef,
105+
Optional[String[1]] $ssl_proxy_cipher_suite = $apache::params::ssl_proxy_cipher_suite,
106106
String $ssl_pass_phrase_dialog = 'builtin',
107107
Integer $ssl_random_seed_bytes = 512,
108108
String $ssl_sessioncache = $apache::params::ssl_sessioncache,

manifests/params.pp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -723,8 +723,17 @@
723723
}
724724

725725
if $facts['os']['family'] == 'RedHat' and versioncmp($facts['os']['release']['major'], '8') >= 0 {
726-
$ssl_protocol = ['all'] # Implementations of the SSLv2 and SSLv3 protocol versions have been removed from OpenSSL (and hence mod_ssl) because these are no longer considered secure. For additional documentation https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/deploying_different_types_of_servers/setting-apache-web-server_deploying-different-types-of-servers
726+
# Use OpenSSL system profile. See update-crypto-policies(8) for more details
727+
$ssl_protocol = []
728+
$ssl_cipher = 'PROFILE=SYSTEM'
729+
$ssl_proxy_cipher_suite = 'PROFILE=SYSTEM'
730+
} elsif $facts['os']['family'] == 'Debian' {
731+
$ssl_protocol = ['all', '-SSLv3']
732+
$ssl_cipher = 'HIGH:!aNULL'
733+
$ssl_proxy_cipher_suite = undef
727734
} else {
728735
$ssl_protocol = ['all', '-SSLv2', '-SSLv3']
736+
$ssl_cipher = 'HIGH:MEDIUM:!aNULL:!MD5:!RC4:!3DES'
737+
$ssl_proxy_cipher_suite = undef
729738
}
730739
}

spec/acceptance/apache_ssl_spec.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ class { 'apache':
2424
describe file("#{apache_hash['mod_ssl_dir']}/ssl.conf") do
2525
it { is_expected.to be_file }
2626
if os[:family].include?('redhat') && os[:release].to_i >= 8
27-
it { is_expected.to contain 'SSLProtocol all' }
27+
it { is_expected.not_to contain 'SSLProtocol' }
28+
elsif ['debian', 'ubuntu'].include?(os[:family])
29+
it { is_expected.to contain 'SSLProtocol all -SSLv3' }
2830
else
2931
it { is_expected.to contain 'SSLProtocol all -SSLv2 -SSLv3' }
3032
end

spec/classes/mod/ssl_spec.rb

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,29 @@
2020
it {
2121
is_expected.to contain_file('ssl.conf')
2222
.with_path('/etc/httpd/conf.modules.d/ssl.conf')
23-
.with_content(%r{SSLProtocol all})
24-
.without_content(%r{SSLProxyCipherSuite})
23+
.without_content(%r{SSLProtocol})
24+
.with_content(%r{^ SSLCipherSuite PROFILE=SYSTEM$})
25+
.with_content(%r{^ SSLProxyCipherSuite PROFILE=SYSTEM$})
2526
}
2627

2728
context 'with ssl_proxy_cipher_suite' do
2829
let(:params) do
2930
{
30-
ssl_proxy_cipher_suite: 'PROFILE=system',
31+
ssl_proxy_cipher_suite: 'HIGH',
3132
}
3233
end
3334

34-
it { is_expected.to contain_file('ssl.conf').with_content(%r{SSLProxyCipherSuite PROFILE=system}) }
35+
it { is_expected.to contain_file('ssl.conf').with_content(%r{SSLProxyCipherSuite HIGH}) }
36+
end
37+
38+
context 'with empty ssl_protocol' do
39+
let(:params) do
40+
{
41+
ssl_protocol: [],
42+
}
43+
end
44+
45+
it { is_expected.to contain_file('ssl.conf').without_content(%r{SSLProtocol}) }
3546
end
3647
end
3748

@@ -58,7 +69,7 @@
5869
it { is_expected.to contain_class('apache::params') }
5970
it { is_expected.to contain_apache__mod('ssl') }
6071
it { is_expected.not_to contain_package('libapache2-mod-ssl') }
61-
it { is_expected.to contain_file('ssl.conf').with_content(%r{SSLProtocol all -SSLv2 -SSLv3}) }
72+
it { is_expected.to contain_file('ssl.conf').with_content(%r{SSLProtocol all -SSLv3}) }
6273
end
6374
context 'on a FreeBSD OS' do
6475
include_examples 'FreeBSD 9'

templates/mod/ssl.conf.erb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@
4040
SSLStaplingCache "shmcb:<%= @_stapling_cache %>"
4141
<% end -%>
4242
SSLCipherSuite <%= @ssl_cipher %>
43+
<% if not @ssl_protocol.empty? -%>
4344
SSLProtocol <%= @ssl_protocol.compact.join(' ') %>
45+
<% end -%>
4446
<% if not @ssl_proxy_protocol.empty? -%>
4547
SSLProxyProtocol <%= @ssl_proxy_protocol.compact.join(' ') %>
4648
<% end -%>

0 commit comments

Comments
 (0)