Skip to content

Commit

Permalink
Automatically require SSL cert files in the server
Browse files Browse the repository at this point in the history
  • Loading branch information
ekohl authored and bastelfreak committed Feb 1, 2019
1 parent 826cc02 commit 38b65fe
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
3 changes: 2 additions & 1 deletion manifests/resource/server.pp
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,8 @@
if $ssl {
# Access and error logs are named differently in ssl template

concat::fragment { "${name_sanitized}-ssl-header":
File <| title == $ssl_cert or path == $ssl_cert or title == $ssl_key or path == $ssl_key |>
-> concat::fragment { "${name_sanitized}-ssl-header":
target => $config_file,
content => template('nginx/server/server_ssl_header.erb'),
order => '700',
Expand Down
12 changes: 12 additions & 0 deletions spec/defines/resource_server_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,18 @@

it { is_expected.to contain_concat__fragment("#{title}-ssl-header").without_content(%r{ ssl on;}) }
end

context 'with ssl cert and key definitions' do
let(:pre_condition) do
<<-PUPPET
file { ['/tmp/dummy.key', '/tmp/dummy.crt']: }
include nginx
PUPPET
end

it { is_expected.to contain_file('/tmp/dummy.key').with_path('/tmp/dummy.key') }
it { is_expected.to contain_concat__fragment("#{title}-ssl-header").that_requires(['File[/tmp/dummy.key]', 'File[/tmp/dummy.crt]']) }
end
end

[
Expand Down

0 comments on commit 38b65fe

Please sign in to comment.