Skip to content

Commit

Permalink
Merge pull request #544 from mlibrary/add-letsencrypt-ssl-chain
Browse files Browse the repository at this point in the history
Parameterize chain_crt for http fileservers
  • Loading branch information
umjnega authored Jul 27, 2022
2 parents 83c9bb7 + c90ed96 commit 98ae5fc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
5 changes: 3 additions & 2 deletions manifests/profile/http_fileserver.pp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@

class nebula::profile::http_fileserver (
String $storage_path,
String $docroot = '/srv/www'
String $docroot = '/srv/www',
String $chain_crt = 'incommon_sha2.crt'
) {

package { 'nfs-common': }
Expand All @@ -35,7 +36,7 @@
class { 'apache':
docroot => '/srv/www',
default_mods => false,
default_ssl_chain => '/etc/ssl/certs/incommon_sha2.crt',
default_ssl_chain => "/etc/ssl/certs/${chain_crt}",
default_ssl_cert => "/etc/ssl/certs/${::fqdn}.crt",
default_ssl_key => "/etc/ssl/private/${::fqdn}.key",
default_vhost => true,
Expand Down
10 changes: 10 additions & 0 deletions spec/classes/profile/http_fileserver_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
it do
is_expected.to contain_class('apache').with(
docroot: '/srv/www',
default_ssl_chain: '/etc/ssl/certs/incommon_sha2.crt',
default_ssl_cert: "/etc/ssl/certs/#{fqdn}.crt",
default_ssl_key: "/etc/ssl/private/#{fqdn}.key",
)
Expand All @@ -31,6 +32,15 @@
it { is_expected.to contain_file("/etc/ssl/certs/#{fqdn}.crt") }
it { is_expected.to contain_file("/etc/ssl/private/#{fqdn}.key") }
it { is_expected.to contain_file('/etc/ssl/certs/intermediate_ca.crt') }

context "with chain_crt set to abc.crt" do
let(:params) do
super().merge(chain_crt: 'abc.crt')
end

it { is_expected.to compile }
it { is_expected.to contain_class('apache').with_default_ssl_chain('/etc/ssl/certs/abc.crt') }
end
end
end
end

0 comments on commit 98ae5fc

Please sign in to comment.