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 { '/var/lib/unbound':
30 require => Package['unbound'],
33 file { '/var/lib/unbound/root.key':
39 source => 'puppet:///modules/unbound/root.key'
41 file { '/var/lib/unbound/debian.org.key':
47 source => 'puppet:///modules/unbound/debian.org.key'
49 file { '/etc/unbound/unbound.conf':
50 content => template('unbound/unbound.conf.erb'),
53 File['/var/lib/unbound/root.key'],
54 File['/var/lib/unbound/debian.org.key']
56 notify => Service['unbound']
59 if ($is_recursor and not $empty_client_range) {
60 @ferm::rule { 'dsa-dns':
62 description => 'Allow nameserver access',
63 rule => sprintf('&TCP_UDP_SERVICE_RANGE(53, (%s))', join_spc(filter_ipv4($client_ranges))),
65 @ferm::rule { 'dsa-dns6':
67 description => 'Allow nameserver access',
68 rule => sprintf('&TCP_UDP_SERVICE_RANGE(53, (%s))', join_spc(filter_ipv6($client_ranges))),