Zack Williams | 99adf6b | 2016-03-14 17:01:08 -0700 | [diff] [blame] | 1 | # unbound.conf (configured by Ansible) |
| 2 | |
| 3 | server: |
Zack Williams | c59b6b2 | 2016-04-11 12:49:10 -0700 | [diff] [blame] | 4 | {% if unbound_listen_on_default %} |
| 5 | interface: {{ ansible_default_ipv4.address }} |
| 6 | {% endif %} |
| 7 | {% if unbound_interfaces is defined %} |
| 8 | {% for cidr_ipv4 in unbound_interfaces %} |
Zack Williams | 99adf6b | 2016-03-14 17:01:08 -0700 | [diff] [blame] | 9 | interface: {{ cidr_ipv4 | ipaddr('address') }} |
Zack Williams | c59b6b2 | 2016-04-11 12:49:10 -0700 | [diff] [blame] | 10 | {% endfor %} |
| 11 | {% endif %} |
Zack Williams | 99adf6b | 2016-03-14 17:01:08 -0700 | [diff] [blame] | 12 | verbosity: 1 |
| 13 | port: 53 |
| 14 | do-ip4: yes |
| 15 | do-udp: yes |
| 16 | do-tcp: yes |
| 17 | |
| 18 | # allow from localhost |
| 19 | access-control: 127.0.0.0/24 allow |
| 20 | |
Zack Williams | c59b6b2 | 2016-04-11 12:49:10 -0700 | [diff] [blame] | 21 | {% if unbound_listen_on_default %} |
| 22 | # allow from default interfaces |
| 23 | access-control: {{ ansible_default_ipv4.address }}/{{ (ansible_default_ipv4.address ~ "/" ~ ansible_default_ipv4.netmask) | ipaddr('prefix') }} allow |
| 24 | {% endif %} |
| 25 | |
| 26 | {% if unbound_interfaces is defined %} |
Zack Williams | 99adf6b | 2016-03-14 17:01:08 -0700 | [diff] [blame] | 27 | # allow from local networks |
Zack Williams | c59b6b2 | 2016-04-11 12:49:10 -0700 | [diff] [blame] | 28 | {% for cidr_ipv4 in unbound_interfaces %} |
Zack Williams | ef434f8 | 2016-04-07 17:15:39 -0700 | [diff] [blame] | 29 | access-control: {{ cidr_ipv4 }} allow |
Zack Williams | c59b6b2 | 2016-04-11 12:49:10 -0700 | [diff] [blame] | 30 | {% endfor %} |
| 31 | {% endif %} |
Zack Williams | 99adf6b | 2016-03-14 17:01:08 -0700 | [diff] [blame] | 32 | |
| 33 | {% if nsd_zones is defined %} |
| 34 | # allow unbound to query localhost, where nsd is listening |
| 35 | do-not-query-localhost: no |
| 36 | |
| 37 | # allow reverse queries for RFC1918 addresses |
| 38 | {% for zone in nsd_zones %} |
| 39 | local-zone: "{{ zone.name_reverse_unbound }}." nodefault |
| 40 | {% endfor %} |
| 41 | |
| 42 | # stub-zones zones that nsd is serving |
| 43 | {% for zone in nsd_zones %} |
| 44 | stub-zone: |
| 45 | name: "{{ zone.name }}" |
| 46 | stub-addr: {{ nsd_ip | default("127.0.0.1") }} |
| 47 | |
| 48 | stub-zone: |
| 49 | name: "{{ zone.name_reverse_unbound }}." |
| 50 | stub-addr: {{ nsd_ip | default("127.0.0.1") }} |
| 51 | |
| 52 | {% endfor %} |
| 53 | {% endif %} |
| 54 | |