blob: ff5ccbd880e3d457fcd796606d1b898c978116b4 [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 Williamsc59b6b22016-04-11 12:49:10 -070021{% 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 Williams99adf6b2016-03-14 17:01:08 -070027 # allow from local networks
Zack Williamsc59b6b22016-04-11 12:49:10 -070028{% for cidr_ipv4 in unbound_interfaces %}
Zack Williamsef434f82016-04-07 17:15:39 -070029 access-control: {{ cidr_ipv4 }} allow
Zack Williamsc59b6b22016-04-11 12:49:10 -070030{% endfor %}
31{% endif %}
Zack Williams99adf6b2016-03-14 17:01:08 -070032
33{% if nsd_zones is defined %}
34# allow unbound to query localhost, where nsd is listening
35do-not-query-localhost: no
36
37# allow reverse queries for RFC1918 addresses
38{% for zone in nsd_zones %}
39local-zone: "{{ zone.name_reverse_unbound }}." nodefault
40{% endfor %}
41
42# stub-zones zones that nsd is serving
43{% for zone in nsd_zones %}
44stub-zone:
45 name: "{{ zone.name }}"
46 stub-addr: {{ nsd_ip | default("127.0.0.1") }}
47
48stub-zone:
49 name: "{{ zone.name_reverse_unbound }}."
50 stub-addr: {{ nsd_ip | default("127.0.0.1") }}
51
52{% endfor %}
53{% endif %}
54