blob: d82a45f492c857f2c7445ae418885fcb501e0941 [file] [log] [blame]
Zack Williams99adf6b2016-03-14 17:01:08 -07001# unbound.conf (configured by Ansible)
2
3server:
Zack Williamsc59b6b22016-04-11 12:49:10 -07004{% 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 Williams99adf6b2016-03-14 17:01:08 -07009 interface: {{ cidr_ipv4 | ipaddr('address') }}
Zack Williamsc59b6b22016-04-11 12:49:10 -070010{% endfor %}
11{% endif %}
Zack Williams99adf6b2016-03-14 17:01:08 -070012 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 Williamsba5549c2017-03-25 15:04:45 -070021{% if unbound_listen_all %}
22 # allow from everywhere
23 access-control: 0.0.0.0/0 allow
24{% endif %}
25
Zack Williamsc59b6b22016-04-11 12:49:10 -070026{% if unbound_listen_on_default %}
27 # allow from default interfaces
28 access-control: {{ ansible_default_ipv4.address }}/{{ (ansible_default_ipv4.address ~ "/" ~ ansible_default_ipv4.netmask) | ipaddr('prefix') }} allow
29{% endif %}
30
31{% if unbound_interfaces is defined %}
Zack Williams99adf6b2016-03-14 17:01:08 -070032 # allow from local networks
Zack Williamsc59b6b22016-04-11 12:49:10 -070033{% for cidr_ipv4 in unbound_interfaces %}
Zack Williamsba5549c2017-03-25 15:04:45 -070034 access-control: {{ cidr_ipv4 | ipaddr('0') }} allow
Zack Williamsc59b6b22016-04-11 12:49:10 -070035{% endfor %}
36{% endif %}
Zack Williams99adf6b2016-03-14 17:01:08 -070037
38{% if nsd_zones is defined %}
39# allow unbound to query localhost, where nsd is listening
40do-not-query-localhost: no
41
42# allow reverse queries for RFC1918 addresses
43{% for zone in nsd_zones %}
44local-zone: "{{ zone.name_reverse_unbound }}." nodefault
45{% endfor %}
46
47# stub-zones zones that nsd is serving
48{% for zone in nsd_zones %}
49stub-zone:
50 name: "{{ zone.name }}"
51 stub-addr: {{ nsd_ip | default("127.0.0.1") }}
52
53stub-zone:
54 name: "{{ zone.name_reverse_unbound }}."
55 stub-addr: {{ nsd_ip | default("127.0.0.1") }}
56
57{% endfor %}
58{% endif %}
59