Skip to content

Commit a2d437e

Browse files
fixup! wip feat(api): add management command for RFC 9859
1 parent ec10204 commit a2d437e

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

api/desecapi/management/commands/notify-parent.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,19 @@ def handle(self, *args, **options):
5050
print("unsupported")
5151
else:
5252
notifies = 0
53+
targets = 0
5354
for dsync in answer:
5455
result = self._notify_domain(domain_name, dsync)
55-
if result is not None:
56-
notifies += result
56+
try:
57+
result, response = result
58+
except TypeError: # None
59+
continue
60+
targets += 1
61+
notifies += result
62+
if not result and self.debug:
63+
print(response)
5764
print(
58-
f"notified, {notifies} targets confirmed (from {answer.qname}/DSYNC)"
65+
f"notified, {notifies}/{targets} NOTIFY(SOA) targets confirmed (from {len(answer)} {answer.qname}/DSYNC total)"
5966
)
6067

6168
def _resolve_securely(self, qname, rdtype):
@@ -85,7 +92,7 @@ def _notify_domain(self, domain_name, dsync):
8592
notify = dns.message.make_query(domain_name, dns.rdatatype.CDS)
8693
notify.set_opcode(dns.opcode.NOTIFY)
8794
notify.flags += dns.flags.AA - dns.flags.RD
88-
opt = dns.edns.ReportChannelOption(dns.name.from_text("ns1.desec.io."))
95+
opt = dns.edns.ReportChannelOption(dns.name.from_text("notify-agent.ns.desec.cz."))
8996
notify.use_edns(edns=True, options=[opt])
9097

9198
response = dns.query.udp(
@@ -94,7 +101,7 @@ def _notify_domain(self, domain_name, dsync):
94101

95102
notify.flags += dns.flags.QR
96103
# TODO why does this work despite of the EDNS0 option not being in the response?
97-
return notify == response
104+
return notify == response, response
98105

99106
def _get_dsync(self, domain_name):
100107
# This implements the discovery algorithm from RFC 9859 Section 4.1

0 commit comments

Comments
 (0)