diff --git a/README.md b/README.md index 7a2a9dfdf..9976db3e4 100644 --- a/README.md +++ b/README.md @@ -750,7 +750,12 @@ Installs Apache SSL capabilities and uses the ssl.conf.erb template. These are t ssl_cipher => 'HIGH:MEDIUM:!aNULL:!MD5', ssl_protocol => 'all -SSLv2 -SSLv3', ssl_pass_phrase_dialog => 'builtin', - ssl_random_seed_bytes => '512', + ssl_random_seeds => [ + 'startup builtin', + 'startup file:/dev/urandom 512', + 'connect builtin', + 'connect file:/dev/urandom 512', + ], } ``` diff --git a/manifests/mod/ssl.pp b/manifests/mod/ssl.pp index f2b62459e..b0a511a35 100644 --- a/manifests/mod/ssl.pp +++ b/manifests/mod/ssl.pp @@ -4,7 +4,12 @@ $ssl_cipher = 'HIGH:MEDIUM:!aNULL:!MD5', $ssl_protocol = [ 'all', '-SSLv2', '-SSLv3' ], $ssl_pass_phrase_dialog = 'builtin', - $ssl_random_seed_bytes = '512', + $ssl_random_seeds = [ + 'startup builtin', + 'startup file:/dev/urandom 512', + 'connect builtin', + 'connect file:/dev/urandom 512', + ], $apache_version = $::apache::apache_version, $package_name = undef, ) { @@ -49,6 +54,7 @@ # $ssl_options # $session_cache, # $ssl_mutex + # $ssl_random_seeds # $apache_version # file { 'ssl.conf': diff --git a/spec/classes/mod/ssl_spec.rb b/spec/classes/mod/ssl_spec.rb index f7755ed36..a657567ab 100644 --- a/spec/classes/mod/ssl_spec.rb +++ b/spec/classes/mod/ssl_spec.rb @@ -111,13 +111,17 @@ it { is_expected.to contain_file('ssl.conf').with_content(/^ SSLPassPhraseDialog exec:\/path\/to\/program$/)} end - context 'setting ssl_random_seed_bytes' do + context 'setting ssl_random_seeds' do let :params do { - :ssl_random_seed_bytes => '1024', - } + :ssl_random_seeds => ['startup builtin', + 'startup file:/dev/random 256', + 'connect file:/dev/urandom 1024' ], + } end - it { is_expected.to contain_file('ssl.conf').with_content(%r{^ SSLRandomSeed startup file:/dev/urandom 1024$})} + it { is_expected.to contain_file('ssl.conf').with_content(/^ SSLRandomSeed startup builtin$/)} + it { is_expected.to contain_file('ssl.conf').with_content(/^ SSLRandomSeed startup file:\/dev\/random 256$/)} + it { is_expected.to contain_file('ssl.conf').with_content(/^ SSLRandomSeed connect file:\/dev\/urandom 1024$/)} end end diff --git a/templates/mod/ssl.conf.erb b/templates/mod/ssl.conf.erb index 6fb25c16e..e9155545b 100644 --- a/templates/mod/ssl.conf.erb +++ b/templates/mod/ssl.conf.erb @@ -1,8 +1,9 @@ - SSLRandomSeed startup builtin - SSLRandomSeed startup file:/dev/urandom <%= @ssl_random_seed_bytes %> - SSLRandomSeed connect builtin - SSLRandomSeed connect file:/dev/urandom <%= @ssl_random_seed_bytes %> + <%- Array(@ssl_random_seeds).each do |ssl_random_seed| -%> + <%- if ssl_random_seed != '' -%> + SSLRandomSeed <%= ssl_random_seed %> + <%- end -%> + <%- end -%> AddType application/x-x509-ca-cert .crt AddType application/x-pkcs7-crl .crl