blob: 59c44e94b93b67a18d03f1c2bdcae764473e7d7f [file] [log] [blame]
Matteo Scandolo3896c472017-08-01 13:31:42 -07001
2{#
3Copyright 2017-present Open Networking Foundation
4
5Licensed under the Apache License, Version 2.0 (the "License");
6you may not use this file except in compliance with the License.
7You may obtain a copy of the License at
8
9http://www.apache.org/licenses/LICENSE-2.0
10
11Unless required by applicable law or agreed to in writing, software
12distributed under the License is distributed on an "AS IS" BASIS,
13WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14See the License for the specific language governing permissions and
15limitations under the License.
16#}
17
18
Zack Williams99adf6b2016-03-14 17:01:08 -070019# unbound.conf (configured by Ansible)
20
21server:
Zack Williamsc59b6b22016-04-11 12:49:10 -070022{% if unbound_listen_on_default %}
23 interface: {{ ansible_default_ipv4.address }}
24{% endif %}
25{% if unbound_interfaces is defined %}
26{% for cidr_ipv4 in unbound_interfaces %}
Zack Williams99adf6b2016-03-14 17:01:08 -070027 interface: {{ cidr_ipv4 | ipaddr('address') }}
Zack Williamsc59b6b22016-04-11 12:49:10 -070028{% endfor %}
29{% endif %}
Zack Williams99adf6b2016-03-14 17:01:08 -070030 verbosity: 1
31 port: 53
32 do-ip4: yes
33 do-udp: yes
34 do-tcp: yes
35
36 # allow from localhost
37 access-control: 127.0.0.0/24 allow
38
Zack Williamsba5549c2017-03-25 15:04:45 -070039{% if unbound_listen_all %}
40 # allow from everywhere
41 access-control: 0.0.0.0/0 allow
42{% endif %}
43
Zack Williamsc59b6b22016-04-11 12:49:10 -070044{% if unbound_listen_on_default %}
45 # allow from default interfaces
46 access-control: {{ ansible_default_ipv4.address }}/{{ (ansible_default_ipv4.address ~ "/" ~ ansible_default_ipv4.netmask) | ipaddr('prefix') }} allow
47{% endif %}
48
49{% if unbound_interfaces is defined %}
Zack Williams99adf6b2016-03-14 17:01:08 -070050 # allow from local networks
Zack Williamsc59b6b22016-04-11 12:49:10 -070051{% for cidr_ipv4 in unbound_interfaces %}
Zack Williamsba5549c2017-03-25 15:04:45 -070052 access-control: {{ cidr_ipv4 | ipaddr('0') }} allow
Zack Williamsc59b6b22016-04-11 12:49:10 -070053{% endfor %}
54{% endif %}
Zack Williams99adf6b2016-03-14 17:01:08 -070055
56{% if nsd_zones is defined %}
57# allow unbound to query localhost, where nsd is listening
58do-not-query-localhost: no
59
60# allow reverse queries for RFC1918 addresses
61{% for zone in nsd_zones %}
62local-zone: "{{ zone.name_reverse_unbound }}." nodefault
63{% endfor %}
64
65# stub-zones zones that nsd is serving
66{% for zone in nsd_zones %}
67stub-zone:
68 name: "{{ zone.name }}"
69 stub-addr: {{ nsd_ip | default("127.0.0.1") }}
70
71stub-zone:
72 name: "{{ zone.name_reverse_unbound }}."
73 stub-addr: {{ nsd_ip | default("127.0.0.1") }}
74
75{% endfor %}
76{% endif %}
77