plesk / ext-route53

This extension provides the functionality needed for integration with Amazon Route 53. It is a highly available and scalable Domain Name System (DNS) web service.

Home Page:https://www.plesk.com/extensions/amazon-route53/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Multiple zone records created when hosting 101+ domains on Route53

chickenlip opened this issue · comments

I've run into a problem with my Plesk install with Amazon Route 53. I have the latest extension installed (version 1.2 release 2) on Parallels Plesk v12.0.18_build1200140811.16 os_CentOS 7.

The extension has been working perfectly well for me for months.
I was adding new domains to Plesk and discovered that as I was making changes to DNS records that a new zone file was created on Route 53 instead of updating the original one.

I did notice that this started happening when I surpassed the 100 domain limit and seems to only happen on domains created at #101 and on. (in other words, I can edit a domain that was created before I got to domain #100 [ie domain #1] and it does not create a duplicate zone file).

I turned on debug mode for plesk and am seeing the json calls with the correct commands coming through.

Redacted sample of an update of Domain #104

[2015-06-10 16:42:43] INFO [panel] The domain alias mydomain.test was created.

[2015-06-10 16:42:43] DEBUG [util_exec] [5578bd6355bc3] Starting: dnsmng /usr/local/psa/admin/bin/dnsmng '--update' 'mydomain.test'

[2015-06-10 16:42:43] DEBUG [util_exec] [5578bd6355bc3] Finished in 0.06322s, Result: TRUE

[2015-06-10 16:42:43] DEBUG [panel] DNS Custom backend call: [{"command":"update","zone":{"name":"mydomain.test.","displayName":"mydomain.test.","soa":{"email":user@email.com,"status":0,"type":"master","ttl":86400,"refresh":10800,"retry":3600,"expire":604800,"minimum":10800,"serial":1433976161,"serial_format":"UNIXTIMESTAMP"},"rr":[{"host":"www.mydomain.test.","displayHost":"www.mydomain.test.","type":"CNAME","displayValue":"mydomain.test.","opt":"","value":"mydomain.test."},{"host":"1.2.3.4","displayHost":"1.2.3.4","type":"PTR","displayValue":"mydomain.test.","opt":"24","value":"mydomain.test."},{"host":"mydomain.test.","displayHost":"mydomain.test.","type":"TXT","displayValue":"v=spf1 mx a ~all","opt":"","value":"v=spf1 mx a ~all"},{"host":"ftp.mydomain.test.","displayHost":"ftp.mydomain.test.","type":"CNAME","displayValue":"mydomain.test.","opt":"","value":"mydomain.test."},{"host":"ipv4.mydomain.test.","displayHost":"ipv4.mydomain.test.","type":"A","displayValue":"1.2.3.4","opt":"","value":"1.2.3.4"},{"host":"mail.mydomain.test.","displayHost":"mail.mydomain.test.","type":"A","displayValue":"1.2.3.4","opt":"","value":"1.2.3.4"},{"host":"mydomain.test.","displayHost":"mydomain.test.","type":"MX","displayValue":"1.2.3.4.","opt":"10","value":"1.2.3.4."},{"host":"mydomain.test.","displayHost":"mydomain.test.","type":"A","displayValue":"1.2.3.4","opt":"","value":"1.2.3.4"},{"host":"ns.mydomain.test.","displayHost":"ns.mydomain.test.","type":"A","displayValue":"1.2.3.4","opt":"","value":"1.2.3.4"},{"host":"mydomain.test.","displayHost":"mydomain.test.","type":"NS","displayValue":"ns.mydomain.test.","opt":"","value":"ns.mydomain.test."},{"host":"webmail.mydomain.test.","displayHost":"webmail.mydomain.test.","type":"CNAME","displayValue":"webmail.emailhost.com.","opt":"","value":"webmail.emailhost.com."},{"host":"mydomain.test.","displayHost":"mydomain.test.","type":"MX","displayValue":"mail.emailhost.com.","opt":"50","value":"mail.emailhost.com."}]}},{"command":"createPTRs","ptr":{"ip_address":"1.2.3.4","hostname":"mydomain.test"}}]

[2015-06-10 16:42:45] INFO [panel] Executing /usr/local/psa/admin/plib/modules/route53/scripts/route53.php done.

[2015-06-10 16:42:45] INFO [panel] Zone created: mydomain.test.

ResourceRecordSet updated: mydomain.test.

[2015-06-10 16:42:45] INFO [panel] Executing /usr/local/psa/admin/plib/modules/route53/scripts/route53.php done.

