From: Peter Palfrader Date: Sun, 31 Jan 2016 16:54:23 +0000 (+0100) Subject: Get certs from the LE dir also X-Git-Url: https://git.adam-barratt.org.uk/?a=commitdiff_plain;h=fe3ba85c819555730166a7c70a3ae2181998d060;p=mirror%2Fdsa-puppet.git Get certs from the LE dir also --- diff --git a/modules/ssl/manifests/service.pp b/modules/ssl/manifests/service.pp index 54a4110d8..fbca2fae2 100644 --- a/modules/ssl/manifests/service.pp +++ b/modules/ssl/manifests/service.pp @@ -6,11 +6,11 @@ define ssl::service($ensure = present, $tlsaport = 443, $notify = []) { } file { "/etc/ssl/debian/certs/$name.crt": - source => "puppet:///modules/ssl/servicecerts/${name}.crt", + source => [ "puppet:///modules/ssl/servicecerts/${name}.crt", "puppet:///modules/ssl/from-letsencrypt/${name}.crt" ], notify => [ Exec['refresh_debian_hashes'], $notify ], } file { "/etc/ssl/debian/certs/$name.crt-chain": - source => [ "puppet:///modules/ssl/chains/${name}.crt", "puppet:///modules/ssl/servicecerts/${name}.crt" ], + source => [ "puppet:///modules/ssl/chains/${name}.crt", "puppet:///modules/ssl/servicecerts/${name}.crt", "puppet:///modules/ssl/from-letsencrypt/${name}.crt-chain" ], notify => [ $notify ], links => follow, } @@ -22,7 +22,7 @@ define ssl::service($ensure = present, $tlsaport = 443, $notify = []) { if $tlsaport > 0 { dnsextras::tlsa_record{ "tlsa-${name}-${tlsaport}": zone => 'debian.org', - certfile => "/etc/puppet/modules/ssl/files/servicecerts/${name}.crt", + certfile => [ "puppet:///modules/ssl/servicecerts/${name}.crt", "puppet:///modules/ssl/from-letsencrypt/${name}.crt" ], port => $tlsaport, hostname => "$name", } diff --git a/modules/ssl/templates/chained.erb b/modules/ssl/templates/chained.erb index 1ae6581d1..dc5fed079 100644 --- a/modules/ssl/templates/chained.erb +++ b/modules/ssl/templates/chained.erb @@ -1,7 +1,14 @@ <%= - File.read("/etc/puppet/modules/ssl/files/servicecerts/#{name}.crt") -%> -<%= - fn = "/etc/puppet/modules/ssl/files/chains/#{name}.crt" - File.exist?(fn) ? File.read(fn) : '' + out = "" + fn = "/etc/puppet/modules/ssl/files/servicecerts/#{name}.crt" + if File.exist?(fn) then + out = File.read(fn) + + chain = "/etc/puppet/modules/ssl/files/chains/#{name}.crt" + File.exist?(chain) ? File.read(chain) : '' + else + fn = "/etc/puppet/modules/ssl/files/from-letsencrypt/#{name}.crt-chained" + out = File.read(fn) + end + out %>