X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=modules%2Funbound%2Fmanifests%2Finit.pp;h=5261009bbebed1de7b60d06be5192182ce144d7d;hb=04ff326f9e84287fa1c944f562a3594a8a5fbbdb;hp=13a6adba300df218760430c870ad5c67fa625c70;hpb=132ca45393a7d7fe277a5eb391e211d2c1775d24;p=dsa-puppet.git diff --git a/modules/unbound/manifests/init.pp b/modules/unbound/manifests/init.pp index 13a6adba..5261009b 100644 --- a/modules/unbound/manifests/init.pp +++ b/modules/unbound/manifests/init.pp @@ -1,5 +1,17 @@ +# = Class: unbound +# +# This class installs and configures unbound +# +# == Sample Usage: +# +# include unbound +# class unbound { + $is_recursor = getfromhash($site::nodeinfo, 'misc', 'resolver-recursive') + $client_ranges = getfromhash($site::nodeinfo, 'hoster', 'allow_dns_query') + $ns = hiera('nameservers') + package { 'unbound': ensure => installed } @@ -43,18 +55,16 @@ class unbound { notify => Service['unbound'] } - if getfromhash($site::nodeinfo, 'misc', 'resolver-recursive') { - if getfromhash($site::nodeinfo, 'hoster', 'allow_dns_query') { - @ferm::rule { 'dsa-dns': - domain => 'ip', - description => 'Allow nameserver access', - rule => sprintf('&TCP_UDP_SERVICE_RANGE(53, (%s))', join_spc(filter_ipv4(getfromhash($site::nodeinfo, 'hoster', 'allow_dns_query')))), - } - @ferm::rule { 'dsa-dns6': - domain => 'ip6', - description => 'Allow nameserver access', - rule => sprintf('&TCP_UDP_SERVICE_RANGE(53, (%s))', join_spc(filter_ipv6(getfromhash($site::nodeinfo, 'hoster', 'allow_dns_query')))), - } + if ($is_recursor and $client_ranges) { + @ferm::rule { 'dsa-dns': + domain => 'ip', + description => 'Allow nameserver access', + rule => sprintf('&TCP_UDP_SERVICE_RANGE(53, (%s))', join_spc(filter_ipv4(getfromhash($site::nodeinfo, 'hoster', 'allow_dns_query')))), + } + @ferm::rule { 'dsa-dns6': + domain => 'ip6', + description => 'Allow nameserver access', + rule => sprintf('&TCP_UDP_SERVICE_RANGE(53, (%s))', join_spc(filter_ipv6(getfromhash($site::nodeinfo, 'hoster', 'allow_dns_query')))), } } }