3 # This class installs and configures unbound
12 $is_recursor = getfromhash($deprecated::nodeinfo, 'misc', 'resolver-recursive')
13 $client_ranges = hiera('allow_dns_query')
14 $firewall_blocks_dns = hiera('firewall_blocks_dns', false)
15 $empty_client_range = empty($client_ranges)
16 $ns = hiera('resolv::nameservers')
28 file { '/etc/init.d/unbound':
29 source => 'puppet:///modules/unbound/unbound.init',
31 notify => Exec['systemctl daemon-reload'],
33 file { '/var/lib/unbound':
37 require => Package['unbound'],
40 file { '/var/lib/unbound/root.key':
46 source => 'puppet:///modules/unbound/root.key',
47 notify => Service['unbound']
49 file { '/var/lib/unbound/debian.org.key':
55 source => 'puppet:///modules/unbound/debian.org.key',
56 notify => Service['unbound']
58 file { '/var/lib/unbound/29.172.in-addr.arpa.key':
59 ensure => $firewall_blocks_dns ? { true => 'absent', default => 'present' },
60 replace => $firewall_blocks_dns ? { true => true, default => false },
64 source => 'puppet:///modules/unbound/29.172.in-addr.arpa.key',
65 notify => Service['unbound']
67 file { '/etc/unbound/unbound.conf':
68 content => template('unbound/unbound.conf.erb'),
71 File['/var/lib/unbound/root.key'],
72 File['/var/lib/unbound/debian.org.key']
74 notify => Service['unbound']
77 if ($is_recursor and !$empty_client_range) {
78 ferm::rule { 'dsa-dns':
80 description => 'Allow nameserver access',
81 rule => sprintf('&TCP_UDP_SERVICE_RANGE(53, (%s))', join_spc(filter_ipv4($client_ranges))),
83 ferm::rule { 'dsa-dns6':
85 description => 'Allow nameserver access',
86 rule => sprintf('&TCP_UDP_SERVICE_RANGE(53, (%s))', join_spc(filter_ipv6($client_ranges))),