From 4140a8afb040c761860b8dc4c72590d14de519bf Mon Sep 17 00:00:00 2001 From: Jan Koppe Date: Wed, 21 Apr 2021 09:45:23 +0200 Subject: [PATCH] dyndns: add support for digitialocean v6 records (#1832) --- dns/dyndns/src/etc/inc/plugins.inc.d/dyndns.inc | 1 + .../src/etc/inc/plugins.inc.d/dyndns/phpDynDNS.inc | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/dns/dyndns/src/etc/inc/plugins.inc.d/dyndns.inc b/dns/dyndns/src/etc/inc/plugins.inc.d/dyndns.inc index 9b2e1b020..09ad91469 100644 --- a/dns/dyndns/src/etc/inc/plugins.inc.d/dyndns.inc +++ b/dns/dyndns/src/etc/inc/plugins.inc.d/dyndns.inc @@ -113,6 +113,7 @@ function dyndns_list() 'desec-v6' => 'deSEC (v6)', 'dhs' => 'DHS', 'digitalocean' => 'DigitalOcean', + 'digitalocean-v6' => 'DigitalOcean (v6)', 'dnsexit' => 'DNSexit', 'dnsomatic' => 'DNS-O-Matic', 'duckdns' => 'Duck DNS', diff --git a/dns/dyndns/src/etc/inc/plugins.inc.d/dyndns/phpDynDNS.inc b/dns/dyndns/src/etc/inc/plugins.inc.d/dyndns/phpDynDNS.inc index e6428978a..5a3348780 100644 --- a/dns/dyndns/src/etc/inc/plugins.inc.d/dyndns/phpDynDNS.inc +++ b/dns/dyndns/src/etc/inc/plugins.inc.d/dyndns/phpDynDNS.inc @@ -27,6 +27,7 @@ * DNS-O-Matic - Last Tested: 9 September 2010 * DNSexit - Last Tested: 20 July 2008 * DigitalOcean - Last Tested: 25 June 2019 + * DigitalOcean v6 - Last Tested: 13 May 2020 * Duck DNS - Last Tested: 04 March 2015 * DynDNS Dynamic - Last Tested: 12 July 2005 * EasyDNS - Last Tested: 20 July 2008 @@ -248,6 +249,7 @@ class updatedns case 'azurev6': case 'cloudflare-v6': case 'custom-v6': + case 'digitalocean-v6': case 'dynv6-v6': case 'he-net-v6': case 'godaddy-v6': @@ -626,6 +628,7 @@ class updatedns curl_setopt($ch, CURLOPT_URL, $server . 'hostname=' . $this->_dnsHost); break; case 'digitalocean': + case 'digitalocean-v6': /* * dnsHost should be the root domain * dnsUser should be the record ID @@ -634,6 +637,13 @@ class updatedns $server = "https://api.digitalocean.com/v2/domains/" . $this->_dnsHost . "/records/" . $this->_dnsUser; $hostData = array("data" => "{$this->_dnsIP}"); + /* + * DigitalOcean does not offer the API via IPv6, so we need + * to force sending the request using IPv4 when updating for IPv6 + */ + curl_setopt($ch, CURLOPT_INTERFACE, $this->_dnsRequestIf); + curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); @@ -1577,6 +1587,7 @@ class updatedns } break; case 'digitalocean': + case 'digitalocean-v6': $output = json_decode($data); if ($output->domain_record->data === $this->_dnsIP) { $status = "Dynamic DNS: (Success) Record ID {$this->_dnsUser} updated to {$this->_dnsIP}";