Closed anandb-ripencc closed 3 years ago
It seems like NSD is emitting these three NSEC3 records, the closest encloser hash(ug)=8r4... and the qname denial the hash(ira.go.ug) is sks8feam03k55b2mg7jg22jiacq57pbs and the qk9... record denies it. The dpk... record denies the next-closer, it is hash(go.ug) is f8shj4rsfkis1fn5930m5otqn8dpv8i3. To create the proof, the closest encloser and next encloser records must be present to provide the closestencloser part of the proof. This is necessary because it must be signed with optout. It would also be needed for like unsigned-referrals. The go.ug is an empty nonterminal. These have been the cause of interop issues, with signers producing different nsec3 records, and other issues. So the response from NSD now, includes also the qname denial nsec3, that the others do not include. It would not be needed for a delegation, but since it is a nodata answer this is not a delegation. Perhaps we should fix it, but I also do not want other interop issues. Although if the other servers serve it maybe so can we.
After looking at it I think that NSD adds the third NSEC3 record because it is required. That is the record that has the optout bit that is pertinent for this span of domain names. So, this record proves if the destination is covered by an optout NSEC3 span or not. Now, NSD adds it without checking if optout is in use. In the given zone optout is enabled for the output you have.
So there is unique information in that NSEC3 that is not actually present in the other ones. The other NSEC3 records also have an optout flag, but this may apply to a different span of domain names.
I think this is the reason that the third NSEC3 record is present. It is a surprisingly good reason.
The other code works in practice, I presume, that you cite, thus it may be that the information is not used in any way.
Fixed this in the commit, it only includes the qname denial if there is no intermediate (empty nonterminal) with an NSEC3 record covering it. That makes it do 2 NSEC3s for such a NODATA answer. The issue is specifically for query type DS and empty nonterminals with optout NSEC3.
While debugging queries for ira.go.ug/DS, I have noticed that NSD returns 3 NSEC3 records in the authority section. I don't believe the extra NSEC3 record causes any harm. However, operationally, it has a consequence, which is a bigger response, compared to say BIND or Knot DNS. If an NSD server limits the UDP buffer size to 1232 (as is the recommendation these days), it causes truncation, and the client tries again over TCP. Compare the following responses: