|
| 1 | +/* |
| 2 | + * Refer to the named.conf(5) and named(8) man pages, and the documentation |
| 3 | + * in /usr/share/doc/bind-* for more details. |
| 4 | + * Online versions of the documentation can be found here: |
| 5 | + * https://kb.isc.org/article/AA-01031 |
| 6 | + * |
| 7 | + * If you are going to set up an authoritative server, make sure you |
| 8 | + * understand the hairy details of how DNS works. Even with simple mistakes, |
| 9 | + * you can break connectivity for affected parties, or cause huge amounts of |
| 10 | + * useless Internet traffic. |
| 11 | + */ |
| 12 | + |
| 13 | +options { |
| 14 | + directory "{{ map.get('named_directory') }}"; |
| 15 | + pid-file "/run/named/named.pid"; |
| 16 | + |
| 17 | + bindkeys-file "/etc/bind/bind.keys"; |
| 18 | + |
| 19 | +{%- if salt['pillar.get']('bind:config:ipv6', False) %} |
| 20 | + listen-on-v6 { {{ salt['pillar.get']('bind:config:ipv6_listen', 'any') }}; }; |
| 21 | +{%- endif %} |
| 22 | + |
| 23 | + listen-on { 127.0.0.1; }; |
| 24 | + |
| 25 | +{%- for statement, value in salt['pillar.get']('bind:config:options', {})|dictsort -%} |
| 26 | + {%- if value is iterable and value is not string %} |
| 27 | + {{ statement }} { |
| 28 | + {%- for item in value %} |
| 29 | + {{ item }}; |
| 30 | + {%- endfor %} |
| 31 | + }; |
| 32 | + {%- else %} |
| 33 | + {{ statement }} {{ value }}; |
| 34 | + {%- endif %} |
| 35 | +{%- endfor %} |
| 36 | +}; |
| 37 | + |
| 38 | +{% for incl in salt['pillar.get']('bind:config:includes', []) %} |
| 39 | +include "{{ incl }}"; |
| 40 | +{% endfor %} |
| 41 | + |
| 42 | + |
| 43 | +{%- if salt['pillar.get']('bind:controls', False) %} |
| 44 | +controls { |
| 45 | + {%- for name, control in salt['pillar.get']('bind:controls')|dictsort if control.get('enabled', True) %} |
| 46 | + inet {{ control.get('bind', {}).get('address', '127.0.0.1') }} port {{ control.get('bind', {}).get('port', 953) }} |
| 47 | + {%- if control.get('allow') %} |
| 48 | + allow { |
| 49 | + {%- for allow in control.allow %} |
| 50 | + {{ allow }}; |
| 51 | + {%- endfor %} |
| 52 | + } |
| 53 | + {%- endif %} |
| 54 | + {%- if control.get('keys') %} |
| 55 | + keys { |
| 56 | + {%- for key in control.get('keys') %} |
| 57 | + {{ key }}; |
| 58 | + {%- endfor %} |
| 59 | + } |
| 60 | + {%- endif %}; |
| 61 | + {%- endfor %} |
| 62 | + |
| 63 | +}; |
| 64 | +{%- endif %} |
| 65 | + |
| 66 | +zone "." in { |
| 67 | + type hint; |
| 68 | + file "/var/bind/named.cache"; |
| 69 | +}; |
| 70 | + |
| 71 | +zone "localhost" IN { |
| 72 | + type master; |
| 73 | + file "pri/localhost.zone"; |
| 74 | + notify no; |
| 75 | +}; |
| 76 | + |
| 77 | +/* |
| 78 | + * Briefly, a zone which has been declared delegation-only will be effectively |
| 79 | + * limited to containing NS RRs for subdomains, but no actual data beyond its |
| 80 | + * own apex (for example, its SOA RR and apex NS RRset). This can be used to |
| 81 | + * filter out "wildcard" or "synthesized" data from NAT boxes or from |
| 82 | + * authoritative name servers whose undelegated (in-zone) data is of no |
| 83 | + * interest. |
| 84 | + * See http://www.isc.org/software/bind/delegation-only for more info |
| 85 | + */ |
| 86 | + |
| 87 | +//zone "COM" { type delegation-only; }; |
| 88 | +//zone "NET" { type delegation-only; }; |
| 89 | + |
| 90 | +//zone "YOUR-DOMAIN.TLD" { |
| 91 | +// type master; |
| 92 | +// file "/var/bind/pri/YOUR-DOMAIN.TLD.zone"; |
| 93 | +// allow-query { any; }; |
| 94 | +// allow-transfer { xfer; }; |
| 95 | +//}; |
| 96 | + |
| 97 | +//zone "YOUR-SLAVE.TLD" { |
| 98 | +// type slave; |
| 99 | +// file "/var/bind/sec/YOUR-SLAVE.TLD.zone"; |
| 100 | +// masters { <MASTER>; }; |
| 101 | + |
| 102 | + /* Anybody is allowed to query but transfer should be controlled by the master. */ |
| 103 | +// allow-query { any; }; |
| 104 | +// allow-transfer { none; }; |
| 105 | + |
| 106 | + /* The master should be the only one who notifies the slaves, shouldn't it? */ |
| 107 | +// allow-notify { <MASTER>; }; |
| 108 | +// notify no; |
| 109 | +//}; |
| 110 | + |
| 111 | +include "{{ map.local_config }}"; |
0 commit comments