From 978ce84b150c3bde76c35b76996260a4cb273d7b Mon Sep 17 00:00:00 2001 From: Piotr Pieprzycki Date: Sun, 29 Oct 2017 16:46:24 +0000 Subject: [PATCH] Added feature rndc clinet --- bind/config.sls | 14 ++++++++++++++ bind/map.jinja | 1 + pillar.example | 19 ++++++++++++++++--- 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/bind/config.sls b/bind/config.sls index 38402c3..5bfb596 100644 --- a/bind/config.sls +++ b/bind/config.sls @@ -147,6 +147,20 @@ bind_logging_config: - watch_in: - service: bind {%- endif %} +{%- if salt['pillar.get']('bind:rndc_client', False) %} +bind_rndc_client_config: + file.managed: + - name: {{ map.rndc_client_config }} + - source: salt://{{ map.config_source_dir }}/rndc.conf + - template: jinja + - user: {{ salt['pillar.get']('bind:config:user', map.user) }} + - group: {{ salt['pillar.get']('bind:config:group', map.group) }} + - mode: {{ salt['pillar.get']('bind:config:mode', '640') }} + - context: + map: {{ map }} + - require: + - pkg: bind +{%- endif %} {% endif %} {% for zone, zone_data in salt['pillar.get']('bind:configured_zones', {}).items() -%} diff --git a/bind/map.jinja b/bind/map.jinja index 75f1d87..4d0284e 100644 --- a/bind/map.jinja +++ b/bind/map.jinja @@ -11,6 +11,7 @@ 'default_config': '/etc/default/bind9', 'default_zones_config': '/etc/bind/named.conf.default-zones', 'logging_config': '/etc/bind/named.conf.logging', + 'rndc_client_config': '/etc/bind/rndc.conf', 'named_directory': '/var/cache/bind/zones', 'log_dir': '/var/log/bind9', 'log_mode': '644', diff --git a/pillar.example b/pillar.example index 9613c57..d1aa75e 100644 --- a/pillar.example +++ b/pillar.example @@ -130,7 +130,6 @@ bind: print-time: yes print-category: yes print-severity: yes - syslog: dynamic severity: info category: default: @@ -209,8 +208,22 @@ bind: query-errors: - query-errors_log - controls: - local: + rndc_client: # Generate rndc.conf file it uses previously defined keys + options: + default: + server: localhost + port: 953 + key: my_default_key + server: + '127.0.0.1': + key: dns_key + 'localhost': + key: dns_key + '8.8.8.8': + key: my_default_key + + controls: # If you define controls then you also should configure rndc_client + local: enabled: true bind: address: 127.0.0.1