2014-10-16 10:54:02 +00:00
|
|
|
# vim: sts=2 ts=2 sw=2 et ai
|
2014-01-03 15:57:10 -08:00
|
|
|
//
|
|
|
|
// Do any local configuration here
|
|
|
|
//
|
|
|
|
|
|
|
|
// Consider adding the 1918 zones here, if they are not used in your
|
|
|
|
// organization
|
|
|
|
//include "/etc/bind/zones.rfc1918";
|
|
|
|
|
2018-11-14 11:11:07 -05:00
|
|
|
{% for name, data in salt['pillar.get']('bind:configured_acls', {})|dictsort %}
|
|
|
|
acl {{ name }} {
|
|
|
|
{%- for d in data %}
|
|
|
|
{{ d }};
|
|
|
|
{%- endfor %}
|
|
|
|
};
|
|
|
|
{%- endfor %}
|
|
|
|
|
|
|
|
{%- for name, data in salt['pillar.get']('bind:configured_masters', {})|dictsort %}
|
|
|
|
masters {{ name }} {
|
|
|
|
{%- for d in data %}
|
|
|
|
{{ d }};
|
|
|
|
{%- endfor %}
|
|
|
|
};
|
|
|
|
{%- endfor %}
|
|
|
|
|
2015-03-22 22:07:22 +01:00
|
|
|
{%- macro zone(key, args, file, masters) %}
|
2014-01-03 15:57:10 -08:00
|
|
|
zone "{{ key }}" {
|
|
|
|
type {{ args['type'] }};
|
2016-01-09 08:12:21 +00:00
|
|
|
{% if args['type'] == 'forward' -%}
|
2016-04-18 13:46:31 +00:00
|
|
|
{% if args['forward'] is defined -%}
|
|
|
|
forward {{ args['forward'] }};
|
|
|
|
{%- endif %}
|
2016-01-09 08:12:21 +00:00
|
|
|
forwarders {
|
|
|
|
{% for forwarder in args.forwarders -%}
|
|
|
|
{{ forwarder }};
|
2016-04-18 13:46:31 +00:00
|
|
|
{%- endfor %}
|
2016-01-09 08:12:21 +00:00
|
|
|
};
|
|
|
|
{% else -%}
|
2015-02-03 10:35:11 +01:00
|
|
|
{% if args['dnssec'] is defined and args['dnssec'] -%}
|
2018-07-27 13:30:14 +01:00
|
|
|
file "{{ zones_directory }}/{{ file }}.signed";
|
2015-02-03 10:35:11 +01:00
|
|
|
{% else -%}
|
2018-07-27 13:30:14 +01:00
|
|
|
file "{{ zones_directory }}/{{ file }}";
|
2015-02-03 10:35:11 +01:00
|
|
|
{%- endif %}
|
2018-06-06 13:53:28 +02:00
|
|
|
{% if args['auto-dnssec'] is defined -%}
|
|
|
|
auto-dnssec {{ args['auto-dnssec'] }};
|
|
|
|
inline-signing yes;
|
|
|
|
{%- endif %}
|
2016-07-19 03:24:32 -07:00
|
|
|
{%- if args['allow-update'] is defined %}
|
2019-10-09 04:12:50 +01:00
|
|
|
allow-update { {{ args['allow-update'] }}; };
|
2014-10-16 10:54:02 +00:00
|
|
|
{%- endif %}
|
2015-03-22 23:26:35 +01:00
|
|
|
{%- if args.update_policy is defined %}
|
|
|
|
update-policy {
|
|
|
|
{%- for policy in args.update_policy %}
|
|
|
|
{{ policy }};
|
|
|
|
{%- endfor %}
|
2015-03-23 06:54:37 -05:00
|
|
|
};
|
2015-03-22 23:26:35 +01:00
|
|
|
{%- endif %}
|
2016-07-19 03:24:32 -07:00
|
|
|
{%- if args['allow-transfer'] is defined %}
|
|
|
|
allow-transfer { {{ args.get('allow-transfer', []) | join('; ') }}; };
|
|
|
|
{%- endif %}
|
2016-07-31 21:46:06 +02:00
|
|
|
{%- if args['also-notify'] is defined %}
|
|
|
|
also-notify { {{ args.get('also-notify', []) | join('; ') }}; };
|
|
|
|
{%- endif %}
|
2017-10-18 22:35:21 +02:00
|
|
|
{%- if args['allow-query'] is defined %}
|
|
|
|
allow-query { {{ args.get('allow-query', []) | join('; ') }}; };
|
|
|
|
{%- endif %}
|
|
|
|
{%- if args['zone-statistics'] is defined %}
|
|
|
|
zone-statistics yes;
|
|
|
|
{%- endif %}
|
2016-07-19 03:24:32 -07:00
|
|
|
{%- if args['type'] == "master" -%}
|
|
|
|
{% if args['notify'] %}
|
2014-01-03 15:57:10 -08:00
|
|
|
notify yes;
|
2016-07-19 03:24:32 -07:00
|
|
|
{% else %}
|
2014-01-03 15:57:10 -08:00
|
|
|
notify no;
|
|
|
|
{%- endif -%}
|
2016-07-19 03:24:32 -07:00
|
|
|
{% else %}
|
2014-03-01 14:54:41 -08:00
|
|
|
notify no;
|
2017-07-11 23:11:10 -04:00
|
|
|
{%- if masters is iterable and masters is not string %}
|
|
|
|
masters {
|
|
|
|
{%- for item in masters %}
|
|
|
|
{{ item }};
|
|
|
|
{%- endfor %}
|
|
|
|
};
|
|
|
|
{%- else %}
|
|
|
|
masters { {{ masters }} };
|
|
|
|
{%- endif %}
|
2014-01-03 15:57:10 -08:00
|
|
|
{%- endif %}
|
2016-01-09 08:12:21 +00:00
|
|
|
{%- endif %}
|
2014-01-03 15:57:10 -08:00
|
|
|
};
|
2015-03-22 22:07:22 +01:00
|
|
|
{%- endmacro %}
|
|
|
|
|
2015-03-23 06:54:37 -05:00
|
|
|
{%- if salt['pillar.get']('bind:configured_views', {}) is not defined %}
|
|
|
|
include "{{ map.default_zones_config }}";
|
2015-03-22 22:07:22 +01:00
|
|
|
{%- endif %}
|
|
|
|
|
2018-08-31 13:46:54 +02:00
|
|
|
{% for key, args in salt['pillar.get']('bind:configured_zones', {})|dictsort -%}
|
2017-10-18 22:35:21 +02:00
|
|
|
{%- if salt['pillar.get']("bind:configured_zones:" + key + ":file") -%}
|
|
|
|
{%- set file = salt['pillar.get']("bind:configured_zones:" + key + ":file") %}
|
|
|
|
{% else %}
|
2015-03-22 22:07:22 +01:00
|
|
|
{%- set file = salt['pillar.get']("bind:available_zones:" + key + ":file") %}
|
2017-10-18 22:35:21 +02:00
|
|
|
{%- endif -%}
|
|
|
|
|
|
|
|
{%- if salt['pillar.get']("bind:configured_zones:" + key + ":masters") -%}
|
|
|
|
{%- set masters = salt['pillar.get']("bind:configured_zones:" + key + ":masters") %}
|
|
|
|
{% else %}
|
2015-03-22 22:07:22 +01:00
|
|
|
{%- set masters = salt['pillar.get']("bind:available_zones:" + key + ":masters") %}
|
2017-10-18 22:35:21 +02:00
|
|
|
{%- endif -%}
|
2015-03-22 22:07:22 +01:00
|
|
|
{{ zone(key, args, file, masters) }}
|
2014-01-03 15:57:10 -08:00
|
|
|
{% endfor %}
|
|
|
|
|
2018-11-14 11:11:07 -05:00
|
|
|
{%- for view, view_data in salt['pillar.get']('bind:configured_views', {})|dictsort %}
|
2015-03-22 22:07:22 +01:00
|
|
|
|
2015-03-23 06:54:37 -05:00
|
|
|
view {{ view }} {
|
|
|
|
{%- if view == 'default' %}
|
|
|
|
include "{{ map.default_zones_config }}";
|
2015-03-22 22:07:22 +01:00
|
|
|
{%- endif %}
|
2018-11-14 11:11:07 -05:00
|
|
|
match-clients {
|
2015-03-22 22:07:22 +01:00
|
|
|
{%- for acl in view_data.get('match_clients', {}) %}
|
2018-11-14 11:11:07 -05:00
|
|
|
{{ acl }};
|
2015-03-22 22:07:22 +01:00
|
|
|
{%- endfor %}
|
2018-11-14 11:11:07 -05:00
|
|
|
};
|
2015-03-22 22:07:22 +01:00
|
|
|
|
2018-11-14 11:11:07 -05:00
|
|
|
{%- for key, args in view_data.get('configured_zones', {})|dictsort -%}
|
|
|
|
{%- if 'file' in args %}
|
|
|
|
{%- set file = args.file %}
|
|
|
|
{%- else %}
|
|
|
|
{%- set file = salt['pillar.get']("bind:available_zones:" + key + ":file") %}
|
|
|
|
{%- endif %}
|
2015-03-22 22:07:22 +01:00
|
|
|
{%- set masters = salt['pillar.get']("bind:available_zones:" + key + ":masters") %}
|
2018-11-14 11:11:07 -05:00
|
|
|
{{ zone(key, args, file, masters) }}
|
2015-03-22 22:07:22 +01:00
|
|
|
{%- endfor %}
|
|
|
|
};
|
|
|
|
{%- endfor %}
|
|
|
|
|
2018-05-26 19:57:58 -03:00
|
|
|
{%- if salt['pillar.get']('bind:config:enable_logging', True) %}
|
2017-10-18 22:35:21 +02:00
|
|
|
{%- if salt['pillar.get']('bind:config:use_extensive_logging', False) %}
|
|
|
|
include "{{ map.logging_config }}";
|
|
|
|
{% else %}
|
2014-01-03 15:57:10 -08:00
|
|
|
logging {
|
2015-03-23 06:54:37 -05:00
|
|
|
channel "querylog" {
|
|
|
|
file "{{ map.log_dir }}/query.log";
|
|
|
|
print-time yes;
|
|
|
|
};
|
2014-01-03 15:57:10 -08:00
|
|
|
category queries { querylog; };
|
|
|
|
};
|
2017-10-18 22:35:21 +02:00
|
|
|
{%- endif %}
|
2018-05-26 19:57:58 -03:00
|
|
|
{%- endif %}
|
2017-10-18 22:35:21 +02:00
|
|
|
|
|
|
|
{%- if salt['pillar.get']('bind:controls', False) %}
|
|
|
|
controls {
|
2018-09-04 21:10:24 +02:00
|
|
|
{%- for name, control in salt['pillar.get']('bind:controls')|dictsort if control.get('enabled', True) %}
|
2017-10-18 22:35:21 +02:00
|
|
|
inet {{ control.get('bind', {}).get('address', '127.0.0.1') }} port {{ control.get('bind', {}).get('port', 953) }}
|
|
|
|
{%- if control.get('allow') %}
|
|
|
|
allow {
|
|
|
|
{%- for allow in control.allow %}
|
|
|
|
{{ allow }};
|
|
|
|
{%- endfor %}
|
|
|
|
}
|
|
|
|
{%- endif %}
|
|
|
|
{%- if control.get('keys') %}
|
|
|
|
keys {
|
|
|
|
{%- for key in control.get('keys') %}
|
|
|
|
{{ key }};
|
|
|
|
{%- endfor %}
|
|
|
|
}
|
|
|
|
{%- endif %};
|
|
|
|
{%- endfor %}
|
|
|
|
};
|
|
|
|
{%- endif %}
|
|
|
|
|
|
|
|
{%- if salt['pillar.get']('bind:statistics', False) %}
|
|
|
|
statistics-channels {
|
2018-09-04 21:10:24 +02:00
|
|
|
{%- for name, channel in salt['pillar.get']('bind:statistics')|dictsort if channel.get('enabled', True) %}
|
2017-10-18 22:35:21 +02:00
|
|
|
inet {{ channel.get('bind', {}).get('address', '127.0.0.1') }} port {{ channel.get('bind', {}).get('port', 953) }}
|
|
|
|
{%- if channel.get('allow') %}
|
|
|
|
allow {
|
|
|
|
{%- for allow in channel.allow %}
|
|
|
|
{{ allow }};
|
|
|
|
{%- endfor %}
|
|
|
|
}
|
|
|
|
{%- endif %};
|
|
|
|
{%- endfor %}
|
|
|
|
};
|
|
|
|
{%- endif %}
|