Skip to content

Commit 57c3aca

Browse files
committed
Updates
1) Generate ssl_dhparam using openssl_dhparam resource 2) Update CRL only if its older than specified Signed-off-by: Rony Xavier <[email protected]>
1 parent dd9d38f commit 57c3aca

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

.kitchen.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ provisioner:
1212
verifier:
1313
name: inspec
1414
sudo: true
15-
#format: json
16-
#output: "%{platform}_%{suite}-<%= Time.now.iso8601 %>.json"
15+
# reporter: json
16+
# output: "%{platform}_%{suite}-<%= Time.now.iso8601 %>.json"
1717

1818
platforms:
1919
- name: debian-7

attributes/hardening.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,3 +94,4 @@
9494
default['nginx-hardening']['options']['ssl_prefer_server_ciphers'] = 'on'
9595
default['nginx-hardening']['options']['ssl_session_tickets'] = 'off'
9696
default['nginx-hardening']['dh-size'] = 2048
97+
default['nginx-hardening']['crl_udpate_frequency_days'] = 7

recipes/default.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@
6363
action :delete
6464
end
6565

66-
execute 'generate_dh_group' do
67-
command "openssl dhparam -out #{node['nginx-hardening']['options']['ssl_dhparam']} #{node['nginx-hardening']['dh-size']}"
66+
openssl_dhparam node['nginx-hardening']['options']['ssl_dhparam'] do
67+
key_length node['nginx-hardening']['dh-size']
6868
not_if { File.exist?(node['nginx-hardening']['options']['ssl_dhparam']) }
6969
end
7070

@@ -106,6 +106,8 @@
106106
mv DOD_CRL-bundle.crl ../
107107
cd ../; rm -rf crl_temp # Remove temp dir to make bundle
108108
EOH
109+
# Run if CRL was updated more than specified days ago
110+
not_if { File.exist?(node['nginx-hardening']['options']['ssl_crl']) and File.ctime(node['nginx-hardening']['options']['ssl_crl']) > Time.now - node['nginx-hardening']['crl_udpate_frequency_days'] * 86400 }
109111
end
110112

111113
file File.join((node['nginx-hardening']['certificates_dir'] || '/etc/nginx/'), 'DOD_CRL-bundle.crl') do
@@ -153,5 +155,3 @@
153155
end
154156

155157

156-
157-

0 commit comments

Comments
 (0)