Closed nadvornik closed 6 years ago
I have added some fixes and cleanup.
See the comment above.
The use of INCLUDE is needed for correct function of auto serial. It separates the data part of the zone which is watched by salt and the header which is auto-updated.
The de-duplication of code could be made a separate request, but it was not that big issue before my changes, so I think that it better fits here.
@nadvornik, testing this PR with this pillar.yaml
file
bind:
configured_views:
myview1: # First (and only) view
match_clients: # The clients we wish to match
- client1
- client2
configured_zones:
my.zone: # We've defined a new zone in here
type: master
notify: False
update_policy: # A given update policy
- "grant core_dhcp name dns_entry_allowed_to_update. ANY"
example.com:
type: master
notify: false
available_zones:
my.zone:
file: my.zone.txt
soa:
class: IN
ns: ns1.example.com
contact: hostmaster.example.com
serial: 2017041001
retry: 600
ttl: 8600
records:
A:
mx1:
- 1.2.3.228
- 1.2.3.229
example.com:
file: example.com.txt
soa:
class: IN
ns: ns1.example.com
contact: hostmaster.example.com
serial: 2017041001
retry: 600
ttl: 8600
records:
A:
mx1:
- 1.2.3.228
- 1.2.3.229
- 2.3.4.186
cat: 2.3.4.188
rat: 1.2.3.231
live: 1.2.3.236
NS:
'@':
- rat
- cat
CNAME:
ftp: cat.example.com.
www: cat.example.com.
mail: mx1.example.com.
smtp: mx1.example.com.
TXT:
'@':
- '"some_value"'
- '"v=spf1 mx a ip4:1.2.3.4 ~all"'
_dmarc: '"v=DMARC1; p=quarantine; rua=mailto:dmarc@example.com; fo=1:d:s; adkim=r; aspf=r; pct=100; ri=86400"'
creates this /etc/bind/named.conf.local
file:
# vim: sts=2 ts=2 sw=2 et ai
//
// Do any local configuration here
//
// Consider adding the 1918 zones here, if they are not used in your
// organization
//include "/etc/bind/zones.rfc1918";
view myview1 {
match-clients {
client1;
client2;
};
zone "my.zone" {
type master;
file "/var/cache/bind/zones/my.zone.txt";
update-policy {
grant core_dhcp name dns_entry_allowed_to_update. ANY;
};
notify no;
};
zone "example.com" {
type master;
file "/var/cache/bind/zones/example.com.txt";
notify no;
};
};
view False {
match-clients {
};
};
logging {
channel "querylog" {
file "/var/log/bind9/query.log";
print-time yes;
};
category queries { querylog; };
};
see the False
-named view? Do you notice anything wrong in the pillar I'm using to test the PR? I want to finish checking it does not break anything so we can merge it.
@nadvornik, did you have some time to check this issue I'm having, so we can finally merge this PR?
+1 Would love this see this PR merged, we would greatly appreciate have the automatic increment of the serial number.
@nadvornik, could you please rebase your PR, now that some pending changes have been merged?
ok, I am working on it.
the False-named view issue should be fixed now
@nadvornik, thanks for this PR Awesome work! Also, thanks @aanriot for helping review it
:smile:
Hi,
this pull request adds an option to auto-update zone file serial. It is based on salt module dnsutils.serial.
See also https://github.com/saltstack/salt/pull/15828