3 # Our IP addresses; we have machine one and machine two.
4 one4 = A("172.16.254.1") # for each record type, there's a corresponding class with the same name
5 one6 = AAAA("2606:2800:220:6d:26bf:1447:1097:aa7")
6 one = [one4, one6] # collect all addresses of this machine
7 two4 = A("172.16.254.2")
8 two = [two4] # collext all addresses of this machine
10 mail = [MX('mx', 10)] # this is first server name, then priority (as in plain DNS, lower numbers denote higher priorities)
12 # define a useful shorthand to store HTTPS keys via TLSA
14 return TLSA(Protocol.TCP, 443, TLSA.Usage.EndEntity, TLSA.Selector.Full, TLSA.MatchingType.SHA256, key)
16 # setup TTLs by record type
18 '': 1*day, # special value: default TTL
19 'NX': 1*hour, # special value: TTL for NXDOMAIN replies
20 'A': 1*hour, # for the rest, just use the type of the resource records
24 # Now to the actual zone: the header part should be fairly self-explanatory.
25 __zone__ = Zone('example.com.', serialfile = 'db.example.com.srl',
26 mail = 'root@example.com.', NS = ['ns', 'ns.example.org.'], TTLs = TTLs,
27 secondary_refresh = 6*hour, secondary_retry = 1*hour, secondary_expire = 7*day,
28 # Here come the actual domains. Each takes records as argument, either individually or as lists.
30 '@': Name(one, mail, HTTPS('0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef')), # this will all all records from the list "one" and the list "mail" to this name
32 'ipv4.ns': Name(one4), # just a single record
33 'ipv6.ns': Name(one6),
34 'mx' : Name(two), # mail is handled by machine two
35 'www': Name(one, HTTPS('0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef')), # since this is python, we can define shorthands
36 'lists': Name(one, mail, HTTPS('0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef')), # this domain can both receive mail, and publishes its HTTPS key
38 'jabber': Name(SRV(Protocol.TCP, 'xmpp-client', 'jabber.example.org.', port = 5222, prio = 0, weight = 5), # forward jabber clients to jabber.example.org
39 SRV(Protocol.TCP, 'xmpp-server', 'jabber.example.org.', port = 5269, prio = 0, weight = 5)), # and similar for server-to-server connections
41 'orgstuff': CName('example.org.'), # CNAMEs cannot be combined with other records
43 'sub1': Delegation('ns.example.org.'), # this adds an NS record
44 'sub2': SecureDelegation('ns.example.com.', 12345, Algorithm.RSA_SHA256, Digest.SHA256, '0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF'), # this adds an NS and a DS record
48 'stuff': CName('one'),