3 # This class installs and configures unbound
11 $is_recursor = getfromhash($site::nodeinfo, 'misc', 'resolver-recursive')
12 $client_ranges = hiera('allow_dns_query')
13 $empty_client_range = empty($client_ranges)
14 $ns = hiera('nameservers')
26 file { '/etc/init.d/unbound':
27 source => 'puppet:///modules/unbound/unbound.init',
29 notify => Exec['systemctl daemon-reload'],
31 file { '/var/lib/unbound':
35 require => Package['unbound'],
38 file { '/var/lib/unbound/root.key':
44 source => 'puppet:///modules/unbound/root.key'
46 file { '/var/lib/unbound/debian.org.key':
52 source => 'puppet:///modules/unbound/debian.org.key'
54 file { '/var/lib/unbound/29.172.in-addr.arpa.key':
60 source => 'puppet:///modules/unbound/29.172.in-addr.arpa.key'
62 file { '/etc/unbound/unbound.conf':
63 content => template('unbound/unbound.conf.erb'),
66 File['/var/lib/unbound/root.key'],
67 File['/var/lib/unbound/debian.org.key']
69 notify => Service['unbound']
72 if ($is_recursor and !$empty_client_range) {
73 @ferm::rule { 'dsa-dns':
75 description => 'Allow nameserver access',
76 rule => sprintf('&TCP_UDP_SERVICE_RANGE(53, (%s))', join_spc(filter_ipv4($client_ranges))),
78 @ferm::rule { 'dsa-dns6':
80 description => 'Allow nameserver access',
81 rule => sprintf('&TCP_UDP_SERVICE_RANGE(53, (%s))', join_spc(filter_ipv6($client_ranges))),