Redacted sample of an update of Domain #1

[2015-06-10 17:14:12] DEBUG [util_exec] [5578c4c4d8d91] Starting: dnsmng /usr/local/psa/admin/bin/dnsmng '--update' 'domain1.com'
[2015-06-10 17:14:13] DEBUG [util_exec] [5578c4c4d8d91] Finished in 0.11999s, Result: TRUE
[2015-06-10 17:14:13] DEBUG [panel] DNS Custom backend call: [{"command":"update","zone":{"name":"domain1.com.","displayName":"domain1.com.","soa":{"email":"sales@emailhost.com","status":"0","type":"master","ttl":"86400","refresh":"10800","retry":"3600","expire":"604800","minimum":"10800","serial":1433978052,"serial_format":"UNIXTIMESTAMP"},"rr":[{"host":"www.domain1.com.","displayHost":"www.domain1.com.","type":"CNAME","displayValue":"domain1.com.","opt":"","value":"domain1.com."},{"host":"domain1.com.","displayHost":"domain1.com.","type":"TXT","displayValue":"v=spf1 mx a ip4:1.2.3.64/26 ip4:3.2.1.128/27 ~all","opt":"","value":"v=spf1 mx a ip4:1.2.3.64/26 ip4:3.2.1.128/27 ~all"},{"host":"domain1.com.","displayHost":"domain1.com.","type":"MX","displayValue":"spambox.emailhost.com.","opt":"10","value":"spambox.emailhost.com."},{"host":"ftp.domain1.com.","displayHost":"ftp.domain1.com.","type":"CNAME","displayValue":"domain1.com.","opt":"","value":"domain1.com."},{"host":"domain1.com.","displayHost":"domain1.com.","type":"NS","displayValue":"ns.domain1.com.","opt":"","value":"ns.domain1.com."},{"host":"ns.domain1.com.","displayHost":"ns.domain1.com.","type":"A","displayValue":"1.2.3.100","opt":"","value":"1.2.3.100"},{"host":"mail.domain1.com.","displayHost":"mail.domain1.com.","type":"A","displayValue":"1.2.3.100","opt":"","value":"1.2.3.100"},{"host":"webmail.domain1.com.","displayHost":"webmail.domain1.com.","type":"A","displayValue":"1.2.3.100","opt":"","value":"1.2.3.100"},{"host":"ipv4.domain1.com.","displayHost":"ipv4.domain1.com.","type":"A","displayValue":"1.2.3.100","opt":"","value":"1.2.3.100"},{"host":"domain1.com.","displayHost":"domain1.com.","type":"A","displayValue":"1.2.3.100","opt":"","value":"1.2.3.100"},{"host":"1.2.3.100","displayHost":"1.2.3.100","type":"PTR","displayValue":"domain1.com.","opt":"24","value":"domain1.com."},{"host":"test.domain1.com.","displayHost":"test.domain1.com.","type":"TXT","displayValue":"test","opt":"","value":"test"}]}},{"command":"createPTRs","ptr":{"ip_address":"1.2.3.100","hostname":"domain1.com"}}]
[2015-06-10 17:14:14] INFO [panel] Executing /usr/local/psa/admin/plib/modules/route53/scripts/route53.php done.
[2015-06-10 17:14:14] INFO [panel] ResourceRecordSet updated: domain1.com.
[2015-06-10 17:14:14] INFO [panel] Executing /usr/local/psa/admin/plib/modules/route53/scripts/route53.php done.​

So from what I can see the domain +100 is re-creating the domain (see log @ 2015-06-10 16:42:45) whereas domain 1 is not - it's just updating it (see log @ 2015-06-10 17:14:14), even though both json commands show the update statement coming through.

According to http://docs.aws.amazon.com/Route53/latest/APIReference/API_ListHostedZones.html

Amazon Route 53 returns a maximum of 100 items in each response. If you have a lot of hosted zones, you can use the maxitems parameter to list them in groups of up to 100. The response includes four values that help you navigate from one group of maxitems hosted zones to the next​

So what I think needs to happen is that when you're referencing public function getZoneId($zoneName), you need to adjust the _client->listHostedZones() method to keep pulling data back until AWS returns all DNS records.

I tried modifying that code to get the proper ID, but regardless of what I passed in as the starting record #, it always came back with records 1-100. This would explain why it's creating duplicates for zones 101+ because it can't find them in the list that the extension is pulling back from R53.

Let me know if I can offer any more information on this one.

I have tested this commit and can confirm that the extension is now properly updating domains after the 100th domain.