Skip to content

Update EL8+ and Debian SSL defaults #2336

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions manifests/mod/ssl.pp
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,11 @@
Optional[Stdlib::Absolutepath] $ssl_cert = undef,
Optional[Stdlib::Absolutepath] $ssl_key = undef,
Optional[Stdlib::Absolutepath] $ssl_ca = undef,
String $ssl_cipher = 'HIGH:MEDIUM:!aNULL:!MD5:!RC4:!3DES',
String $ssl_cipher = $apache::params::ssl_cipher,
Variant[Boolean, Enum['on', 'off']] $ssl_honorcipherorder = true,
Array[String] $ssl_protocol = $apache::params::ssl_protocol,
Array $ssl_proxy_protocol = [],
Optional[String[1]] $ssl_proxy_cipher_suite = undef,
Optional[String[1]] $ssl_proxy_cipher_suite = $apache::params::ssl_proxy_cipher_suite,
String $ssl_pass_phrase_dialog = 'builtin',
Integer $ssl_random_seed_bytes = 512,
String $ssl_sessioncache = $apache::params::ssl_sessioncache,
Expand Down
11 changes: 10 additions & 1 deletion manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -723,8 +723,17 @@
}

if $facts['os']['family'] == 'RedHat' and versioncmp($facts['os']['release']['major'], '8') >= 0 {
$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
# Use OpenSSL system profile. See update-crypto-policies(8) for more details
$ssl_protocol = []
$ssl_cipher = 'PROFILE=SYSTEM'
$ssl_proxy_cipher_suite = 'PROFILE=SYSTEM'
} elsif $facts['os']['family'] == 'Debian' {
$ssl_protocol = ['all', '-SSLv3']
$ssl_cipher = 'HIGH:!aNULL'
$ssl_proxy_cipher_suite = undef
} else {
$ssl_protocol = ['all', '-SSLv2', '-SSLv3']
$ssl_cipher = 'HIGH:MEDIUM:!aNULL:!MD5:!RC4:!3DES'
$ssl_proxy_cipher_suite = undef
}
}
4 changes: 3 additions & 1 deletion spec/acceptance/apache_ssl_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ class { 'apache':
describe file("#{apache_hash['mod_ssl_dir']}/ssl.conf") do
it { is_expected.to be_file }
if os[:family].include?('redhat') && os[:release].to_i >= 8
it { is_expected.to contain 'SSLProtocol all' }
it { is_expected.not_to contain 'SSLProtocol' }
elsif ['debian', 'ubuntu'].include?(os[:family])
it { is_expected.to contain 'SSLProtocol all -SSLv3' }
else
it { is_expected.to contain 'SSLProtocol all -SSLv2 -SSLv3' }
end
Expand Down
21 changes: 16 additions & 5 deletions spec/classes/mod/ssl_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,29 @@
it {
is_expected.to contain_file('ssl.conf')
.with_path('/etc/httpd/conf.modules.d/ssl.conf')
.with_content(%r{SSLProtocol all})
.without_content(%r{SSLProxyCipherSuite})
.without_content(%r{SSLProtocol})
.with_content(%r{^ SSLCipherSuite PROFILE=SYSTEM$})
.with_content(%r{^ SSLProxyCipherSuite PROFILE=SYSTEM$})
}

context 'with ssl_proxy_cipher_suite' do
let(:params) do
{
ssl_proxy_cipher_suite: 'PROFILE=system',
ssl_proxy_cipher_suite: 'HIGH',
}
end

it { is_expected.to contain_file('ssl.conf').with_content(%r{SSLProxyCipherSuite PROFILE=system}) }
it { is_expected.to contain_file('ssl.conf').with_content(%r{SSLProxyCipherSuite HIGH}) }
end

context 'with empty ssl_protocol' do
let(:params) do
{
ssl_protocol: [],
}
end

it { is_expected.to contain_file('ssl.conf').without_content(%r{SSLProtocol}) }
end
end

Expand All @@ -58,7 +69,7 @@
it { is_expected.to contain_class('apache::params') }
it { is_expected.to contain_apache__mod('ssl') }
it { is_expected.not_to contain_package('libapache2-mod-ssl') }
it { is_expected.to contain_file('ssl.conf').with_content(%r{SSLProtocol all -SSLv2 -SSLv3}) }
it { is_expected.to contain_file('ssl.conf').with_content(%r{SSLProtocol all -SSLv3}) }
end
context 'on a FreeBSD OS' do
include_examples 'FreeBSD 9'
Expand Down
2 changes: 2 additions & 0 deletions templates/mod/ssl.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@
SSLStaplingCache "shmcb:<%= @_stapling_cache %>"
<% end -%>
SSLCipherSuite <%= @ssl_cipher %>
<% if not @ssl_protocol.empty? -%>
SSLProtocol <%= @ssl_protocol.compact.join(' ') %>
<% end -%>
<% if not @ssl_proxy_protocol.empty? -%>
SSLProxyProtocol <%= @ssl_proxy_protocol.compact.join(' ') %>
<% end -%>
Expand Down