alexreinert/ARSoft.Tools.Net

RFC2136 delete operations not working

Closed this issue · 6 comments

Hi, I'm trying to use your library to implement Let's Encrypt validation, which requires me to add and delete TXT records. Adding works fine, but I don't seem to be able to delete the records afterwards.

If I send a DeleteAllRecordsUpdate the server returns a FormatError. If I send a DeleteRecordUpdate it only changes the TTL to 0. Server logs confirm that the DeleteRecordUpdate looks exactly the same as an AddRecordUpdate. I tried to make sense of the code, but there doesn't seem to be any difference between those two classes, except for the TTL thing.

What seems to be missing is some property or logic to change the command from add to delete for both of those update types.

win-acme/win-acme#2364

After digging through the RFC a bit, I think this is possibly due to the fact that RecordClass needs to be set to Any for the delete directives, but unfortunately that can't be done elegantly from my code because it's protected, internal and/or readonly everywhere. I tried inheriting from DeleteRecordUpdate to do

protected override RecordClass RecordClassInternal => RecordClass.Any;

But that lead to a FormatError again, maybe because there's a mismatch between the update message and the inner record.

I will have a look and provide a new version, soon.

I just opened a PR for you to review, I've confirmed it to work for my case by means of reflection, but you might have additional tests that you'd want to perform.

Sorry, for some legal reasons I cannot accept any PR for this project.

Fixed in 3.2.0

Thanks!