--- /dev/null
+
+/etc/bind:
+ file.directory:
+ - user: root
+ - group: bind
+ - dir_mode: 2755
+ - makedirs: True
+ - require:
+ - group: bind-group
+
+/etc/bind/zones:
+ file.directory:
+ - user: root
+ - group: bind
+ - dir_mode: 755
+ - require:
+ - file: /etc/bind
+
+/var/cache/bind:
+ file.directory:
+ - user: root
+ - group: bind
+ - dir_mode: 775
+ - makedirs: True
+ - require:
+ - group: bind-group
+
+/var/log/bind:
+ file.directory:
+ - user: bind
+ - group: bind
+ - dir_mode: 755
+ - makedirs: True
+ - require:
+ - group: bind-group
+ - user: bind-user
+
+/etc/bind/dnssec:
+ file.directory:
+ - user: root
+ - group: root
+ - dir_mode: 700
+ - makedirs: True
+
--- /dev/null
+{%- set dnssec = salt['pillar.get']('bind:dnssec', {}) -%}
+key "rndc-key" {
+ algorithm {{ dnssec.rndc.algo_name|lower|replace('_', '-') }};
+ secret "{{ dnssec.rndc.key }}";
+};
--- /dev/null
+{%- set dnssec = salt['pillar.get']('bind:dnssec', {}) -%}
+Private-key-format: v1.3
+Algorithm: {{ dnssec.rndc.algo_nr }} ({{ dnssec.rndc.algo_name }})
+Key: {{ dnssec.rndc.key }}
+Bits: {{ dnssec.rndc.bits }}
+Created: {{ dnssec.rndc.date }}
+Publish: {{ dnssec.rndc.date }}
+Activate: {{ dnssec.rndc.date }}
--- /dev/null
+{%- set dnssec = salt['pillar.get']('bind:dnssec', {}) -%}
+{{ dnssec.rndc.name }}. IN KEY {{ dnssec.rndc.bits_num }} 3 {{ dnssec.rndc.algo_nr }} {{ dnssec.rndc.key }}
--- /dev/null
+
+include:
+ - bind.user
+ - bind.dirs
+ - bind.rndc
--- /dev/null
+{%- set dnssec = salt['pillar.get']('bind:dnssec', {}) -%}
+
+/etc/bind/rndc.key:
+ file.managed:
+ - source: salt://bind/files/rndc.key
+ - user: bind
+ - group: bind
+ - mode: 640
+ - template: jinja
+ - backup: minion
+ - require:
+ - file: /etc/bind
+ - group: bind-group
+ - user: bind-user
+
+rndc-keyfile-public:
+ file.managed:
+ - name: /etc/bind/dnssec/K{{ dnssec.rndc.name }}.+{{ dnssec.rndc.algo_nr }}+{{ dnssec.rndc.footprint }}.key
+ - source: salt://bind/files/rndc.public
+ - user: root
+ - group: root
+ - mode: 600
+ - template: jinja
+ - backup: minion
+ - require:
+ - file: /etc/bind/dnssec
+
+rndc-keyfile-private:
+ file.managed:
+ - name: /etc/bind/dnssec/K{{ dnssec.rndc.name }}.+{{ dnssec.rndc.algo_nr }}+{{ dnssec.rndc.footprint }}.private
+ - source: salt://bind/files/rndc.private
+ - user: root
+ - group: root
+ - mode: 600
+ - template: jinja
+ - backup: minion
+ - require:
+ - file: /etc/bind/dnssec
+
--- /dev/null
+
+bind-group:
+ group.present:
+ - name: bind
+ - system: True
+
+bind-user:
+ user.present:
+ - name: bind
+ - gid: bind
+ - fullname: Bind daemon user
+ - shell: /bin/false
+ - home: /var/cache/bind
+ - system: True
+ - createhome: False
+ - require:
+ - group: bind-group