X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=modules%2Fssl%2Fmanifests%2Fservice.pp;h=a9d4fd45b1bddba88e3cff4e2ce0496138a79d4b;hb=030ce8b3edff0fc9311d83cdfe9ba2735aee5221;hp=0af2e160733ab5a5bb6454129d57c3b926b6f5a8;hpb=2be83a39acf75d45f318fc07ce386a889a72f3e8;p=mirror%2Fdsa-puppet.git diff --git a/modules/ssl/manifests/service.pp b/modules/ssl/manifests/service.pp index 0af2e1607..a9d4fd45b 100644 --- a/modules/ssl/manifests/service.pp +++ b/modules/ssl/manifests/service.pp @@ -1,4 +1,4 @@ -define ssl::service($ensure = present, $tlsaport = 443, $notify = []) { +define ssl::service($ensure = present, $tlsaport = 443, $notify = [], $key = false) { $link_target = $ensure ? { present => link, absent => absent, @@ -6,20 +6,33 @@ define ssl::service($ensure = present, $tlsaport = 443, $notify = []) { } file { "/etc/ssl/debian/certs/$name.crt": - source => "puppet:///modules/ssl/servicecerts/${name}.crt", - notify => [ Exec['c_rehash /etc/ssl/debian/certs'], $notify ], + 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/servicecerts/${name}.crt-chain", "puppet:///modules/ssl/empty" ], - notify => [ Exec['c_rehash /etc/ssl/debian/certs'], $notify ], - links => follow, + 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, + } + file { "/etc/ssl/debian/certs/$name.crt-chained": + content => template('ssl/chained.erb'), + notify => [ $notify ], + } + if $key { + file { "/etc/ssl/private/$name.key": + mode => '0440', + group => 'ssl-cert', + source => [ "puppet:///modules/ssl/keys/${name}.crt", "puppet:///modules/ssl/from-letsencrypt/${name}.key" ], + notify => [ $notify ], + links => follow, + } } if $tlsaport > 0 { - dnsextras::tlsa_record{ "tlsa-${tlsaport}": - zone => 'debian.org', - certfile => "/etc/puppet/modules/ssl/files/servicecerts/${name}.crt", - port => $tlsaport, + dnsextras::tlsa_record{ "tlsa-${name}-${tlsaport}": + zone => 'debian.org', + certfile => [ "/etc/puppet/modules/ssl/files/servicecerts/${name}.crt", "/etc/puppet/modules/ssl/files/from-letsencrypt/${name}.crt" ], + port => $tlsaport, hostname => "$name", } }