blob: 121a70661c7e047ce3f2b4b3a68dd3576952c157 [file] [log] [blame]
Zack Williams6dc2d452017-12-20 17:50:49 -07001# created by dns-unbound/templates/unbound.conf.j2
Matteo Scandolo3896c472017-08-01 13:31:42 -07002{#
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
Zack Williams99adf6b2016-03-14 17:01:08 -070018server:
Zack Williamsc59b6b22016-04-11 12:49:10 -070019{% if unbound_listen_on_default %}
Zack Williams6dc2d452017-12-20 17:50:49 -070020 # created by unbound_listen_on_default
21 interface: {{ ansible_default_ipv4.address }}
Zack Williamsc59b6b22016-04-11 12:49:10 -070022{% endif %}
Zack Williams6dc2d452017-12-20 17:50:49 -070023{% if unbound_listen_zones %}
24{% for zone in nsd_zones %}
25 # created by nsd_zones: {{ zone.name }}
26 interface: {{ zone.cidr | ipaddr('1') | ipaddr('address') }}
Zack Williamsc59b6b22016-04-11 12:49:10 -070027{% endfor %}
28{% endif %}
Zack Williams99adf6b2016-03-14 17:01:08 -070029 verbosity: 1
30 port: 53
31 do-ip4: yes
Zack Williams6dc2d452017-12-20 17:50:49 -070032 do-ip6: no
Zack Williams99adf6b2016-03-14 17:01:08 -070033 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 Williams6dc2d452017-12-20 17:50:49 -070044{% if nsd_zones %}
45 # allow from networks defined in zones
46{% for zone in nsd_zones %}
47 access-control: {{ zone.cidr | ipaddr('0') }} allow
Zack Williamsc59b6b22016-04-11 12:49:10 -070048{% endfor %}
Zack Williams99adf6b2016-03-14 17:01:08 -070049
Zack Williams99adf6b2016-03-14 17:01:08 -070050# allow unbound to query localhost, where nsd is listening
51do-not-query-localhost: no
52
53# allow reverse queries for RFC1918 addresses
54{% for zone in nsd_zones %}
Zack Williams6dc2d452017-12-20 17:50:49 -070055local-zone: "{{ zone.cidr | unbound_revdns }}" nodefault
Zack Williams99adf6b2016-03-14 17:01:08 -070056{% endfor %}
57
58# stub-zones zones that nsd is serving
59{% for zone in nsd_zones %}
60stub-zone:
61 name: "{{ zone.name }}"
Zack Williams6dc2d452017-12-20 17:50:49 -070062 stub-addr: {{ nsd_ip }}
Zack Williams99adf6b2016-03-14 17:01:08 -070063
64stub-zone:
Zack Williams6dc2d452017-12-20 17:50:49 -070065 name: "{{ zone.cidr | unbound_revdns }}"
66 stub-addr: {{ nsd_ip }}
Zack Williams99adf6b2016-03-14 17:01:08 -070067
68{% endfor %}
69{% endif %}
70