StackExchange / dnscontrol

Infrastructure as code for DNS!
https://dnscontrol.org/
MIT License
3.07k stars 389 forks source link

NAMECHEAP: API does not perform MX priority changes #2277

Open willpower232 opened 1 year ago

willpower232 commented 1 year ago

This is a follow on issue from #2238 documenting that tests for changing MX priority and changing the byte flag in a CAA record report failures with the Namecheap provider.

I strongly believe this to be a failing of their API however there are lots of random gotchas in how they expect you to use their API so it is technically possible that there is some confusion in either dnscontrol or billputer/go-namecheap however given I am able to reproduce the issues with bare GET requests, I am currently leaning towards it being a them issue.

I am struggling to get their customer support to realise this so need to establish some form of repeatable testing setup to demonstrate the issue.

willpower232 commented 1 year ago
current script output demonstrating namecheap api not taking any action ``` Step 1 - Current State { Command: 'namecheap.domains.dns.getHosts' } namecheap.domains.dns.gethosts PHX01SBAPIEXT06 --4:00 0.188 Step 2 - Create Records With MXPref 20 { Command: 'namecheap.domains.dns.setHosts', EmailType: 'MX', HostName1: '@', RecordType1: 'MX', Address1: 'bar.com.', MXPref1: 20, TTL1: 100, HostName2: 'attempt', RecordType2: 'MX', Address2: 'foo.com.', MXPref2: 20, TTL2: 100 } namecheap.domains.dns.sethosts PHX01SBAPIEXT05 --4:00 0.208 Step 3 - Confirm Created { Command: 'namecheap.domains.dns.getHosts' } namecheap.domains.dns.gethosts PHX01SBAPIEXT05 --4:00 0.108 Step 4 - Change MXPref To 15 { Command: 'namecheap.domains.dns.setHosts', EmailType: 'MX', HostName1: '@', RecordType1: 'MX', Address1: 'bar.com.', MXPref1: 15, TTL1: 100, HostName2: 'attempt', RecordType2: 'MX', Address2: 'foo.com.', MXPref2: 15, TTL2: 100 } namecheap.domains.dns.sethosts PHX01SBAPIEXT06 --4:00 0.12 Step 5 - Check If Changed { Command: 'namecheap.domains.dns.getHosts' } namecheap.domains.dns.gethosts PHX01SBAPIEXT05 --4:00 0.101 Step 6 - Delete Records { Command: 'namecheap.domains.dns.setHosts' } namecheap.domains.dns.sethosts PHX01SBAPIEXT06 --4:00 0.172 Step 6 - Confirm Deleted { Command: 'namecheap.domains.dns.getHosts' } namecheap.domains.dns.gethosts PHX01SBAPIEXT06 --4:00 0.118 ```
willpower232 commented 1 year ago

Greetings,

Thank you for your endless patience!

Much to our regret, we are yet to receive an update concerning this matter.

Please accept our sincere apologies that it takes quite some time. We are constantly checking the matter and will let you know once we have anything to specify.

Your patience is deeply appreciated.

tlimoncelli commented 1 year ago

Just a thought... A work-around would be for DNSControl to notice this particular situation and submit a delete followed by an insert.

willpower232 commented 1 year ago

You mean to effectively run the preview command after the push command to ensure no changes remain? I guess that makes sense but it would be nicer if companies had an API that fully worked :sweat_smile:

They send me updates every week or so with the same message so still no progress at their end :grimacing:

tlimoncelli commented 1 year ago

You mean to effectively run the preview command after the push command to ensure no changes remain? I guess that makes sense but it would be nicer if companies had an API that fully worked 😅

More like... do two "push" commands. One without the MX or SRVs that you want to change, then another "push" with the full zone.

This reminds me of the MSDNS provider. Adding and deleting records was easy. Changing an existing record was so difficult that I just got lazy and implemented "change" like this: https://github.com/StackExchange/dnscontrol/blob/0d044fd121671b9b781d3dd0b5d0781e1d636549/providers/msdns/powershell.go#L367C4-L369

Of course, such a coding exercise isn't worth the effort. In real life MX and SRV records rarely get changed. It's probably much better to just add a note in documentation/providers/namecheap.md that explains the issue and recommends workarounds (use the portal).

They send me updates every week or so with the same message so still no progress at their end 😬

Not fixing bugs is one way to save money. Maybe that's the "cheap" part of "namecheap" :-)