Skip to content

Instantly share code, notes, and snippets.

@PhirePhly
Last active September 20, 2019 03:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PhirePhly/3afff4838f4a8e31ed039d00737efb17 to your computer and use it in GitHub Desktop.
Save PhirePhly/3afff4838f4a8e31ed039d00737efb17 to your computer and use it in GitHub Desktop.
Conf files for BIND catalog files example
#!/usr/bin/env python3
import dns.name
import hashlib
import sys
print (hashlib.sha1(dns.name.from_text(sys.argv[1]).to_wire()).hexdigest())
catalog.ns1.lan.thelifeofkenneth.com. IN SOA . . 14 2d 15m 1000h 5m
catalog.ns1.lan.thelifeofkenneth.com. IN NS ns1.lan.thelifeofkenneth.com.
version IN TXT "1"
ddb8c2c4b7c59a9a3344cc034ccb8637f89ff997.zones IN PTR zone1.example.com.
12b1bb2a76ba242857318440f4fc9f7d35e9c4ed.zones IN PTR zone2.example.com.
zone "catalog.ns1.lan.thelifeofkenneth.com" {
type master;
file "/etc/bind/catalog.db";
allow-transfer { any; };
also-notify {10.44.1.234; };
};
zone "zone1.example.com" {
type master;
file "/etc/bind/zone1.example.com.db";
allow-transfer { any; };
also-notify {10.44.1.234; };
};
zone "zone2.example.com" {
type master;
file "/etc/bind/zone2.example.com.db";
allow-transfer { any; };
also-notify {10.44.1.234; };
};
options {
directory "/var/cache/bind";
dnssec-validation auto;
auth-nxdomain no; # conform to RFC1035
listen-on-v6 { any; };
recursion no;
};
logging {
channel zone_transfers_log {
file "/var/cache/bind/zone_transfers" versions 3 size 20m;
print-time yes;
print-category yes;
print-severity yes;
severity info;
};
category notify { zone_transfers_log; };
category xfer-in { zone_transfers_log; };
category xfer-out { zone_transfers_log; };
};
zone1.example.com. 3600 IN SOA . . 4 2d 15m 1000h 5m
zone1.example.com. IN NS ns1.lan.thelifeofkenneth.com.
zone1.example.com. IN NS ns2.lan.thelifeofkenneth.com.
test IN TXT "hello world"
zone2.example.com. 3600 IN SOA . . 4 2d 15m 1000h 5m
zone2.example.com. IN NS ns1.lan.thelifeofkenneth.com.
zone2.example.com. IN NS ns2.lan.thelifeofkenneth.com.
test IN TXT "hello world2"
kenneth@ns2:~$ ls /var/cache/bind/
catalog.db
__catz___default_catalog.ns1.lan.thelifeofkenneth.com_zone1.example.com.db
__catz___default_catalog.ns1.lan.thelifeofkenneth.com_zone2.example.com.db
managed-keys.bind
managed-keys.bind.jnl
zone_transfers
// This is the only zone explicitly configured for ns2, and that's what makes this amazing!
zone "catalog.ns1.lan.thelifeofkenneth.com" {
type slave;
file "catalog.db";
masters { 10.44.1.228; };
};
options {
directory "/var/cache/bind";
dnssec-validation auto;
auth-nxdomain no; # conform to RFC1035
listen-on-v6 { any; };
recursion no;
catalog-zones {
zone "catalog.ns1.lan.thelifeofkenneth.com" default-masters { 10.44.1.228; };
};
};
logging {
channel zone_transfers_log {
file "/var/cache/bind/zone_transfers" versions 3 size 20m;
print-time yes;
print-category yes;
print-severity yes;
severity info;
};
category notify { zone_transfers_log; };
category xfer-in { zone_transfers_log; };
category xfer-out { zone_transfers_log; };
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment