From a07f8b89239fb177a995ebda24fcdc71616c35af Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sun, 4 Aug 2019 12:34:11 +0200 Subject: [PATCH] add support for CAA records --- db.example.com.py | 3 ++- zone.py | 13 +++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/db.example.com.py b/db.example.com.py index 349d958..310a6bf 100644 --- a/db.example.com.py +++ b/db.example.com.py @@ -27,7 +27,8 @@ __zone__ = Zone('example.com.', serialfile = 'db.example.com.srl', secondary_refresh = 6*hour, secondary_retry = 1*hour, secondary_expire = 7*day, # Here come the actual domains. Each takes records as argument, either individually or as lists. domains = { - '@': Name(one, mail, HTTPS('0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef')), # this will all all records from the list "one" and the list "mail" to this name + '@': Name(one, mail, HTTPS('0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef')), # this will add all records from the list "one" and the list "mail" to this name + '@': Name(CAA(0, CAA.Tag.Issue, "letsencrypt.org")), 'ns': Name(one), 'ipv4.ns': Name(one4), # just a single record 'ipv6.ns': Name(one6), diff --git a/zone.py b/zone.py index a74ee18..d325915 100644 --- a/zone.py +++ b/zone.py @@ -259,6 +259,19 @@ class TLSA: def generate_rr(self): return RR('_{}._{}'.format(self._port, self._protocol), 'TLSA', '{} {} {} {}'.format(self._usage, self._selector, self._matching_type, self._data)) +class CAA: + class Tag: + Issue = "issue" + IssueWild = "issuewild" + + def __init__(self, flag: int, tag: str, value: str) -> None: + self._flag = int(flag) + self._tag = str(tag) + self._value = str(value) + + def generate_rr(self): + return RR('@', 'CAA', '{} {} {}'.format(self._flag, self._tag, self._value)) + class CNAME: def __init__(self, name: str) -> None: -- 2.30.2