X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=modules%2Froles%2Fmanifests%2Fdns_primary.pp;h=8dd0f00557e9c61b29770781f9776a6abff15583;hb=faf0b00a7b3ef90757b7fcf9dec93c9987383f8a;hp=7e4327ab5a8997f654335965931fa390bd002bd1;hpb=41789475e67ec05e5aaeca4d2e299328db42ab32;p=mirror%2Fdsa-puppet.git diff --git a/modules/roles/manifests/dns_primary.pp b/modules/roles/manifests/dns_primary.pp index 7e4327ab5..8dd0f0055 100644 --- a/modules/roles/manifests/dns_primary.pp +++ b/modules/roles/manifests/dns_primary.pp @@ -1,7 +1,17 @@ # the primary (hidden master) nameserver does bind zone file stuff and letsencrypt cert handling -class roles::dns_primary { +# +# it will not, by default, open the firewall for requests. however, it will +# collect ferm simple rules tagged named::primary::ferm which our own +# secondaries (the geo nodes) and the monitoring infrastructure export. +# Additional networks can be set with allow_access for any 3rd party nodes that +# should have access. +# @param allow_access additional hosts/network that should be allowed to port 53 +class roles::dns_primary( + Array[Stdlib::IP::Address] $allow_access = [], +) { include named::primary + # ssh setup to sync the geonodes ssh::authorized_key_collect { 'dns_primary-dnsadm': target_user => 'dnsadm', collect_tag => 'dns_primary', @@ -22,4 +32,35 @@ class roles::dns_primary { key => $facts['dnsadm_key'], collect_tag => 'geodnssync-node', } + + # ssh setup to sync letsencrypt info to puppet + ssh::keygen {'letsencrypt': } + ssh::authorized_key_add { 'dns_primary::puppetmaster::letsencrypt-certificates': + target_user => 'puppet', + command => 'rsync --server -vlogDtprze.iLsfx --delete --partial . /srv/puppet.debian.org/from-letsencrypt', + key => $facts['letsencrypt_key'], + collect_tag => 'puppetmaster', + } + + # firewalling + ferm::rule::simple { 'dns-from-secondaries': + description => 'Allow additional (such as 3rd party secondary nameserver) access to the primary', + proto => ['udp', 'tcp'], + port => 'domain', + saddr => $allow_access, + } + Ferm::Rule::Simple <<| tag == 'named::primary::ferm' |>> + + # mini-nag does nrpe queries to check if hosts are still up + @@ferm::rule::simple { "dsa-nrpe-from-dnsprimary-${::fqdn}": + tag => 'nagios-nrpe::server', + description => 'Allow dns primary running mini-nag access to the nrpe daemon', + port => '5666', + saddr => $base::public_addresses, + } + @@concat::fragment { "nrpe-debian-allow-${::fqdn}": + tag => 'nagios-nrpe::server::debianorg.cfg', + target => '/etc/nagios/nrpe.d/debianorg.cfg', + content => "allowed_hosts=${ $base::public_addresses.join(', ') }", + } }