From 09616f6c6675efc88911e7825541d3a473885237 Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Mon, 17 Jul 2023 10:16:18 +0200 Subject: [PATCH] dns/dyndns: remove obsolete plugin --- dns/dyndns/Makefile | 7 - dns/dyndns/pkg-descr | 32 - .../src/etc/inc/plugins.inc.d/dyndns.inc | 281 --- .../inc/plugins.inc.d/dyndns/phpDynDNS.inc | 2042 ----------------- .../src/etc/inc/plugins.inc.d/dyndns/r53.inc | 777 ------- dns/dyndns/src/etc/rc.dyndns | 50 - .../src/etc/rc.syshook.d/monitor/50-dyndns | 38 - .../models/OPNsense/DynamicDNS/ACL/ACL.xml | 9 - .../models/OPNsense/DynamicDNS/Menu/Menu.xml | 7 - .../conf/actions.d/actions_dyndns.conf | 6 - dns/dyndns/src/www/services_dyndns.php | 203 -- dns/dyndns/src/www/services_dyndns_edit.php | 500 ---- .../www/widgets/include/dyn_dns_status.inc | 4 - .../widgets/widgets/dyn_dns_status.widget.php | 172 -- 14 files changed, 4128 deletions(-) delete mode 100644 dns/dyndns/Makefile delete mode 100644 dns/dyndns/pkg-descr delete mode 100644 dns/dyndns/src/etc/inc/plugins.inc.d/dyndns.inc delete mode 100644 dns/dyndns/src/etc/inc/plugins.inc.d/dyndns/phpDynDNS.inc delete mode 100644 dns/dyndns/src/etc/inc/plugins.inc.d/dyndns/r53.inc delete mode 100755 dns/dyndns/src/etc/rc.dyndns delete mode 100755 dns/dyndns/src/etc/rc.syshook.d/monitor/50-dyndns delete mode 100644 dns/dyndns/src/opnsense/mvc/app/models/OPNsense/DynamicDNS/ACL/ACL.xml delete mode 100644 dns/dyndns/src/opnsense/mvc/app/models/OPNsense/DynamicDNS/Menu/Menu.xml delete mode 100644 dns/dyndns/src/opnsense/service/conf/actions.d/actions_dyndns.conf delete mode 100644 dns/dyndns/src/www/services_dyndns.php delete mode 100644 dns/dyndns/src/www/services_dyndns_edit.php delete mode 100644 dns/dyndns/src/www/widgets/include/dyn_dns_status.inc delete mode 100644 dns/dyndns/src/www/widgets/widgets/dyn_dns_status.widget.php diff --git a/dns/dyndns/Makefile b/dns/dyndns/Makefile deleted file mode 100644 index ee2bb7a73..000000000 --- a/dns/dyndns/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -PLUGIN_NAME= dyndns -PLUGIN_VERSION= 1.27 -PLUGIN_REVISION= 3 -PLUGIN_COMMENT= Dynamic DNS Support -PLUGIN_MAINTAINER= franco@opnsense.org - -.include "../../Mk/plugins.mk" diff --git a/dns/dyndns/pkg-descr b/dns/dyndns/pkg-descr deleted file mode 100644 index ff5dc2c1d..000000000 --- a/dns/dyndns/pkg-descr +++ /dev/null @@ -1,32 +0,0 @@ -Support for numerous Dynamic DNS services (DynDNS et al) - -Plugin Changelog -================ - -1.27 - -* Add missing digitalocean-v6 switch case (contributed by zarcjap) -* Fix GoDaddy IPv6 update (contributed by Team Rebellion) - -1.26 - -* Add support for 1984 Hosting Company (contributed by Adrian Fedoreanu) -* Add %HOST% support for custom dynamic DNS (contributed by Marc Collins) -* Add PAYLOAD log and debug support for missing code spots - -1.25 - -* Make regfish DynDNS work for IPv4 and IPv6 (contributed by DeepCoreSystem) -* Add STRATO IPv6 to DynDNS (contributed by Jan Wiesemann) -* Add desec.io wildcard support (contributed by Luca Zeug) -* Accept wildcard entry for Hetzner - -1.24 - -* Fix FreeDNS update in DynDNS plugin (contributed by rmrfus) -* Add hetzner dns console to supported dyndns services (contributed by schreibubi) -* Add support for deSEC.io (contributed by Michael Paul) -* Add All-Inkl v4 and v6 DynDNS support (contributed by polkhigh33) -* Add support for digitalocean v6 records (contributed by Jan Koppe) -* Update No-Ip client code to use APIv2 (contributed by Victor Kislov) -* Fix copy and paste unprotected JSON object access diff --git a/dns/dyndns/src/etc/inc/plugins.inc.d/dyndns.inc b/dns/dyndns/src/etc/inc/plugins.inc.d/dyndns.inc deleted file mode 100644 index 455d68d7d..000000000 --- a/dns/dyndns/src/etc/inc/plugins.inc.d/dyndns.inc +++ /dev/null @@ -1,281 +0,0 @@ - - * Copyright (C) 2010 Ermal Luçi - * Copyright (C) 2005-2006 Colin Smith - * Copyright (C) 2003-2004 Manuel Kasper - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -require_once('plugins.inc.d/dyndns/phpDynDNS.inc'); -require_once('plugins.inc.d/dyndns/r53.inc'); - -function dyndns_configure() -{ - return [ - 'bootup' => ['dyndns_configure_do'], - 'local' => ['dyndns_configure_do'], - 'newwanip' => ['dyndns_configure_do:2'], - ]; -} - -function dyndns_enabled() -{ - global $config; - - if (isset($config['dyndnses']['dyndns'])) { - foreach ($config['dyndnses']['dyndns'] as $conf) { - if (isset($conf['enable'])) { - return true; - } - } - } - - return false; -} - -function dyndns_services() -{ - $services = []; - - if (dyndns_enabled()) { - $services[] = [ - 'description' => gettext('Dynamic DNS'), - 'configd' => [ 'restart' => ['dyndns reload'] ], - 'nocheck' => true, - 'name' => 'dyndns', - ]; - } - - return $services; -} - -function dyndns_cron() -{ - $jobs = []; - - if (dyndns_enabled()) { - $jobs[]['autocron'] = ['/usr/local/etc/rc.dyndns', '11', '1']; - } - - return $jobs; -} - -function dyndns_list() -{ - /* - * XXX something like this would be cool: - * - * https://github.com/openwrt/packages/blob/master/net/ddns-scripts/files/services - */ - - return [ - '1984-hosting' => '1984 Hosting Company', - '3322' => '3322', - 'all-inkl' => 'All-Inkl', - 'all-inkl-v6' => 'All-Inkl (v6)', - 'azure' => 'Azure DNS', - 'azurev6' => 'Azure DNS (v6)', - 'citynetwork' => 'City Network', - 'cloudflare' => 'Cloudflare', - 'cloudflare-token' => 'Cloudflare API token', - 'cloudflare-token-v6' => 'Cloudflare API token (v6)', - 'cloudflare-v6' => 'Cloudflare (v6)', - 'custom' => 'Custom', - 'custom-v6' => 'Custom (v6)', - 'desec' => 'deSEC', - 'desec-v4-v6' => 'deSEC (v4+v6)', - 'desec-v6' => 'deSEC (v6)', - 'dhs' => 'DHS', - 'digitalocean' => 'DigitalOcean', - 'digitalocean-v6' => 'DigitalOcean (v6)', - 'dnsexit' => 'DNSexit', - 'dnsomatic' => 'DNS-O-Matic', - 'duckdns' => 'Duck DNS', - 'dyndns' => 'DynDNS (dynamic)', - 'dyndns-custom' => 'DynDNS (custom)', - 'dyndns-static' => 'DynDNS (static)', - 'dyns' => 'DyNS', - 'dynv6' => 'dynv6', - 'dynv6-v6' => 'dynv6 (v6)', - 'easydns' => 'easyDNS', - 'eurodns' => 'EuroDNS', - 'freedns' => 'freeDNS', - 'gandi-livedns' => 'Gandi LiveDNS', - 'godaddy' => 'GoDaddy', - 'godaddy-v6' => 'GoDaddy (v6)', - 'googledomains' => 'Google Domains', - 'gratisdns' => 'GratisDNS', - 'he-net' => 'HE.net', - 'he-net-tunnelbroker' => 'HE.net Tunnelbroker', - 'he-net-v6' => 'HE.net (v6)', - 'hetzner' => 'Hetzner DNS Console', - 'hetzner-v6' => 'Hetzner DNS Console (v6)', - 'linode' => 'Linode', - 'linode-v6' => 'Linode (v6)', - 'loopia' => 'Loopia', - 'namecheap' => 'Namecheap', - 'noip' => 'No-IP', - 'noip-free' => 'No-IP (free)', - 'ods' => 'ODS.org', - 'oray' => 'Oray', - 'ovh-dynhost' => 'OVH DynHOST', - 'regfish' => 'regfish', - 'regfish-v6' => 'regfish (v6)', - 'route53' => 'Route 53', - 'route53-v6' => 'Route 53 (v6)', - 'selfhost' => 'SelfHost', - 'strato' => 'STRATO', - 'strato-v6' => 'STRATO (v6)', - 'zoneedit' => 'ZoneEdit', - ]; -} - -function dyndns_cache_file($conf, $ipver = 4) -{ - $ipver = $ipver == 6 ? '_v6' : ''; - - return "/var/cache/dyndns_{$conf['interface']}_{$conf['host']}_{$conf['id']}{$ipver}.cache"; -} - -function dyndns_configure_client($conf) -{ - if (!isset($conf['enable'])) { - return; - } - - $dns = new updatedns( - $dnsService = $conf['type'], - $dnsHost = $conf['host'], - $dnsUser = $conf['username'], - $dnsPass = $conf['password'], - $dnsWilcard = $conf['wildcard'], - $dnsMX = $conf['mx'], - $dnsIf = "{$conf['interface']}", - $dnsBackMX = null, - $dnsServer = null, - $dnsPort = null, - $dnsUpdateURL = "{$conf['updateurl']}", - $forceUpdate = $conf['force'], - $dnsZoneID = $conf['zoneid'], - $dnsResourceID = $conf['resourceid'], - $dnsTTL = $conf['ttl'], - $dnsResultMatch = "{$conf['resultmatch']}", - $dnsRequestIf = "{$conf['requestif']}", - $dnsID = "{$conf['id']}", - $dnsVerboseLog = $conf['verboselog'], - $curlIpresolveV4 = $conf['curl_ipresolve_v4'], - $curlSslVerifypeer = $conf['curl_ssl_verifypeer'] - ); -} - -function dyndns_configure_do($verbose = false, $int = '') -{ - global $config; - - if (!dyndns_enabled()) { - return; - } - - $dyndnscfg = $config['dyndnses']['dyndns']; - $gwgroups = return_gateway_groups_array(); - - service_log('Configuring dynamic DNS clients...', $verbose); - - foreach ($dyndnscfg as $dyndns) { - if ((empty($int)) || ($int == $dyndns['interface']) || (is_array($gwgroups[$dyndns['interface']]))) { - $dyndns['verboselog'] = isset($dyndns['verboselog']); - $dyndns['curl_ipresolve_v4'] = isset($dyndns['curl_ipresolve_v4']); - $dyndns['curl_ssl_verifypeer'] = isset($dyndns['curl_ssl_verifypeer']); - dyndns_configure_client($dyndns); - sleep(1); - } - } - - service_log("done.\n", $verbose); -} - -function dyndns_failover_interface($interface, $family = 'all') -{ - global $config; - - /* shortcut for known interfaces */ - if (isset($config['interfaces'][$interface])) { - return get_real_interface($interface, $family); - } - - /* compare against gateway groups */ - $a_groups = return_gateway_groups_array(); - if (isset($a_groups[$interface])) { - /* we found a gateway group, fetch the interface or vip */ - if ($a_groups[$interface][0]['vip'] != '') { - return $a_groups[$interface][0]['vip']; - } else { - return $a_groups[$interface][0]['int']; - } - } - - /* fall through to get real interface the hard way */ - return get_real_interface($interface, $family); -} - - -function get_dyndns_ip_address($int, $ipver = 4) -{ - $ip_address = $ipver == 6 ? get_interface_ipv6($int) : get_interface_ip($int); - if (empty($ip_address)) { - log_error("Aborted IPv{$ipver} detection: no address for {$int}"); - return 'down'; - } - - if ($ipver != 6 && is_private_ip($ip_address)) { - /* Chinese alternative is http://ip.3322.net/ */ - $hosttocheck = 'http://checkip.dyndns.org'; - $ip_ch = curl_init($hosttocheck); - curl_setopt($ip_ch, CURLOPT_RETURNTRANSFER, 1); - curl_setopt($ip_ch, CURLOPT_INTERFACE, $ip_address); - curl_setopt($ip_ch, CURLOPT_CONNECTTIMEOUT, 5); - curl_setopt($ip_ch, CURLOPT_TIMEOUT, 30); - curl_setopt($ip_ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); - $ip_result = curl_exec($ip_ch); - if ($ip_result !== false) { - preg_match('=Current IP Address: (.*)=siU', $ip_result, $matches); - $ip_address = trim($matches[1]); - } else { - log_error('Aborted IPv4 detection: ' . curl_error($ip_ch)); - $ip_address = ''; - } - curl_close($ip_ch); - } elseif ($ipver == 6 && is_linklocal($ip_address)) { - log_error('Aborted IPv6 detection: cannot bind to link-local address'); - $ip_address = ''; - } - - if (($ipver == 6 && !is_ipaddrv6($ip_address)) || ($ipver != 6 && !is_ipaddrv4($ip_address))) { - return 'down'; - } - - return $ip_address; -} 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 deleted file mode 100644 index 0bf690816..000000000 --- a/dns/dyndns/src/etc/inc/plugins.inc.d/dyndns/phpDynDNS.inc +++ /dev/null @@ -1,2042 +0,0 @@ - $dnsHost, 'id' => $dnsID, 'interface' => $dnsIf); - $this->_cacheFile = dyndns_cache_file($conf, 4); - $this->_cacheFile_v6 = dyndns_cache_file($conf, 6); - $this->_debugFile = dyndns_cache_file($conf, 4) . '.debug'; - $this->_dnsServiceList = dyndns_list(); - - $this->_curlIpresolveV4 = $curlIpresolveV4; - $this->_curlSslVerifypeer = $curlSslVerifypeer; - $this->_dnsVerboseLog = $dnsVerboseLog; - if ($this->_dnsVerboseLog) { - log_error("Dynamic DNS: updatedns() starting"); - } - - $dyndnslck = lock("DDNS" . $dnsID, LOCK_EX); - - if (!$dnsService) { - $this->_error(2); - } - switch ($dnsService) { - case 'freedns': - if (!$dnsHost) { - $this->_error(5); - } - break; - case 'linode': - case 'linode-v6': - case 'namecheap': - case '1984-hosting': - if (!$dnsPass) { - $this->_error(4); - } elseif (!$dnsHost) { - $this->_error(5); - } - break; - case 'route53': - case 'route53-v6': - if (!$dnsZoneID) { - $this->_error(8); - } elseif (!$dnsTTL) { - $this->_error(9); - } - break; - case 'custom': - case 'custom-v6': - if (!$dnsUpdateURL) { - $this->_error(7); - } - break; - case 'duckdns': - case 'dynv6': - case 'dynv6-v6': - case 'regfish': - case 'regfish-v6': - if (!$dnsUser) { - $this->_error(3); - } elseif (!$dnsHost) { - $this->_error(5); - } - break; - case 'azure': - case 'azurev6': - if (!$dnsUser) { - $this->_error(3); - } elseif (!$dnsPass) { - $this->_error(4); - } elseif (!$dnsHost) { - $this->_error(5); - } elseif (!$dnsResourceID) { - $this->_error(8); - } elseif (!$dnsTTL) { - $this->_error(9); - } - break; - case 'cloudflare-token': - case 'cloudflare-token-v6': - case 'hetzner': - case 'hetzner-v6': - if (!$dnsPass) { - $this->_error(4); - } elseif (!$dnsHost) { - $this->_error(5); - } elseif (!$dnsTTL) { - $this->_error(9); - } - break; - case 'desec': - case 'desec-v4-v6': - case 'desec-v6': - if (!$dnsPass) { - $this->_error(4); - } elseif (!$dnsHost) { - $this->_error(5); - } - break; - default: - if (!$dnsUser) { - $this->_error(3); - } elseif (!$dnsPass) { - $this->_error(4); - } elseif (!$dnsHost) { - $this->_error(5); - } - break; - } - - switch ($dnsService) { - case 'all-inkl-v6': - case 'azurev6': - case 'cloudflare-token-v6': - case 'cloudflare-v6': - case 'custom-v6': - case 'desec-v4-v6': - case 'desec-v6': - case 'digitalocean-v6': - case 'dynv6-v6': - case 'godaddy-v6': - case 'he-net-v6': - case 'hetzner-v6': - case 'linode-v6': - case 'regfish-v6': - case 'route53-v6': - case 'strato-v6': - $this->_useIPv6 = true; - break; - default: - $this->_useIPv6 = false; - } - $this->_dnsService = strtolower($dnsService); - $this->_dnsUser = $dnsUser; - $this->_dnsPass = $dnsPass; - $this->_dnsHost = $dnsHost; - $this->_dnsServer = $dnsServer; - $this->_dnsPort = $dnsPort; - $this->_dnsWildcard = $dnsWildcard; - $this->_dnsMX = $dnsMX; - $this->_dnsZoneID = $dnsZoneID; - $this->_dnsResourceID = $dnsResourceID; - $this->_dnsTTL = $dnsTTL; - $this->_if = dyndns_failover_interface($dnsIf, $this->_useIPv6 ? 'inet6' : 'all'); - $this->_checkIP(); - $this->_dnsUpdateURL = $dnsUpdateURL; - $this->_dnsResultMatch = $dnsResultMatch; - $this->_dnsRequestIf = dyndns_failover_interface($dnsRequestIf, $this->_useIPv6 ? 'inet6' : 'all'); - if ($this->_dnsVerboseLog) { - log_error("Dynamic DNS ({$this->_dnsHost}): running dyndns_failover_interface for {$dnsRequestIf}. found {$this->_dnsRequestIf}"); - } - $this->_dnsRequestIfIP = $this->_useIPv6 ? get_interface_ipv6($this->_dnsRequestIf) : get_interface_ip($this->_dnsRequestIf); - $this->_dnsMaxCacheAgeDays = 25; - $this->_dnsDummyUpdateDone = false; - $this->_forceUpdateNeeded = $forceUpdate; - - // Ensure that we were able to lookup the IP - if (!is_ipaddr($this->_dnsIP)) { - log_error("Dynamic DNS ({$this->_dnsHost}) There was an error trying to determine the public IP for interface - {$dnsIf}({$this->_if}). Probably interface is not a WAN interface."); - unlock($dyndnslck); - return; - } - - $this->_debugID = rand(1000000, 9999999); - - if ($forceUpdate == false && $this->_detectChange() == false) { - $this->_error(10); - } else { - switch ($this->_dnsService) { - case '1984-hosting': - case '3322': - case 'all-inkl': - case 'all-inkl-v6': - case 'azure': - case 'azurev6': - case 'citynetwork': - case 'cloudflare': - case 'cloudflare-v6': - case 'cloudflare-token': - case 'cloudflare-token-v6': - case 'custom': - case 'custom-v6': - case 'desec': - case 'desec-v4-v6': - case 'desec-v6': - case 'dhs': - case 'digitalocean': - case 'digitalocean-v6': - case 'gandi-livedns': - case 'dnsexit': - case 'dnsomatic': - case 'duckdns': - case 'dyndns': - case 'dyndns-custom': - case 'dyndns-static': - case 'dyns': - case 'dynv6': - case 'dynv6-v6': - case 'easydns': - case 'eurodns': - case 'freedns': - case 'godaddy': - case 'godaddy-v6': - case 'googledomains': - case 'gratisdns': - case 'he-net': - case 'he-net-tunnelbroker': - case 'he-net-v6': - case 'hetzner': - case 'hetzner-v6': - case 'hn': - case 'linode': - case 'linode-v6': - case 'loopia': - case 'namecheap': - case 'noip': - case 'noip-free': - case 'ods': - case 'oray': - case 'ovh-dynhost': - case 'regfish': - case 'regfish-v6': - case 'route53': - case 'route53-v6': - case 'selfhost': - case 'staticcling': - case 'strato': - case 'strato-v6': - case 'zoneedit': - $this->_update(); - if ($this->_dnsDummyUpdateDone == true) { - // If a dummy update was needed, then sleep a while and do the update again to put the proper address back. - // Some providers (e.g. No-IP free accounts) need to have at least 1 address change every month. - // If the address has not changed recently, or the user did "Force Update", then the code does - // a dummy address change for providers like this. - sleep(10); - $this->_update(); - } - break; - default: - $this->_error(6); - break; - } - } - - unlock($dyndnslck); - } - - /* - * Private Function (added 12 July 05) [beta] - * Send Update To Selected Service. - */ - function _update() - { - if ($this->_dnsVerboseLog) { - log_error("Dynamic DNS ({$this->_dnsHost} via {$this->_dnsServiceList[$this->_dnsService]}): _update() starting."); - } - - if ($this->_dnsService != 'ods' and $this->_dnsService != 'route53' and $this->_dnsService != 'route53-v6') { - $ch = curl_init(); - curl_setopt($ch, CURLOPT_HEADER, 0); - curl_setopt($ch, CURLOPT_USERAGENT, $this->_UserAgent); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); - curl_setopt($ch, CURLOPT_INTERFACE, $this->_dnsRequestIfIP); - curl_setopt($ch, CURLOPT_TIMEOUT, 15); - } - - switch ($this->_dnsService) { - case 'dyndns': - case 'dyndns-static': - case 'dyndns-custom': - if (isset($this->_dnsWildcard) && $this->_dnsWildcard != "OFF") { - $this->_dnsWildcard = "ON"; - } - curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); - curl_setopt($ch, CURLOPT_USERPWD, $this->_dnsUser . ':' . $this->_dnsPass); - $server = "https://members.dyndns.org/nic/update"; - $port = ""; - if ($this->_dnsServer) { - $server = $this->_dnsServer; - } - if ($this->_dnsPort) { - $port = ":" . $this->_dnsPort; - } - curl_setopt($ch, CURLOPT_URL, $server . $port . '?system=dyndns&hostname=' . $this->_dnsHost . '&myip=' . $this->_dnsIP . '&wildcard=' . $this->_dnsWildcard . '&mx=' . $this->_dnsMX . '&backmx=NO'); - break; - case 'dhs': - $post_data['hostscmd'] = 'edit'; - $post_data['hostscmdstage'] = '2'; - $post_data['type'] = '4'; - $post_data['updatetype'] = 'Online'; - $post_data['mx'] = $this->_dnsMX; - $post_data['mx2'] = ''; - $post_data['txt'] = ''; - $post_data['offline_url'] = ''; - $post_data['cloak'] = 'Y'; - $post_data['cloak_title'] = ''; - $post_data['ip'] = $this->_dnsIP; - $post_data['domain'] = 'dyn.dhs.org'; - $post_data['hostname'] = $this->_dnsHost; - $post_data['submit'] = 'Update'; - curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); - $server = "https://members.dhs.org/nic/hosts"; - $port = ""; - if ($this->_dnsServer) { - $server = $this->_dnsServer; - } - if ($this->_dnsPort) { - $port = ":" . $this->_dnsPort; - } - curl_setopt($ch, CURLOPT_URL, '{$server}{$port}'); - curl_setopt($ch, CURLOPT_USERPWD, $this->_dnsUser . ':' . $this->_dnsPass); - curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data); - break; - case 'noip': - case 'noip-free': - curl_setopt_array($ch, [ - CURLOPT_SSL_VERIFYPEER => true, - CURLOPT_USERPWD => $this->_dnsUser . ':' . $this->_dnsPass - ]); - $server = "https://dynupdate.no-ip.com/nic/update"; - $port = ""; - if ($this->_dnsServer) { - $server = $this->_dnsServer; - } - if ($this->_dnsPort) { - $port = ":" . $this->_dnsPort; - } - if ( - ($this->_dnsService == "noip-free") && - ($this->_forceUpdateNeeded == true) && - ($this->_dnsDummyUpdateDone == false) - ) { - // Update the IP to a dummy value to force No-IP free accounts to see a change. - $iptoset = "192.168.1.1"; - $this->_dnsDummyUpdateDone = true; - log_error("Dynamic DNS ({$this->_dnsHost}): Processing dummy update on No-IP free account. IP temporarily set to " . $iptoset); - } else { - $iptoset = $this->_dnsIP; - } - curl_setopt($ch, CURLOPT_URL, $server . $port . '?hostname=' . $this->_dnsHost . '&myip=' . $iptoset); - break; - case 'easydns': - curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true); - curl_setopt($ch, CURLOPT_USERPWD, $this->_dnsUser . ':' . $this->_dnsPass); - $server = "https://members.easydns.com/dyn/dyndns.php"; - $port = ""; - if ($this->_dnsServer) { - $server = $this->_dnsServer; - } - if ($this->_dnsPort) { - $port = ":" . $this->_dnsPort; - } - curl_setopt($ch, CURLOPT_URL, $server . $port . '?hostname=' . $this->_dnsHost . '&myip=' . $this->_dnsIP . '&wildcard=' . $this->_dnsWildcard . '&mx=' . $this->_dnsMX . '&backmx=' . $this->_dnsBackMX); - break; - case 'hn': - curl_setopt($ch, CURLOPT_USERPWD, $this->_dnsUser . ':' . $this->_dnsPass); - $server = "http://dup.hn.org/vanity/update"; - $port = ""; - if ($this->_dnsServer) { - $server = $this->_dnsServer; - } - if ($this->_dnsPort) { - $port = ":" . $this->_dnsPort; - } - curl_setopt($ch, CURLOPT_URL, $server . $port . '?ver=1&IP=' . $this->_dnsIP); - break; - case 'zoneedit': - curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); - curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); - curl_setopt($ch, CURLOPT_USERPWD, $this->_dnsUser . ':' . $this->_dnsPass); - - $server = "https://dynamic.zoneedit.com/auth/dynamic.html"; - $port = ""; - if ($this->_dnsServer) { - $server = $this->_dnsServer; - } - if ($this->_dnsPort) { - $port = ":" . $this->_dnsPort; - } - curl_setopt($ch, CURLOPT_URL, "{$server}{$port}?host=" . $this->_dnsHost); - break; - case 'dyns': - /* XXX HTTPS is currently broken for them */ - $server = 'http://www.dyns.cx/postscript011.php'; - $port = ''; - if ($this->_dnsServer) { - $server = $this->_dnsServer; - } - if ($this->_dnsPort) { - $port = ":" . $this->_dnsPort; - } - curl_setopt($ch, CURLOPT_URL, $server . $port . '?username=' . urlencode($this->_dnsUser) . '&password=' . $this->_dnsPass . '&host=' . $this->_dnsHost); - break; - case 'ods': - $misc_errno = 0; - $misc_error = ""; - $server = "ods.org"; - $port = ""; - if ($this->_dnsServer) { - $server = $this->_dnsServer; - } - if ($this->_dnsPort) { - $port = ":" . $this->_dnsPort; - } - $this->con['socket'] = fsockopen("{$server}{$port}", "7070", $misc_errno, $misc_error, 30); - /* Check that we have connected */ - if (!$this->con['socket']) { - print "error! could not connect."; - break; - } - /* Here is the loop. Read the incoming data (from the socket connection) */ - while (!feof($this->con['socket'])) { - $this->con['buffer']['all'] = trim(fgets($this->con['socket'], 4096)); - $code = substr($this->con['buffer']['all'], 0, 3); - sleep(1); - switch ($code) { - case 100: - fputs($this->con['socket'], "LOGIN " . $this->_dnsUser . " " . $this->_dnsPass . "\n"); - break; - case 225: - fputs($this->con['socket'], "DELRR " . $this->_dnsHost . " A\n"); - break; - case 901: - fputs($this->con['socket'], "ADDRR " . $this->_dnsHost . " A " . $this->_dnsIP . "\n"); - break; - case 795: - fputs($this->con['socket'], "QUIT\n"); - break; - } - } - $this->_checkStatus(0, $code); - break; - case 'freedns': - curl_setopt($ch, CURLOPT_URL, 'https://sync.afraid.org/u/' . $this->_dnsPass . '/'); - break; - case 'dnsexit': - curl_setopt($ch, CURLOPT_URL, 'https://update.dnsexit.com/RemoteUpdate.sv?login=' . urlencode($this->_dnsUser) . '&password=' . $this->_dnsPass . '&host=' . $this->_dnsHost . '&myip=' . $this->_dnsIP); - break; - case 'loopia': - $this->_dnsWildcard = (isset($this->_dnsWildcard) && $this->_dnsWildcard == true) ? 'ON' : 'OFF'; - curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); - curl_setopt($ch, CURLOPT_USERPWD, $this->_dnsUser . ':' . $this->_dnsPass); - curl_setopt($ch, CURLOPT_URL, 'https://dns.loopia.se/XDynDNSServer/XDynDNS.php?hostname=' . $this->_dnsHost . '&myip=' . $this->_dnsIP . '&wildcard=' . $this->_dnsWildcard); - break; - case 'staticcling': - curl_setopt($ch, CURLOPT_URL, 'https://www.staticcling.org/update.html?login=' . urlencode($this->_dnsUser) . '&pass=' . $this->_dnsPass); - break; - case 'dnsomatic': - /* Example syntax - https://username:password@updates.dnsomatic.com/nic/update?hostname=yourhostname&myip=ipaddress&wildcard=NOCHG&mx=NOCHG&backmx=NOCHG - */ - if (isset($this->_dnsWildcard) && $this->_dnsWildcard != "OFF") { - $this->_dnsWildcard = "ON"; - } - curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); - /* - Reference: https://www.dnsomatic.com/wiki/api - DNS-O-Matic usernames are 3-25 characters. - DNS-O-Matic passwords are 6-20 characters. - All ASCII letters and numbers accepted. - Dots, dashes, and underscores allowed, but not at the beginning or end of the string. - Required: "rawurlencode" http://www.php.net/manual/en/function.rawurlencode.php - Encodes the given string according to RFC 3986. - */ - $server = "https://" . rawurlencode($this->_dnsUser) . ":" . rawurlencode($this->_dnsPass) . "@updates.dnsomatic.com/nic/update?hostname="; - if ($this->_dnsServer) { - $server = $this->_dnsServer; - } - if ($this->_dnsPort) { - $port = ":" . $this->_dnsPort; - } - curl_setopt($ch, CURLOPT_URL, $server . $this->_dnsHost . '&myip=' . $this->_dnsIP . '&wildcard=' . $this->_dnsWildcard . '&mx=' . $this->_dnsMX . '&backmx=NOCHG'); - break; - case 'namecheap': - /* Example: - https://dynamicdns.park-your-domain.com/update?host=[host_name]&domain=[domain.com]&password=[domain_password]&ip=[your_ip] - */ - curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); - $dparts = explode(".", trim($this->_dnsHost)); - $domain_part_count = ($dparts[count($dparts) - 1] == "uk") ? 3 : 2; - $domain_offset = count($dparts) - $domain_part_count; - $hostname = implode(".", array_slice($dparts, 0, $domain_offset)); - $domain = implode(".", array_slice($dparts, $domain_offset)); - $dnspass = trim($this->_dnsPass); - $server = "https://dynamicdns.park-your-domain.com/update?host={$hostname}&domain={$domain}&password={$dnspass}&ip={$this->_dnsIP}"; - curl_setopt($ch, CURLOPT_URL, $server); - break; - case 'he-net': - case 'he-net-v6': - $server = "https://dyn.dns.he.net/nic/update?"; - curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true); - curl_setopt($ch, CURLOPT_URL, $server . 'hostname=' . $this->_dnsHost . '&password=' . $this->_dnsPass . '&myip=' . $this->_dnsIP); - break; - case 'he-net-tunnelbroker': - $server = "https://ipv4.tunnelbroker.net/nic/update?"; - curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true); - curl_setopt($ch, CURLOPT_USERPWD, $this->_dnsUser . ':' . $this->_dnsPass); - 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 - * dnsPass should be the API key - */ - $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); - curl_setopt($ch, CURLOPT_HTTPHEADER, array( - "Authorization: Bearer {$this->_dnsPass}", - 'Content-Type: application/json' - )); - curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($hostData)); - curl_setopt($ch, CURLOPT_URL, $server); - break; - case 'gandi-livedns': - /* - * https://github.com/vizion8-dan - * Tested on OPNsense 20.1.8_1-amd64 - IPv4 (A) - * dnsHost ("Hostname" field in OPNsense) should be the 2nd-level domain ("example.org") - * dnsUser ("Username" field in OPNsense) should be the subdomain / A-record ("myrecord" in 2nd-level domain) - * dnsPass should be the Gandi-API key - */ - $server = "https://dns.api.gandi.net/api/v5/domains/" . $this->_dnsHost . "/records/" . $this->_dnsUser . "/A"; - - $body = '{"rrset_ttl":"' . "300" . '", "rrset_values":["' . $this->_dnsIP . '"]}'; - - curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true); - curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT'); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); - curl_setopt($ch, CURLOPT_HTTPHEADER, array( - "X-Api-Key: {$this->_dnsPass}", - 'Content-Type: application/json' - )); - curl_setopt($ch, CURLOPT_POSTFIELDS, $body); - curl_setopt($ch, CURLOPT_URL, $server); - break; - case 'selfhost': - if (isset($this->_dnsWildcard) && $this->_dnsWildcard != "OFF") { - $this->_dnsWildcard = "ON"; - } - curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true); - curl_setopt($ch, CURLOPT_USERPWD, $this->_dnsUser . ':' . $this->_dnsPass); - $server = "https://carol.selfhost.de/nic/update"; - $port = ""; - if ($this->_dnsServer) { - $server = $this->_dnsServer; - } - if ($this->_dnsPort) { - $port = ":" . $this->_dnsPort; - } - curl_setopt($ch, CURLOPT_URL, $server . $port . '?system=dyndns&hostname=' . $this->_dnsHost . '&myip=' . $this->_dnsIP . '&wildcard=' . $this->_dnsWildcard . '&mx=' . $this->_dnsMX . '&backmx=NO'); - break; - case 'route53': - case 'route53-v6': - /* Setting Variables */ - $hostname = "{$this->_dnsHost}."; - $ZoneID = $this->_dnsZoneID; - $AccessKeyId = $this->_dnsUser; - $SecretAccessKey = $this->_dnsPass; - $NewIP = $this->_dnsIP; - $NewTTL = $this->_dnsTTL; - $RecordType = ($this->_useIPv6) ? "AAAA" : "A"; - - /* Set Amazon AWS Credentials for this record */ - $r53 = new Route53($AccessKeyId, $SecretAccessKey); - - /* Function to find old values of records in Route 53 */ - if (!function_exists('Searchrecords')) { - function SearchRecords($records, $name) - { - if (!is_array($records)) { - return false; - } - $result = array(); - foreach ($records as $record) { - if (strtolower($record['Name']) == strtolower($name)) { - $result [] = $record; - } - } - return ($result) ? $result : false; - } - } - - $records = $r53->listResourceRecordSets("/hostedzone/$ZoneID"); - - /* Get IP for your hostname in Route 53 */ - if (false !== ($a_result = SearchRecords($records['ResourceRecordSets'], "$hostname"))) { - /** - * if hostname for ipv4 and ipv6 is the same, a_result contains more than 1 item - * we need to get the item that corresponds to the record type - */ - $oldTTLResult = null; - $oldIPResult = null; - foreach ($a_result as $resultItem) { - if ($RecordType === $resultItem['Type']) { - $oldTTLResult = $resultItem["TTL"]; - $oldIPResult = $resultItem["ResourceRecords"][0]; - } - } - - $OldTTL = $oldTTLResult; - $OldIP = $oldIPResult; - } else { - $OldIP = ""; - } - - /* Check if we need to update DNS Record */ - if ($OldIP !== $NewIP) { - if (!empty($OldIP)) { - /* Your Hostname already exists, deleting and creating it again */ - $changes = array(); - $changes[] = $r53->prepareChange("DELETE", $hostname, $RecordType, $OldTTL, $OldIP); - $changes[] = $r53->prepareChange("CREATE", $hostname, $RecordType, $NewTTL, $NewIP); - $result = $r53->changeResourceRecordSets("/hostedzone/$ZoneID", $changes); - } else { - /* Your Hostname does not exist yet, creating it */ - $changes = $r53->prepareChange("CREATE", $hostname, $RecordType, $NewTTL, $NewIP); - $result = $r53->changeResourceRecordSets("/hostedzone/$ZoneID", $changes); - } - } - $this->_checkStatus(0, $result); - break; - case 'custom': - case 'custom-v6': - if ($this->_curlIpresolveV4) { - curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); - } - if ($this->_curlSslVerifypeer) { - curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true); - } else { - curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); - } - if ($this->_dnsUser != '') { - curl_setopt($ch, CURLOPT_USERPWD, "{$this->_dnsUser}:{$this->_dnsPass}"); - } - $server = str_replace("%IP%", $this->_dnsIP, $this->_dnsUpdateURL); - $server = str_replace("%HOST%", $this->_dnsHost, $server); - curl_setopt($ch, CURLOPT_URL, $server); - break; - case 'cloudflare': - case 'cloudflare-v6': - case 'cloudflare-token': - case 'cloudflare-token-v6': - $baseUrl = 'https://api.cloudflare.com/client/v4'; - $fqdn = str_replace(' ', '', $this->_dnsHost); - $recordType = ($this->_useIPv6) ? 'AAAA' : 'A'; - $ttlData = intval($this->_dnsTTL) < 1 ? 1 : intval($this->_dnsTTL); - $hostData = array( - "content" => "{$this->_dnsIP}", - "type" => $recordType, - "name" => $fqdn, - "ttl" => $ttlData - ); - - // Determine if service is token based or user/password based and define appropriate header - if (strpos($this->_dnsService, 'token') !== false) { - $headerAuth = array( - "Authorization: Bearer {$this->_dnsPass}", - 'Content-Type: application/json' - ); - } else { - $headerAuth = array( - "X-Auth-Email: {$this->_dnsUser}", - "X-Auth-Key: {$this->_dnsPass}", - 'Content-Type: application/json' - ); - } - - curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); - curl_setopt($ch, CURLOPT_HTTPHEADER, $headerAuth); - - // Get all zone info - $zonesUrl = "$baseUrl/zones"; - curl_setopt($ch, CURLOPT_URL, $zonesUrl); - $output = json_decode(curl_exec($ch)); - $zoneId = null; // Set default value - - if (!empty($output->result)) { - // Iterate zone objects, check if $fqdn is equal to or ends with zone name - foreach ($output->result as $key => $zoneObj) { - if (preg_match("/^{$zoneObj->name}$|\.{$zoneObj->name}$/", $fqdn)) { - // Found matching zone - $zoneId = $zoneObj->id; - // Get $hostName from $fqdn, set $domainName - // These are only really used for log messages. - $hostName = preg_replace("/\.?{$zoneObj->name}$/", '', $fqdn); - $domainName = $zoneObj->name; - break; - } - } - } - - if ($zoneId) { // If zone ID was found get host ID - $dnsRecordsUrl = "$zonesUrl/$zoneId/dns_records"; - $getHostId = "$dnsRecordsUrl?name=$fqdn&type=$recordType"; - curl_setopt($ch, CURLOPT_URL, $getHostId); - $output = json_decode(curl_exec($ch)); - $recordCount = !empty($output->result) ? count($output->result) : 0; - if ($recordCount === 0) { - // create record - curl_setopt($ch, CURLOPT_URL, $dnsRecordsUrl); - curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST'); - } elseif ($recordCount >= 1) { - // update record - $recordId = $output->result[0]->id; - $hostData["proxied"] = $output->result[0]->proxied; - curl_setopt($ch, CURLOPT_URL, "$dnsRecordsUrl/$recordId"); - curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT'); - } - curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($hostData)); - if ($recordCount > 1) { - log_error("Dynamic DNS ($fqdn): Warning: multiple records for $hostName found"); - } - } - break; - case 'hetzner': - case 'hetzner-v6': - $baseUrl = 'https://dns.hetzner.com/api/v1'; - $fqdn = str_replace(' ', '', $this->_dnsHost); - $recordType = ($this->_useIPv6) ? 'AAAA' : 'A'; - $ttlData = intval($this->_dnsTTL) < 1 ? 120 : intval($this->_dnsTTL); - $hostData = [ - "value" => "{$this->_dnsIP}", - "type" => $recordType, - "name" => "", - "ttl" => $ttlData, - "zone_id" => "" - ]; - - $headerAuth = [ - "Auth-API-Token: {$this->_dnsPass}", - 'Content-Type: application/json' - ]; - - curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); - curl_setopt($ch, CURLOPT_HTTPHEADER, $headerAuth); - - // Get all zone info - $zonesUrl = "$baseUrl/zones"; - curl_setopt($ch, CURLOPT_URL, $zonesUrl); - $output = json_decode(curl_exec($ch)); - $zoneId = null; // Set default value - - if (!empty($output->zones)) { - // Iterate zone objects, check if $fqdn is equal to or ends with zone name - foreach ($output->zones as $key => $zoneObj) { - if (preg_match("/^{$zoneObj->name}$|\.{$zoneObj->name}$/", $fqdn)) { - // Found matching zone - $zoneId = $zoneObj->id; - // Get $hostName from $fqdn, set $domainName - // These are only really used for log messages. - $hostName = preg_replace("/\.?{$zoneObj->name}$/", '', $fqdn); - $domainName = $zoneObj->name; - - break; - } - } - } - - if ($zoneId) { // If zone ID was found get host ID - $dnsRecordsUrl = "$baseUrl/records?zone_id=$zoneId"; - curl_setopt($ch, CURLOPT_URL, $dnsRecordsUrl); - $output = json_decode(curl_exec($ch)); - $recordId = null; - - if (!empty($output->records)) { - // Iterate zone objects, check if $hostName exist of the same type - foreach ($output->records as $key => $recordObj) { - if (preg_match("/^{$recordObj->name}$/", $hostName)) { - if ($recordObj->type == $recordType) { - // Found matching host - $recordId = $recordObj->id; - break; - } - } - } - } - - if ($recordId) { // If record ID was found, update record - $setRecordUrl = "$baseUrl/records/$recordId"; - curl_setopt($ch, CURLOPT_URL, $setRecordUrl); - curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT'); - } else { - $setRecordUrl = "$baseUrl/records"; - curl_setopt($ch, CURLOPT_URL, $setRecordUrl); - curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST'); - } - - $hostData["zone_id"] = $zoneId; - $hostData["name"] = $hostName; - - curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($hostData)); - } - break; - case 'eurodns': - curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); - curl_setopt($ch, CURLOPT_USERPWD, $this->_dnsUser . ':' . $this->_dnsPass); - $server = "https://update.eurodyndns.org/update/"; - $port = ""; - if ($this->_dnsPort) { - $port = ":" . $this->_dnsPort; - } - curl_setopt($ch, CURLOPT_URL, $server . $port . '?hostname=' . $this->_dnsHost . '&myip=' . $this->_dnsIP); - break; - case 'gratisdns': - $server = "https://admin.gratisdns.com/ddns.php"; - curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true); - if (substr_count($this->_dnsHost, ".") < 2) { - $domain = $this->_dnsHost; - $hostname = $this->_dnsHost; - } else { - list($hostname, $domain) = explode(".", $this->_dnsHost, 2); - } - curl_setopt($ch, CURLOPT_URL, $server . '?u=' . urlencode($this->_dnsUser) . '&p=' . $this->_dnsPass . '&h=' . $this->_dnsHost . '&d=' . $domain . '&i=' . $this->_dnsIP); - break; - case 'ovh-dynhost': - if (isset($this->_dnsWildcard) && $this->_dnsWildcard != "OFF") { - $this->_dnsWildcard = "ON"; - } - curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true); - curl_setopt($ch, CURLOPT_USERPWD, $this->_dnsUser . ':' . $this->_dnsPass); - $server = "https://www.ovh.com/nic/update"; - $port = ""; - if ($this->_dnsServer) { - $server = $this->_dnsServer; - } - if ($this->_dnsPort) { - $port = ":" . $this->_dnsPort; - } - curl_setopt($ch, CURLOPT_URL, $server . $port . '?system=dyndns&hostname=' . $this->_dnsHost . '&myip=' . $this->_dnsIP . '&wildcard=' . $this->_dnsWildcard . '&mx=' . $this->_dnsMX . '&backmx=NO'); - break; - case 'citynetwork': - curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true); - curl_setopt($ch, CURLOPT_USERPWD, $this->_dnsUser . ':' . $this->_dnsPass); - $server = 'https://dyndns.citynetwork.se/nic/update'; - $port = ""; - if ($this->_dnsServer) { - $server = $this->_dnsServer; - } - if ($this->_dnsPort) { - $port = ":" . $this->_dnsPort; - } - curl_setopt($ch, CURLOPT_URL, $server . $port . '?hostname=' . $this->_dnsHost . '&myip=' . $this->_dnsIP); - break; - case 'duckdns': - $server = "https://www.duckdns.org/update"; - curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true); - curl_setopt($ch, CURLOPT_URL, $server . '?domains=' . str_replace('.duckdns.org', '', $this->_dnsHost) . '&token=' . urlencode($this->_dnsUser)); - break; - case 'dynv6': - $server = "https://ipv4.dynv6.com/api/update"; - curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true); - curl_setopt($ch, CURLOPT_INTERFACE, $this->_dnsRequestIf); - curl_setopt($ch, CURLOPT_DNS_LOCAL_IP4, $this->_dnsIP); - curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); - curl_setopt($ch, CURLOPT_URL, $server . '?hostname=' . $this->_dnsHost . '&ipv4=' . $this->_dnsIP . '&token=' . $this->_dnsUser); - break; - case 'dynv6-v6': - $server = "https://ipv6.dynv6.com/api/update"; - curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true); - curl_setopt($ch, CURLOPT_INTERFACE, $this->_dnsRequestIf); - curl_setopt($ch, CURLOPT_DNS_LOCAL_IP6, $this->_dnsIP); - curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V6); - curl_setopt($ch, CURLOPT_URL, $server . '?hostname=' . $this->_dnsHost . '&ipv6=' . $this->_dnsIP . '&token=' . $this->_dnsUser); - break; - case 'googledomains': - $server = "https://domains.google.com/nic/update"; - $post_data['hostname'] = $this->_dnsHost; - $post_data['myip'] = $this->_dnsIP; - $post_data['offline'] = 'no'; - curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true); - curl_setopt($ch, CURLOPT_USERPWD, $this->_dnsUser . ':' . $this->_dnsPass); - curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data); - curl_setopt($ch, CURLOPT_URL, $server); - curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); - break; - case 'strato': - case 'strato-v6': - $server = "https://dyndns.strato.com/nic/update?hostname={$this->_dnsHost}&myip={$this->_dnsIP}"; - curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true); - curl_setopt($ch, CURLOPT_USERPWD, $this->_dnsUser . ':' . $this->_dnsPass); - curl_setopt($ch, CURLOPT_URL, $server); - if ($this->_curlIpresolveV4) { - curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); - } - break; - case '1984-hosting': - $server = "https://api.1984.is/1.0/freedns/?apikey={$this->_dnsPass}&domain={$this->_dnsHost}&ip={$this->_dnsIP}"; - curl_setopt($ch, CURLOPT_URL, $server); - curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); - break; - case '3322': - $server = "http://members.3322.net/dyndns/update?hostname={$this->_dnsHost}&myip={$this->_dnsIP}"; - curl_setopt($ch, CURLOPT_USERPWD, $this->_dnsUser . ':' . $this->_dnsPass); - curl_setopt($ch, CURLOPT_URL, $server); - curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); - break; - case 'oray': - $server = "http://ddns.oray.com/ph/update?hostname={$this->_dnsHost}&myip={$this->_dnsIP}"; - curl_setopt($ch, CURLOPT_USERPWD, $this->_dnsUser . ':' . $this->_dnsPass); - curl_setopt($ch, CURLOPT_URL, $server); - curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); - break; - case 'regfish': - $server = "https://dyndns.regfish.de/?fqdn={$this->_dnsHost}&ipv4={$this->_dnsIP}&forcehost=1&token=" . urlencode($this->_dnsUser); - curl_setopt($ch, CURLOPT_URL, $server); - break; - case 'regfish-v6': - $server = "https://dyndns6.regfish.de/?fqdn={$this->_dnsHost}&ipv6={$this->_dnsIP}&forcehost=1&token=" . urlencode($this->_dnsUser); - curl_setopt($ch, CURLOPT_URL, $server); - break; - case 'linode': - case 'linode-v6': - $baseUrl = "https://api.linode.com/v4"; - $fqdn = trim($this->_dnsHost); - $recordType = ($this->_useIPv6) ? 'AAAA' : 'A'; - - if ($this->_dnsWildcard == 'ON') { - $fqdn = "*.$fqdn"; - } - - curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); - curl_setopt($ch, CURLOPT_HTTPHEADER, array( - 'Accept: application/json', - 'Authorization: Bearer ' . $this->_dnsPass, - 'Content-Type: application/json' - )); - - $domainsUrl = "$baseUrl/domains"; - curl_setopt($ch, CURLOPT_URL, $domainsUrl); - $output = json_decode(curl_exec($ch)); - $domainId = null; - - if (!empty($output->data)) { - // Find matching domain and split the hostname part from it - foreach ($output->data as $key => $domainObj) { - if (preg_match("/^{$domainObj->domain}$|\.{$domainObj->domain}$/", $fqdn)) { - $domainId = $domainObj->id; - $hostName = preg_replace("/\.?{$domainObj->domain}$/", '', $fqdn); - $domainName = $domainObj->domain; - break; - } - } - } - - if ($domainId) { - if ($this->_dnsVerboseLog) { - log_error("Dynamic DNS ($fqdn): Found domain name: $domainName, ID: $domainId"); - } - - $dnsRecordsUrl = "$domainsUrl/$domainId/records"; - curl_setopt($ch, CURLOPT_URL, $dnsRecordsUrl); - $output = json_decode(curl_exec($ch)); - $recordId = null; - - if (!empty($output->data)) { - // Find matching record - foreach ($output->data as $key => $recordObj) { - if ($recordObj->type == $recordType && $recordObj->name == $hostName) { - $recordId = $recordObj->id; - break; - } - } - } - - $hostData = [ 'target' => "{$this->_dnsIP}" ]; - - if ($recordId) { - // Update record - if ($this->_dnsVerboseLog) { - log_error("Dynamic DNS ($fqdn): Updating existing record ID: $recordId"); - } - - curl_setopt($ch, CURLOPT_URL, "$dnsRecordsUrl/$recordId"); - curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT'); - } else { - // Create record - if ($this->_dnsVerboseLog) { - log_error("Dynamic DNS ($fqdn): Creating new record"); - } - - $hostData['type'] = $recordType; - $hostData['name'] = $hostName; - // Linode will round up to the nearest valid TTL - $hostData['ttl_sec'] = 0; - - curl_setopt($ch, CURLOPT_URL, $dnsRecordsUrl); - curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST'); - } - - curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($hostData)); - } else { - log_error("Dynamic DNS($fqdn): No zone found for domain"); - } - break; - case 'azurev6': - case 'azure': - $hostname = "{$this->_dnsHost}"; - $resourceid = trim($this->_dnsResourceID); - $app_id = $this->_dnsUser; - $client_secret = $this->_dnsPass; - $newip = $this->_dnsIP; - $newttl = $this->_dnsTTL; - // ensure resourceid starts with / and has no trailing / - $resourceid = '/' . trim($resourceid, '/'); - // extract subscription id from resource id - preg_match('/\\/subscriptions\\/(?[^\\/]*)/', $resourceid, $result); - $subscriptionid = isset($result['sid']) ? $result['sid'] : ''; - if (isset($result['sid'])) { - $subscriptionid = $result['sid']; - } else { - log_error("Azure subscription id not found in resource id ({$resourceid})"); - return false; - } - // find tenant id from subscription id - curl_setopt($ch, CURLOPT_URL, "https://management.azure.com/subscriptions/" . $subscriptionid . "?api-version=2016-09-01"); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); - curl_setopt($ch, CURLOPT_HEADER, 1); - curl_setopt($ch, CURLOPT_NOBODY, 1); - $output = curl_exec($ch); - $pattern = '/Bearer authorization_uri="https:\\/\\/login.windows.net\\/(?[^"]*)/i'; - preg_match($pattern, $output, $result); - if (isset($result['tid'])) { - $tenantid = $result['tid']; - } else { - log_error("Tenant ID not found"); - return false; - } - // get an bearer token - curl_setopt($ch, CURLOPT_URL, "https://login.microsoftonline.com/" . $tenantid . "/oauth2/token"); - curl_setopt($ch, CURLOPT_POST, 1); - $body = "resource=" . urlencode("https://management.core.windows.net/") . "&grant_type=client_credentials&client_id=" . $app_id . "&client_secret=" . urlencode($client_secret); - curl_setopt($ch, CURLOPT_POSTFIELDS, $body); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); - $server_output = curl_exec($ch); - $httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE); - preg_match("/\"access_token\":\"(?[^\"]*)\"/", $server_output, $result); - if (isset($result['tok'])) { - $bearertoken = $result['tok']; - } else { - log_error("no valid bearer token"); - return false; - } - // Update the DNS record - if ($this->_useIPv6) { - $url = "https://management.azure.com" . $resourceid . "/AAAA/" . $hostname . "?api-version=2017-09-01"; - $body = '{"properties":{"TTL":"' . $newttl . '", "AAAARecords":[{"ipv6Address":"' . $newip . '"}]}}'; - } else { - $url = "https://management.azure.com" . $resourceid . "/A/" . $hostname . "?api-version=2017-09-01"; - $body = '{"properties":{"TTL":"' . $newttl . '", "ARecords":[{"ipv4Address":"' . $newip . '"}]}}'; - } - $request_headers = array(); - $request_headers[] = 'Accept: application/json'; - $request_headers[] = 'Authorization: Bearer ' . $bearertoken; - $request_headers[] = 'Content-Type: application/json'; - curl_setopt($ch, CURLOPT_URL, $url); - curl_setopt($ch, CURLOPT_USERAGENT, $this->_UserAgent); - curl_setopt($ch, CURLOPT_HTTPHEADER, $request_headers); - curl_setopt($ch, CURLOPT_POSTFIELDS, $body); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); - curl_setopt($ch, CURLOPT_HEADER, 1); - curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT'); - break; - case 'all-inkl': - case 'all-inkl-v6': - $server = "https://dyndns.kasserver.com/"; - $url = $server . '?myip=' . $this->_dnsIP; - curl_setopt($ch, CURLOPT_URL, $url); - curl_setopt($ch, CURLOPT_USERPWD, $this->_dnsUser . ':' . $this->_dnsPass); - // fix: All-Inkl dyndns.kasserver.com only supports v4 - $ipv4 = get_interface_ip($this->_dnsRequestIf); - if (!is_ipaddr($ipv4)) { - log_error("Dynamic DNS ({$this->_dnsHost}): (Error) Need a IPv4 address on $this->_dnsRequestIf!"); - return false; - } - curl_setopt($ch, CURLOPT_INTERFACE, $ipv4); - // fix end - break; - case 'godaddy': - case 'godaddy-v6': - /* Read https://developer.godaddy.com/ for API documentation */ - $baseApiUrl = 'https://api.godaddy.com/v1/domains/'; - $recordType = $this->_useIPv6 ? "AAAA" : "A"; - $splitHost = explode('.', trim($this->_dnsHost)); - $dnsDomain = '*'; - if ($this->_dnsWildcard != 'ON') { - $dnsDomain = array_shift($splitHost); - } - $dnsHost = implode('.', $splitHost); - - $url = $baseApiUrl . $dnsHost . '/records/' . $recordType . '/' . $dnsDomain; - - /* body can contain multiple options (data, port, priority, service, ttl, weight) */ - $data = array(); - $data[] = array('data' => $this->_dnsIP); - if ($this->_dnsTTL) { - $data[0]['ttl'] = $this->_dnsTTL; - } else { - // minimum allowed by GoDaddy - $data[0]['ttl'] = 600; - } - $jsonBody = json_encode($data); - if ($this->_dnsVerboseLog) { - log_error("Dynamic DNS: calling $url with body: $jsonBody"); - } - - /* PUT JSON /v1/domains/{domain}/records/{type}/{name} */ - curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); - curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT"); - curl_setopt($ch, CURLOPT_HTTPHEADER, array( - 'Accept: application/json', - 'Content-Type: application/json', - 'Authorization: sso-key ' . $this->_dnsUser . ':' . $this->_dnsPass - )); - curl_setopt($ch, CURLOPT_URL, $url); - curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonBody); - curl_setopt($ch, CURLOPT_INTERFACE, $this->_dnsRequestIf); - break; - case 'desec': - /* - * https://desec.readthedocs.io/en/latest/dyndns/update-api.html - * dnsHost should be the domain - * dnsPass should be the token, NOT the token id - * IPv6 is empty so deSEC API will not set this to the IPv6 of the sending interface if the connection is made via IPv6 - */ - $server = "https://update.dedyn.io/"; - $url = '?hostname=' . $this->_dnsHost . '&myipv4=' . $this->_dnsIP . '&myipv6=""'; - curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true); - curl_setopt($ch, CURLOPT_USERPWD, $this->_dnsHost . ':' . $this->_dnsPass); - curl_setopt($ch, CURLOPT_URL, $server . $url); - break; - case 'desec-v4-v6': - /* - * https://desec.readthedocs.io/en/latest/dyndns/update-api.html - * dnsHost should be the domain - * dnsPass should be the token, NOT the 36-character token id (https://forum.netgate.com/post/930114) - * IPv4 is determined by deSEC API via the sending interface - */ - - // temporarily disable useIPv6 to get IPv4 Address - $this->_useIPv6 = false; - $ipv4 = $this->_checkIP(); - $this->_useIPv6 = true; - - $server = "https://update.dedyn.io/"; - $url = '?hostname=' . $this->_dnsHost . '&myipv4=' . $ipv4 . '&myipv6=' . $this->_dnsIP; - curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true); - curl_setopt($ch, CURLOPT_USERPWD, $this->_dnsHost . ':' . $this->_dnsPass); - curl_setopt($ch, CURLOPT_URL, $server . $url); - break; - case 'desec-v6': - /* - * https://desec.readthedocs.io/en/latest/dyndns/update-api.html - * dnsHost should be the domain - * dnsPass should be the token, NOT the 36-character token id (https://forum.netgate.com/post/930114) - */ - $server = "https://update6.dedyn.io/"; - $url = '?hostname=' . $this->_dnsHost . '&myipv6=' . $this->_dnsIP; - curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true); - curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V6); - curl_setopt($ch, CURLOPT_USERPWD, $this->_dnsHost . ':' . $this->_dnsPass); - curl_setopt($ch, CURLOPT_URL, $server . $url); - break; - default: - break; - } - if ($this->_dnsService != 'ods' and $this->_dnsService != 'route53' and $this->_dnsService != 'route53-v6') { - $data = curl_exec($ch); - $this->_checkStatus($ch, $data); - @curl_close($ch); - } - } - - /* - * Private Function (added 12 July 2005) [beta] - * Retrieve Update Status - */ - function _checkStatus($ch, $data) - { - if ($this->_dnsVerboseLog) { - log_error("Dynamic DNS ({$this->_dnsHost}): _checkStatus() starting."); - log_error("Dynamic DNS ({$this->_dnsHost}): Current Service: {$this->_dnsService}"); - } - $successful_update = false; - if ($this->_dnsService != 'ods' and $this->_dnsService != 'route53' and $this->_dnsService != 'route53-v6' && @curl_error($ch)) { - $status = "Curl error occurred: " . curl_error($ch); - log_error($status); - $this->status = $status; - return; - } - switch ($this->_dnsService) { - case 'dhs': - break; - case 'noip': - case 'noip-free': - $noIpPrc = explode(' ', $data); - $code = $noIpPrc[0]; - $ip = isset($noIpPrc[1]) ? $noIpPrc[1] : 'n/a'; - switch ($code) { - case 'good': - $status = "Dynamic DNS ({$this->_dnsHost}): (Success) DNS hostname update successful."; - $successful_update = true; - break; - case 'nochg': - $status = "Dynamic DNS ({$this->_dnsHost}): (Success) IP address is current, no update performed."; - $successful_update = true; - break; - case 'nohost': - $status = "Dynamic DNS ({$this->_dnsHost}): (Error) Hostname supplied does not exist."; - break; - case 'badauth': - $status = "Dynamic DNS ({$this->_dnsHost}): (Error) Invalid Username or Password."; - break; - case 'badagent': - $status = "Dynamic DNS ({$this->_dnsHost}): (Error) Client disabled. Client should exit and not perform any more updates without user intervention."; - break; - case '!donate': - $status = "Dynamic DNS ({$this->_dnsHost}): (Error) Requested update feature only available to Enhanced subscribers."; - break; - case '911': - $status = "Dynamic DNS ({$this->_dnsHost}): (Error) No-IP servers currently experiencing outages. Retry no sooner than 30 minutes."; - break; - case 'abuse': - $status = "Dynamic DNS ({$this->_dnsHost}): (Error) Account disabled due to violation of No-IP terms of service."; - break; - default: - $status = "Dynamic DNS ({$this->_dnsHost}): (Unknown Response)"; - log_error("Dynamic DNS ({$this->_dnsHost}): PAYLOAD: {$data}"); - $this->_debug("Unknown Response: " . $data); - break; - } - break; - case 'easydns': - if (preg_match('/NOACCESS/i', $data)) { - $status = "Dynamic DNS ({$this->_dnsHost}): (Error) Authentication Failed: Username and/or Password was Incorrect."; - } elseif (preg_match('/NOSERVICE/i', $data)) { - $status = "Dynamic DNS ({$this->_dnsHost}): (Error) No Service: Dynamic DNS Service has been disabled for this domain."; - } elseif (preg_match('/ILLEGAL INPUT/i', $data)) { - $status = "Dynamic DNS ({$this->_dnsHost}): (Error) Illegal Input: Self-Explanatory"; - } elseif (preg_match('/TOOSOON/i', $data)) { - $status = "Dynamic DNS ({$this->_dnsHost}): (Error) Too Soon: Not Enough Time Has Elapsed Since Last Update"; - } elseif (preg_match('/NOERROR/i', $data)) { - $status = "Dynamic DNS ({$this->_dnsHost}): (Success) IP Updated Successfully!"; - $successful_update = true; - } else { - $status = "Dynamic DNS ({$this->_dnsHost}): (Unknown Response)"; - log_error("Dynamic DNS ({$this->_dnsHost}): PAYLOAD: {$data}"); - $this->_debug("Unknown Response: " . $data); - } - break; - case 'hn': - /* FIXME: add checks */ - break; - case 'zoneedit': - if (preg_match('/799/i', $data)) { - $status = "Dynamic DNS ({$this->_dnsHost}): (Error 799) Update Failed!"; - } elseif (preg_match('/700/i', $data)) { - $status = "Dynamic DNS ({$this->_dnsHost}): (Error 700) Update Failed!"; - } elseif (preg_match('/200/i', $data)) { - $status = "Dynamic DNS ({$this->_dnsHost}): (Success) IP Address Updated Successfully!"; - $successful_update = true; - } elseif (preg_match('/201/i', $data)) { - $status = "Dynamic DNS ({$this->_dnsHost}): (Success) IP Address Updated Successfully!"; - $successful_update = true; - } else { - $status = "Dynamic DNS ({$this->_dnsHost}): (Unknown Response)"; - log_error("Dynamic DNS ({$this->_dnsHost}): PAYLOAD: {$data}"); - $this->_debug("Unknown Response: " . $data); - } - break; - case 'dyns': - if (preg_match("/400/i", $data)) { - $status = "Dynamic DNS ({$this->_dnsHost}): (Error) Bad Request - The URL was malformed. Required parameters were not provided."; - } elseif (preg_match('/402/i', $data)) { - $status = "Dynamic DNS ({$this->_dnsHost}): (Error) Update Too Soon - You have tried updating to quickly since last change."; - } elseif (preg_match('/403/i', $data)) { - $status = "Dynamic DNS ({$this->_dnsHost}): (Error) Database Error - There was a server-sided database error."; - } elseif (preg_match('/405/i', $data)) { - $status = "Dynamic DNS ({$this->_dnsHost}): (Error) Hostname Error - The hostname (" . $this->_dnsHost . ") doesn't belong to you."; - } elseif (preg_match('/200/i', $data)) { - $status = "Dynamic DNS ({$this->_dnsHost}): (Success) IP Address Updated Successfully!"; - $successful_update = true; - } else { - $status = "Dynamic DNS ({$this->_dnsHost}): (Unknown Response)"; - log_error("Dynamic DNS ({$this->_dnsHost}): PAYLOAD: {$data}"); - $this->_debug("Unknown Response: " . $data); - } - break; - case 'ods': - if (preg_match("/299/i", $data)) { - $status = "Dynamic DNS ({$this->_dnsHost}): (Success) IP Address Updated Successfully!"; - $successful_update = true; - } else { - $status = "Dynamic DNS ({$this->_dnsHost}): (Unknown Response)"; - log_error("Dynamic DNS ({$this->_dnsHost}): PAYLOAD: {$data}"); - $this->_debug("Unknown Response: " . $data); - } - break; - case 'freedns': - if (preg_match("/No IP change detected.*skipping update/i", $data)) { - $status = "Dynamic DNS ({$this->_dnsHost}): (Success) No Change In IP Address"; - $successful_update = true; - } elseif (preg_match("/Updated/i", $data)) { - $status = "Dynamic DNS ({$this->_dnsHost}): (Success) IP Address Changed Successfully!"; - $successful_update = true; - } else { - $status = "Dynamic DNS ({$this->_dnsHost}): (Unknown Response)"; - log_error("Dynamic DNS ({$this->_dnsHost}): PAYLOAD: {$data}"); - $this->_debug("Unknown Response: " . $data); - } - break; - case 'dnsexit': - if (preg_match("/IP not changed/i", $data)) { - $status = "Dynamic DNS ({$this->_dnsHost}): (Success) No Change In IP Address"; - $successful_update = true; - } elseif (preg_match("/Success/i", $data)) { - $status = "Dynamic DNS ({$this->_dnsHost}): (Success) IP Address Changed Successfully!"; - $successful_update = true; - } else { - $status = "Dynamic DNS ({$this->_dnsHost}): (Unknown Response)"; - log_error("Dynamic DNS ({$this->_dnsHost}): PAYLOAD: {$data}"); - $this->_debug("Unknown Response: " . $data); - } - break; - case 'staticcling': - if (preg_match("/invalid ip/i", $data)) { - $status = "Dynamic DNS ({$this->_dnsHost}): (Error) Bad Request - The IP provided was invalid."; - } elseif (preg_match('/required info missing/i', $data)) { - $status = "Dynamic DNS ({$this->_dnsHost}): (Error) Bad Request - Required parameters were not provided."; - } elseif (preg_match('/invalid characters/i', $data)) { - $status = "Dynamic DNS ({$this->_dnsHost}): (Error) Bad Request - Illegal characters in either the username or the password."; - } elseif (preg_match('/bad password/i', $data)) { - $status = "Dynamic DNS ({$this->_dnsHost}): (Error) Invalid password."; - } elseif (preg_match('/account locked/i', $data)) { - $status = "Dynamic DNS ({$this->_dnsHost}): (Error) This account has been administratively locked."; - } elseif (preg_match('/update too frequent/i', $data)) { - $status = "Dynamic DNS ({$this->_dnsHost}): (Error) Updating too frequently."; - } elseif (preg_match('/DB error/i', $data)) { - $status = "Dynamic DNS ({$this->_dnsHost}): (Error) Server side error."; - } elseif (preg_match('/success/i', $data)) { - $status = "Dynamic DNS ({$this->_dnsHost}): (Success) IP Address Updated Successfully!"; - $successful_update = true; - } else { - $status = "Dynamic DNS ({$this->_dnsHost}): (Unknown Response)"; - log_error("Dynamic DNS ({$this->_dnsHost}): PAYLOAD: {$data}"); - $this->_debug("Unknown Response: " . $data); - } - break; - case 'namecheap': - /* technically this is wrong but proves a point about the document being broken remotely */ - $tmp = preg_replace('/(\<\?xml[^?]+?encoding=.?)utf-16([^?]+?\?\>)/i', '$1utf-8$2', $data); - $ncresponse = simplexml_load_string($tmp); - if (preg_match("/internal server error/i", $data)) { - $status = "Dynamic DNS: (Error) Server side error."; - } elseif (preg_match("/request is badly formed/i", $data)) { - $status = "Dynamic DNS: (Error) Badly Formed Request (check your settings)."; - } elseif ((string)$ncresponse->ErrCount === "0") { - $status = "Dynamic DNS: (Success) IP Address Updated Successfully!"; - $successful_update = true; - } elseif (isset($ncresponse->ErrCount) && is_numeric((string)$ncresponse->ErrCount) && (string)$ncresponse->ErrCount > 0) { - $status = "Dynamic DNS: (Error) "; - if (isset($ncresponse->errors)) { - foreach ($ncresponse->errors->children() as $err) { - $status .= (string)$err . " "; - } - } - $successful_update = true; - } else { - $status = "Dynamic DNS: (Unknown Response)"; - log_error("Dynamic DNS ({$this->_dnsHost}): PAYLOAD: {$data}"); - $this->_debug("Unknown Response: " . $data); - } - break; - case 'route53': - case 'route53-v6': - $successful_update = true; - break; - case 'custom': - case 'custom-v6': - $successful_update = false; - if ($this->_dnsResultMatch == "") { - $successful_update = true; - } else { - $this->_dnsResultMatch = str_replace("%IP%", $this->_dnsIP, $this->_dnsResultMatch); - $matches = preg_split("/(?_dnsResultMatch); - foreach ($matches as $match) { - $match = str_replace("\\|", "|", $match); - if (strcmp($match, trim($data, "\t\n\r")) == 0) { - $successful_update = true; - } - } - unset($matches); - } - if ($successful_update == true) { - $status = "Dynamic DNS: (Success) IP Address Updated Successfully!"; - } else { - $status = "Dynamic DNS: (Error) Result did not match."; - log_error("Dynamic DNS ({$this->_dnsHost}): PAYLOAD: {$data}"); - $this->_debug("Unknown Response: " . $data); - } - break; - case 'cloudflare': - case 'cloudflare-v6': - case 'cloudflare-token': - case 'cloudflare-token-v6': - $output = json_decode($data); - if ($output->result->content === $this->_dnsIP) { - $status = "Dynamic DNS: (Success) {$this->_dnsHost} updated to {$this->_dnsIP}"; - $successful_update = true; - } elseif ($output->errors[0]->code === 9103) { - $status = "Dynamic DNS ({$this->_dnsHost}): ERROR - Invalid Credentials! Don't forget to use API Key for password field with Cloudflare."; - } elseif (($output->success) && (!$output->result[0]->id)) { - $status = "Dynamic DNS ({$this->_dnsHost}): ERROR - Zone ID was not found."; - } else { - $status = "Dynamic DNS ({$this->_dnsHost}): UNKNOWN ERROR - {$output->errors[0]->message}"; - log_error("Dynamic DNS ({$this->_dnsHost}): PAYLOAD: {$data}"); - $this->_debug("Unknown Response: " . $data); - } - break; - case 'hetzner': - case 'hetzner-v6': - $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); - $output = json_decode($data); - if ($output->record->value === $this->_dnsIP) { - $status = "Dynamic DNS: (Success) {$this->_dnsHost} updated to {$this->_dnsIP}"; - $successful_update = true; - } elseif ($http_code == 401) { - $status = 'Dynamic DNS: (Error) Bad authentication attempt because of a wrong API Key.'; - } elseif ($http_code == 403) { - $status = 'Dynamic DNS: (Error) Access to the resource is denied. Mainly due to a lack of permissions to access it!'; - } else { - $status = 'Dynamic DNS: (Error) "Unknown Response"'; - log_error("Dynamic DNS ({$this->_dnsHost}): PAYLOAD: {$data}"); - $this->_debug("Unknown Response: " . $data); - } - 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}"; - $successful_update = true; - } else { - $status = "Dynamic DNS Record ID ({$this->_dnsUser}): UNKNOWN ERROR"; - log_error("Dynamic DNS ({$this->_dnsHost}): PAYLOAD: {$data}"); - $this->_debug("Unknown Response: " . $data); - } - break; - case 'gandi-livedns': - $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); - if ($http_code == 401) { - $status = 'Dynamic DNS: (Error) Bad authentication attempt because of a wrong API Key.'; - } elseif ($http_code == 403) { - $status = 'Dynamic DNS: (Error) Access to the resource is denied. Mainly due to a lack of permissions to access it!'; - } elseif ($http_code == 201) { - $status = 'Dynamic DNS: (Success) Record was created!'; - $successful_update = true; - } elseif ($http_code == 200) { - $status = 'Dynamic DNS: (Success) Same record already exists. Nothing was changed!'; - $successful_update = true; - } else { - $status = 'Dynamic DNS: (Error) "Unknown Response"'; - log_error("Dynamic DNS: HTTP Status: {$http_code} PAYLOAD: {$data}"); - $this->_debug("Unknown HTTP status: " . $http_code); - } - break; - case 'gratisdns': - if (preg_match('/Forkerte værdier/i', $data)) { - $status = "Dynamic DNS: (Error) Wrong values - Update could not be completed."; - } elseif (preg_match('/Bruger login: Bruger eksistere ikke/i', $data)) { - $status = "Dynamic DNS: (Error) Unknown username - User does not exist."; - } elseif (preg_match('/Bruger login: 1Fejl i kodeord/i', $data)) { - $status = "Dynamic DNS: (Error) Wrong password - Remember password is case sensitive."; - } elseif (preg_match('/Domæne kan IKKE administreres af bruger/i', $data)) { - $status = "Dynamic DNS: (Error) User unable to administer the selected domain."; - } elseif (preg_match('/OK/i', $data)) { - $status = "Dynamic DNS: (Success) IP Address Updated Successfully!"; - $successful_update = true; - } else { - $status = "Dynamic DNS: (Unknown Response)"; - log_error("Dynamic DNS ({$this->_dnsHost}): PAYLOAD: {$data}"); - $this->_debug("Unknown Response: " . $data); - } - break; - case 'duckdns': - if (preg_match('/OK/i', $data)) { - $status = "Dynamic DNS: (Success) IP Address Updated Successfully!"; - $successful_update = true; - } else { - $status = "Dynamic DNS: (Unknown Response)"; - log_error("Dynamic DNS ({$this->_dnsHost}): PAYLOAD: {$data}"); - $this->_debug("Unknown Response: " . $data); - } - break; - case 'dynv6': - case 'dynv6-v6': - /* API-Documentation: https://dynv6.com/docs/apis */ - if (preg_match('/addresses updated/i', $data)) { - $status = "Dynamic DNS: (Success) IP Address Updated Successfully!"; - $successful_update = true; - } elseif (preg_match('/addresses unchanged/i', $data)) { - $status = "Dynamic DNS: (Success) IP Address Unchanged!"; - $successful_update = true; - } else { - $status = "Dynamic DNS: (Unknown Response)"; - log_error("Dynamic DNS ({$this->_dnsHost}): PAYLOAD: {$data}"); - $this->_debug("Unknown Response: " . $data); - } - break; - case '1984-hosting': - $output = json_decode($data); - if ($output === null) { - $status = "Dynamic DNS ({$this->_dnsHost}): ERROR - empty response."; - } elseif ($output->ok === true) { - $status = "Dynamic DNS: (Success) {$this->_dnsHost} updated to {$this->_dnsIP}"; - $successful_update = true; - } elseif ($output->error) { - $status = "Dynamic DNS ({$this->_dnsHost}): ERROR - Invalid Credentials! Don't forget to use API Key for password field with 1984 Hosting Company."; - } elseif ($output->lookup) { - $status = "Dynamic DNS ({$this->_dnsHost}): ERROR - Zone ID was not found."; - } else { - $status = "Dynamic DNS ({$this->_dnsHost}): UNKNOWN ERROR - {$output->errors[0]->message}"; - log_error("Dynamic DNS ({$this->_dnsHost}): PAYLOAD: {$data}"); - $this->_debug("Unknown Response: " . $data); - } - break; - case '3322': - case 'citynetwork': - case 'dnsomatic': - case 'dyndns': - case 'dyndns-custom': - case 'dyndns-static': - case 'eurodns': - case 'googledomains': - case 'he-net': - case 'he-net-tunnelbroker': - case 'he-net-v6': - case 'loopia': - case 'oray': - case 'ovh-dynhost': - case 'selfhost': - case 'strato': - case 'strato-v6': - if (preg_match('/notfqdn/i', $data)) { - $status = "Dynamic DNS: (Error) Not a FQDN"; - } elseif (preg_match('/nochg/i', $data)) { - $status = "Dynamic DNS: (Success) No change in IP address"; - $successful_update = true; - } elseif (preg_match('/good/i', $data)) { - $status = "Dynamic DNS: (Success) IP address updated successfully ({$this->_dnsIP})"; - $successful_update = true; - } elseif (preg_match('/badauth/i', $data)) { - $status = "Dynamic DNS: (Error) Authentication failed"; - } elseif (preg_match("/badip/i", $data)) { - $status = "Dynamic DNS: (Error) IP address provided is invalid"; - } elseif (preg_match('/nohost/i', $data)) { - $status = "Dynamic DNS: (Error) Hostname does not exist or does not have dynamic DNS enabled"; - } elseif (preg_match('/numhost/i', $data)) { - $status = "Dynamic DNS: (Error) You may update up to 20 hosts only"; - } elseif (preg_match('/dnserr/i', $data)) { - $status = "Dynamic DNS: (Error) DNS error, stop updating for 30 minutes."; - } elseif (preg_match('/badagent/i', $data)) { - $status = "Dynamic DNS: (Error) Bad request"; - } elseif (preg_match('/abuse/i', $data)) { - $status = "Dynamic DNS: (Error) Access has been blocked for abuse"; - } elseif (preg_match('/911/i', $data)) { - $status = "Dynamic DNS: (Error) Server-side error or maintenance"; - } elseif (preg_match('/yours/i', $data)) { - $status = "Dynamic DNS: (Error) Specified hostname does not exist under this username"; - } else { - $status = "Dynamic DNS: (Unknown Response)"; - log_error("Dynamic DNS ({$this->_dnsHost}): PAYLOAD: {$data}"); - $this->_debug("Unknown Response: " . $data); - } - break; - case 'regfish': - case 'regfish-v6': - if (preg_match('/\|100\|/', $data)) { - $status = 'Dynamic DNS: (Success) Update successful'; - $successful_update = true; - } elseif (preg_match('/\|101\|/', $data)) { - $status = 'Dynamic DNS: (Success) Still up-to-date'; - $successful_update = true; - } elseif (preg_match('/\|401\|/', $data)) { - $status = 'Dynamic DNS: (Error) Standard authentication failed'; - } elseif (preg_match('/\|402\|/', $data)) { - $status = 'Dynamic DNS: (Error) Authentication failed'; - } elseif (preg_match('/\|406\|/', $data)) { - $status = 'Dynamic DNS: (Error) Invalid resource record'; - } elseif (preg_match('/\|407\|/', $data)) { - $status = 'Dynamic DNS: (Error) Invalid TTL range'; - } elseif (preg_match('/\|408\|/', $data)) { - $status = 'Dynamic DNS: (Error) Invalid IPv4'; - } elseif (preg_match('/\|409\|/', $data)) { - $status = 'Dynamic DNS: (Error) Invalid IPv6'; - } elseif (preg_match('/\|410\|/', $data)) { - $status = 'Dynamic DNS: (Error) Unknown authentication type'; - } elseif (preg_match('/\|412\|/', $data)) { - $status = 'Dynamic DNS: (Error) Domain format is wrong, missing trailing dot?'; - } elseif (preg_match('/\|414\|/', $data)) { - $status = 'Dynamic DNS: (Error) Unexpected error'; - } elseif (preg_match('/\|415\|/', $data)) { - $status = 'Dynamic DNS: (Error) Cannot update load balancer'; - } else { - $status = "Dynamic DNS: (Unknown Response)"; - log_error("Dynamic DNS ({$this->_dnsHost}): PAYLOAD: {$data}"); - $this->_debug("Unknown Response: " . $data); - } - case 'linode': - case 'linode-v6': - $fqdn = trim($this->_dnsHost); - if ($this->_dnsWildcard == 'ON') { - $fqdn = "*.$fqdn"; - } - - $output = json_decode($data); - if ($output->target === $this->_dnsIP) { - $status = "Dynamic DNS: (Success) $fqdn updated to {$this->_dnsIP}"; - $successful_update = true; - } elseif (!empty($output->errors)) { - $status = "Dynamic DNS ($fqdn): ERROR - Reason: {$output->errors[0]->reason}"; - } else { - $status = "Dynamic DNS ($fqdn): UNKNOWN ERROR"; - log_error("Dynamic DNS ($fqdn): PAYLOAD: {$data}"); - $this->_debug("Unknown Response: " . $data); - } - break; - case 'azure': - case 'azurev6': - $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); - if ($http_code == 401) { - $status = 'Dynamic DNS: (Error) User Authorization Failed'; - } elseif ($http_code == 201) { - $status = 'Dynamic DNS: (Success) IP Address Changed Successfully!'; - $successful_update = true; - } elseif ($http_code == 200) { - $status = 'Dynamic DNS: (Success) IP Address Changed Successfully!'; - $successful_update = true; - } else { - $status = 'Dynamic DNS: (Error) "Unknown Response"'; - log_error("Dynamic DNS: HTTP status: {$http_code} PAYLOAD: {$data}"); - $this->_debug("Unknown HTTP status: " . $http_code); - } - break; - case 'all-inkl': - case 'all-inkl-v6': - $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); - if (preg_match('/good\s' . $this->_dnsIP . '/i', $data)) { - $status = "Dynamic DNS: (Success) IP Update Successfully!"; - $successful_update = true; - } elseif ($http_code == 401) { - $status = "Dynamic DNS: (Error) Authentication failed!"; - } elseif (preg_match('/bad\s\(dyndns_target_ip_syntax_incorrect\)/i', $data)) { - $status = "Dynamic DNS: (Error) IP Syntax incorrect ($this->_dnsIP)!"; - } else { - $status = "Dynamic DNS ({$this->_dnsHost}): (Unknown Response)"; - log_error("Dynamic DNS ({$this->_dnsHost}): PAYLOAD: {$data}"); - $this->_debug("Unknown Response: " . $data); - } - break; - case 'godaddy': - case 'godaddy-v6': - /* See https://developer.godaddy.com/ for API documentation, not all codes are handled. */ - $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); - $successful_update = false; - if ($http_code == 200) { - $status = 'Dynamic DNS: (Success) IP Address Updated Successfully!'; - $successful_update = true; - } elseif ($http_code == 401) { - $status = 'Dynamic DNS: (Error) Authentication info not sent or invalid'; - } elseif ($http_code == 404) { - $status = 'Dynamic DNS: (Error) Resource not found'; - } else { - $status = "Dynamic DNS: (Error) Repsonse not handled check the following: {$data}"; - log_error("Dynamic DNS: HTTP status: {$http_code} PAYLOAD: {$data}"); - $this->_debug("Unknown HTTP status: " . $http_code); - } - break; - case 'desec': - case 'desec-v4-v6': - case 'desec-v6': - $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); - /* - * HTTP Code 404 should not be possible due to dnsUser == dnsHost, a wrong hostname should cause HTTP 401 Unauthorized. - */ - if ($http_code == 401) { - $status = 'Dynamic DNS: (Error) Bad authentication attempt because of a wrong Password.'; - } elseif ($http_code == 403) { - $status = 'Dynamic DNS: (Error) Access to the resource is denied. The selected hostname is not eligible for dynamic updates.'; - } elseif ($http_code == 429) { - $status = 'Dynamic DNS: (Error) Rate limit reached. Please don\'t try more than one request per minute.'; - } elseif ($http_code == 200 && preg_match('/good/i', $data)) { - $status = 'Dynamic DNS: (Success) IP Address Updated Successfully!'; - $successful_update = true; - } else { - $status = "Dynamic DNS: (Error) Repsonse not handled check the following: {$data}"; - log_error("Dynamic DNS: HTTP status: {$http_code} PAYLOAD: {$data}"); - $this->_debug("Unknown HTTP status: " . $http_code); - } - break; - default: - break; - } - - if ($successful_update == true) { - /* Write WAN IP to cache file */ - $wan_ip = $this->_checkIP(); - if ($this->_useIPv6 == false && $wan_ip > 0) { - $currentTime = time(); - log_error("Dynamic DNS: updating cache file {$this->_cacheFile}: {$wan_ip}"); - @file_put_contents($this->_cacheFile, "{$wan_ip}|{$currentTime}"); - } else { - @unlink($this->_cacheFile); - } - if ($this->_useIPv6 == true && $wan_ip > 0) { - $currentTime = time(); - log_error("Dynamic DNS: updating cache file {$this->_cacheFile_v6}: {$wan_ip}"); - @file_put_contents($this->_cacheFile_v6, "{$wan_ip}|{$currentTime}"); - } else { - @unlink($this->_cacheFile_v6); - } - } - $this->status = $status; - log_error($status); - } - - /* - * Private Function (added 12 July 05) [beta] - * Return Error, Set Last Error, and Die. - */ - function _error($errorNumber = '1') - { - switch ($errorNumber) { - case 0: - break; - case 2: - $error = 'Dynamic DNS: (ERROR!) No Dynamic DNS Service provider was selected.'; - break; - case 3: - $error = 'Dynamic DNS: (ERROR!) No Username Provided.'; - break; - case 4: - $error = 'Dynamic DNS: (ERROR!) No Password Provided.'; - break; - case 5: - $error = 'Dynamic DNS: (ERROR!) No Hostname Provided.'; - break; - case 6: - $error = 'Dynamic DNS: (ERROR!) The Dynamic DNS Service provided is not yet supported.'; - break; - case 7: - $error = 'Dynamic DNS: (ERROR!) No Update URL Provided.'; - break; - case 8: - $status = "Route 53: (Error) Invalid ZoneID"; - break; - case 9: - $status = "Route 53: (Error) Invalid TTL"; - break; - case 10: - $error = "Dynamic DNS ({$this->_dnsHost}): No change in my IP address and/or " . $this->_dnsMaxCacheAgeDays . " days has not passed. Not updating dynamic DNS entry."; - break; - default: - $error = "Dynamic DNS: (ERROR!) Unknown Response."; - /* FIXME: $data isn't in scope here */ - /* $this->_debug($data); */ - break; - } - $this->lastError = $error; - log_error($error); - } - - /* - * Private Function (added 12 July 05) [beta] - * - Detect whether or not IP needs to be updated. - * | Written Specifically for pfSense (https://www.pfsense.org) may - * | work with other systems. pfSense base is FreeBSD. - */ - function _detectChange() - { - $currentTime = time(); - - $wan_ip = $this->_checkIP(); - if ($wan_ip == 0) { - log_error("Dynamic DNS ({$this->_dnsHost}): Current WAN IP could not be determined, skipping update process."); - return false; - } - $log_error = "Dynamic DNS ({$this->_dnsHost}): Current WAN IP: {$wan_ip} "; - - if ($this->_useIPv6 == true) { - if (file_exists($this->_cacheFile_v6)) { - $contents = file_get_contents($this->_cacheFile_v6); - list($cacheIP,$cacheTime) = explode('|', $contents); - $this->_debug($cacheIP . '/' . $cacheTime); - $initial = false; - $log_error .= "Cached IPv6: {$cacheIP} "; - } else { - $cacheIP = '::'; - @file_put_contents($this->_cacheFile, "::|{$currentTime}"); - $cacheTime = $currentTime; - $initial = true; - $log_error .= "No Cached IPv6 found."; - } - } else { - if (file_exists($this->_cacheFile)) { - $contents = file_get_contents($this->_cacheFile); - list($cacheIP,$cacheTime) = explode('|', $contents); - $this->_debug($cacheIP . '/' . $cacheTime); - $initial = false; - $log_error .= "Cached IP: {$cacheIP} "; - } else { - $cacheIP = '0.0.0.0'; - @file_put_contents($this->_cacheFile, "0.0.0.0|{$currentTime}"); - $cacheTime = $currentTime; - $initial = true; - $log_error .= "No Cached IP found."; - } - } - if ($this->_dnsVerboseLog) { - log_error($log_error); - } - - // Convert seconds = days * hr/day * min/hr * sec/min - $maxCacheAgeSecs = $this->_dnsMaxCacheAgeDays * 24 * 60 * 60; - - $needs_updating = false; - /* lets determine if the item needs updating */ - if ($cacheIP != $wan_ip) { - $needs_updating = true; - $update_reason = "Dynamic DNS: cacheIP != wan_ip. Updating. "; - $update_reason .= "Cached IP: {$cacheIP} WAN IP: {$wan_ip} "; - } - if (($currentTime - $cacheTime) > $maxCacheAgeSecs) { - $needs_updating = true; - $this->_forceUpdateNeeded = true; - $update_reason = "Dynamic DNS: More than " . $this->_dnsMaxCacheAgeDays . " days. Updating. "; - $update_reason .= "{$currentTime} - {$cacheTime} > {$maxCacheAgeSecs} "; - } - if ($initial == true) { - $needs_updating = true; - $update_reason .= "Initial update. "; - } - - /* finally if we need updating then store the - * new cache value and return true - */ - if ($needs_updating == true) { - if ($this->_dnsVerboseLog) { - log_error("Dynamic DNS ({$this->_dnsHost}): {$update_reason}"); - } - return true; - } - - return false; - } - - /* - * Private Function (added 16 July 05) [beta] - * - Writes debug information to a file. - * - This function is only called when a unknown response - * - status is returned from a dynamic DNS service provider. - */ - function _debug($data) - { - $string = date('m-d-y h:i:s') . ' - (' . $this->_debugID . ') - [' . $this->_dnsService . '] - ' . $data . "\n"; - $file = fopen($this->_debugFile, 'a'); - fwrite($file, $string); - fclose($file); - } - - function _checkIP() - { - $ip_address = get_dyndns_ip_address($this->_if, $this->_useIPv6 ? 6 : 4); - if (!is_ipaddr($ip_address)) { - if ($this->_dnsVerboseLog) { - log_error("Dynamic DNS ({$this->_dnsHost}): IP address could not be extracted"); - } - - $ip_address = 0; - } else { - if ($this->_dnsVerboseLog) { - log_error("Dynamic DNS ({$this->_dnsHost}): {$ip_address} extracted"); - } - - $this->_dnsIP = $ip_address; - } - - return $ip_address; - } -} diff --git a/dns/dyndns/src/etc/inc/plugins.inc.d/dyndns/r53.inc b/dns/dyndns/src/etc/inc/plugins.inc.d/dyndns/r53.inc deleted file mode 100644 index 46a83a380..000000000 --- a/dns/dyndns/src/etc/inc/plugins.inc.d/dyndns/r53.inc +++ /dev/null @@ -1,777 +0,0 @@ -__accessKey; - } - public function getSecretKey() - { - return $this->__secretKey; - } - public function getHost() - { - return $this->__host; - } - - protected $__verifyHost = 1; - protected $__verifyPeer = 1; - - // verifyHost and verifyPeer determine whether curl verifies ssl certificates. - // It may be necessary to disable these checks on certain systems. - // These only have an effect if SSL is enabled. - public function verifyHost() - { - return $this->__verifyHost; - } - public function enableVerifyHost($enable = true) - { - $this->__verifyHost = $enable; - } - - public function verifyPeer() - { - return $this->__verifyPeer; - } - public function enableVerifyPeer($enable = true) - { - $this->__verifyPeer = $enable; - } - - /** - * Constructor - * - * @param string $accessKey Access key - * @param string $secretKey Secret key - * @return void - */ - public function __construct($accessKey = null, $secretKey = null, $host = 'route53.amazonaws.com') - { - if ($accessKey !== null && $secretKey !== null) { - $this->setAuth($accessKey, $secretKey); - } - $this->__host = $host; - } - - /** - * Set AWS access key and secret key - * - * @param string $accessKey Access key - * @param string $secretKey Secret key - * @return void - */ - public function setAuth($accessKey, $secretKey) - { - $this->__accessKey = $accessKey; - $this->__secretKey = $secretKey; - } - - /** - * Lists the hosted zones on the account - * - * @param string marker A pagination marker returned by a previous truncated call - * @param int maxItems The maximum number of items per page. The service uses min($maxItems, 100). - * @return A list of hosted zones - */ - public function listHostedZones($marker = null, $maxItems = 100) - { - $rest = new Route53Request($this, 'hostedzone', 'GET'); - - if ($marker !== null) { - $rest->setParameter('marker', $marker); - } - if ($maxItems !== 100) { - $rest->setParameter('maxitems', $maxItems); - } - - $rest = $rest->getResponse(); - if ($rest->error === false && $rest->code !== 200) { - $rest->error = array('code' => $rest->code, 'message' => 'Unexpected HTTP status'); - } - if ($rest->error !== false) { - $this->__triggerError('listHostedZones', $rest->error); - return false; - } - - $response = array(); - if (!isset($rest->body)) { - return $response; - } - - $zones = array(); - foreach ($rest->body->HostedZones->HostedZone as $z) { - $zones[] = $this->parseHostedZone($z); - } - $response['HostedZone'] = $zones; - - if (isset($rest->body->MaxItems)) { - $response['MaxItems'] = (string)$rest->body->MaxItems; - } - - if (isset($rest->body->IsTruncated)) { - $response['IsTruncated'] = (string)$rest->body->IsTruncated; - if ($response['IsTruncated'] == 'true') { - $response['NextMarker'] = (string)$rest->body->NextMarker; - } - } - - return $response; - } - - /** - * Retrieves information on a specified hosted zone - * - * @param string zoneId The id of the hosted zone, as returned by CreateHostedZoneResponse or ListHostedZoneResponse - * In other words, if ListHostedZoneResponse shows the zone's Id as '/hostedzone/Z1PA6795UKMFR9', - * then that full value should be passed here, including the '/hostedzone/' prefix. - * @return A data structure containing information about the specified zone - */ - public function getHostedZone($zoneId) - { - // we'll strip off the leading forward slash, so we can use it as the action directly. - $zoneId = trim($zoneId, '/'); - - $rest = new Route53Request($this, $zoneId, 'GET'); - - $rest = $rest->getResponse(); - if ($rest->error === false && $rest->code !== 200) { - $rest->error = array('code' => $rest->code, 'message' => 'Unexpected HTTP status'); - } - if ($rest->error !== false) { - $this->__triggerError('getHostedZone', $rest->error); - return false; - } - - $response = array(); - if (!isset($rest->body)) { - return $response; - } - - $response['HostedZone'] = $this->parseHostedZone($rest->body->HostedZone); - $response['NameServers'] = $this->parseDelegationSet($rest->body->DelegationSet); - - return $response; - } - - /** - * Creates a new hosted zone - * - * @param string name The name of the hosted zone (e.g. "example.com.") - * @param string reference A user-specified unique reference for this request - * @param string comment An optional user-specified comment to attach to the zone - * @return A data structure containing information about the newly created zone - */ - public function createHostedZone($name, $reference, $comment = '') - { - // hosted zone names must end with a period, but people will forget this a lot... - if (strrpos($name, '.') != (strlen($name) - 1)) { - $name .= '.'; - } - - $data = "\n"; - $data .= '\n"; - $data .= '' . $name . "\n"; - $data .= '' . $reference . "\n"; - if (strlen($comment) > 0) { - $data .= "\n"; - $data .= '' . $comment . "\n"; - $data .= "\n"; - } - $data .= "\n"; - - $rest = new Route53Request($this, 'hostedzone', 'POST', $data); - - $rest = $rest->getResponse(); - - if ($rest->error === false && !in_array($rest->code, array(200, 201, 202, 204))) { - $rest->error = array('code' => $rest->code, 'message' => 'Unexpected HTTP status'); - } - if ($rest->error !== false) { - $this->__triggerError('createHostedZone', $rest->error); - return false; - } - - $response = array(); - if (!isset($rest->body)) { - return $response; - } - - $response['HostedZone'] = $this->parseHostedZone($rest->body->HostedZone); - $response['ChangeInfo'] = $this->parseChangeInfo($rest->body->ChangeInfo); - $response['NameServers'] = $this->parseDelegationSet($rest->body->DelegationSet); - - return $response; - } - - /** - * Retrieves information on a specified hosted zone - * - * @param string zoneId The id of the hosted zone, as returned by CreateHostedZoneResponse or ListHostedZoneResponse - * In other words, if ListHostedZoneResponse shows the zone's Id as '/hostedzone/Z1PA6795UKMFR9', - * then that full value should be passed here, including the '/hostedzone/' prefix. - * @return The change request data corresponding to this delete - */ - public function deleteHostedZone($zoneId) - { - // we'll strip off the leading forward slash, so we can use it as the action directly. - $zoneId = trim($zoneId, '/'); - - $rest = new Route53Request($this, $zoneId, 'DELETE'); - - $rest = $rest->getResponse(); - if ($rest->error === false && $rest->code !== 200) { - $rest->error = array('code' => $rest->code, 'message' => 'Unexpected HTTP status'); - } - if ($rest->error !== false) { - $this->__triggerError('deleteHostedZone', $rest->error); - return false; - } - - if (!isset($rest->body)) { - return array(); - } - - return $this->parseChangeInfo($rest->body->ChangeInfo); - } - - /** - * Retrieves a list of resource record sets for a given zone - * - * @param string zoneId The id of the hosted zone, as returned by CreateHostedZoneResponse or ListHostedZoneResponse - * In other words, if ListHostedZoneResponse shows the zone's Id as '/hostedzone/Z1PA6795UKMFR9', - * then that full value should be passed here, including the '/hostedzone/' prefix. - * @param string type The type of resource record set to begin listing from. If this is specified, $name must also be specified. - * Must be one of: A, AAAA, CNAME, MX, NS, PTR, SOA, SPF, SRV, TXT - * @param string name The name at which to begin listing resource records (in the lexographic order of records). - * @param int maxItems The maximum number of results to return. The service uses min($maxItems, 100). - * @return The list of matching resource record sets - */ - public function listResourceRecordSets($zoneId, $type = '', $name = '', $maxItems = 100) - { - // we'll strip off the leading forward slash, so we can use it as the action directly. - $zoneId = trim($zoneId, '/'); - - $rest = new Route53Request($this, $zoneId . '/rrset', 'GET'); - - if (strlen($type) > 0) { - $rest->setParameter('type', $type); - } - if (strlen($name) > 0) { - $rest->setParameter('name', $name); - } - if ($maxItems != 100) { - $rest->setParameter('maxitems', $maxItems); - } - - $rest = $rest->getResponse(); - if ($rest->error === false && $rest->code !== 200) { - $rest->error = array('code' => $rest->code, 'message' => 'Unexpected HTTP status'); - } - if ($rest->error !== false) { - $this->__triggerError('listResourceRecordSets', $rest->error); - return false; - } - - $response = array(); - if (!isset($rest->body)) { - return $response; - } - - $recordSets = array(); - foreach ($rest->body->ResourceRecordSets->ResourceRecordSet as $set) { - $recordSets[] = $this->parseResourceRecordSet($set); - } - - $response['ResourceRecordSets'] = $recordSets; - - if (isset($rest->body->MaxItems)) { - $response['MaxItems'] = (string)$rest->body->MaxItems; - } - - if (isset($rest->body->IsTruncated)) { - $response['IsTruncated'] = (string)$rest->body->IsTruncated; - if ($response['IsTruncated'] == 'true') { - $response['NextRecordName'] = (string)$rest->body->NextRecordName; - $response['NextRecordType'] = (string)$rest->body->NextRecordType; - } - } - - return $response; - } - - /** - * Makes the specified resource record set changes (create or delete). - * - * @param string zoneId The id of the hosted zone, as returned by CreateHostedZoneResponse or ListHostedZoneResponse - * In other words, if ListHostedZoneResponse shows the zone's Id as '/hostedzone/Z1PA6795UKMFR9', - * then that full value should be passed here, including the '/hostedzone/' prefix. - * @param array changes An array of change objects, as they are returned by the prepareChange utility method. - * You may also pass a single change object. - * @param string comment An optional comment to attach to the change request - * @return The status of the change request - */ - public function changeResourceRecordSets($zoneId, $changes, $comment = '') - { - // we'll strip off the leading forward slash, so we can use it as the action directly. - $zoneId = trim($zoneId, '/'); - - $data = "\n"; - $data .= '\n"; - $data .= "\n"; - - if (strlen($comment) > 0) { - $data .= '' . $comment . "\n"; - } - - if (!is_array($changes)) { - $changes = array($changes); - } - - $data .= "\n"; - foreach ($changes as $change) { - $data .= $change; - } - $data .= "\n"; - - $data .= "\n"; - $data .= "\n"; - - $rest = new Route53Request($this, $zoneId . '/rrset', 'POST', $data); - - $rest = $rest->getResponse(); - if ($rest->error === false && !in_array($rest->code, array(200, 201, 202, 204))) { - $rest->error = array('code' => $rest->code, 'message' => 'Unexpected HTTP status'); - } - if ($rest->error !== false) { - $this->__triggerError('changeResourceRecordSets', $rest->error); - return false; - } - - if (!isset($rest->body)) { - return array(); - } - - return $this->parseChangeInfo($rest->body->ChangeInfo); - } - - /** - * Retrieves information on a specified change request - * - * @param string changeId The id of the change, as returned by CreateHostedZoneResponse or ChangeResourceRecordSets - * In other words, if CreateHostedZoneResponse showed the change's Id as '/change/C2682N5HXP0BZ4', - * then that full value should be passed here, including the '/change/' prefix. - * @return The status of the change request - */ - public function getChange($changeId) - { - // we'll strip off the leading forward slash, so we can use it as the action directly. - $zoneId = trim($changeId, '/'); - - $rest = new Route53Request($this, $changeId, 'GET'); - - $rest = $rest->getResponse(); - if ($rest->error === false && $rest->code !== 200) { - $rest->error = array('code' => $rest->code, 'message' => 'Unexpected HTTP status'); - } - if ($rest->error !== false) { - $this->__triggerError('getChange', $rest->error); - return false; - } - - if (!isset($rest->body)) { - return array(); - } - - return $this->parseChangeInfo($rest->body->ChangeInfo); - } - - - - /** - * Utility function to parse a HostedZone tag structure - */ - private function parseHostedZone($tag) - { - $zone = array(); - $zone['Id'] = (string)$tag->Id; - $zone['Name'] = (string)$tag->Name; - $zone['CallerReference'] = (string)$tag->CallerReference; - - // these might always be set, but check just in case, since - // their values are option on CreateHostedZone requests - if (isset($tag->Config) && isset($tag->Config->Comment)) { - $zone['Config'] = array('Comment' => (string)$tag->Config->Comment); - } - - return $zone; - } - - /** - * Utility function to parse a ChangeInfo tag structure - */ - private function parseChangeInfo($tag) - { - $info = array(); - $info['Id'] = (string)$tag->Id; - $info['Status'] = (string)$tag->Status; - $info['SubmittedAt'] = (string)$tag->SubmittedAt; - return $info; - } - - /** - * Utility function to parse a DelegationSet tag structure - */ - private function parseDelegationSet($tag) - { - $servers = array(); - foreach ($tag->NameServers->NameServer as $ns) { - $servers[] = (string)$ns; - } - return $servers; - } - - /** - * Utility function to parse a ResourceRecordSet tag structure - */ - private function parseResourceRecordSet($tag) - { - $rrs = array(); - $rrs['Name'] = (string)$tag->Name; - $rrs['Type'] = (string)$tag->Type; - $rrs['TTL'] = (string)$tag->TTL; - $rrs['ResourceRecords'] = array(); - foreach ($tag->ResourceRecords->ResourceRecord as $rr) { - $rrs['ResourceRecords'][] = (string)$rr->Value; - } - return $rrs; - } - - /** - * Utility function to prepare a Change object for ChangeResourceRecordSets requests. - * All fields are required. - * - * @param string action The action to perform. One of: CREATE, DELETE - * @param string name The name to perform the action on. - * If it does not end with '.', then AWS treats the name as relative to the zone root. - * @param string type The type of record being modified. - * Must be one of: A, AAAA, CNAME, MX, NS, PTR, SOA, SPF, SRV, TXT - * @param int ttl The time-to-live value for this record, in seconds. - * @param array records An array of resource records to attach to this change. - * Each member of this array can either be a string, or an array of strings. - * Passing an array of strings will attach multiple values to a single resource record. - * If a single string is passed as $records instead of an array, - * it will be treated as a single-member array. - * @return object An opaque object containing the change request. - * Do not write code that depends on the contents of this object, as it may change at any time. - */ - public function prepareChange($action, $name, $type, $ttl, $records) - { - $change = "\n"; - $change .= '' . $action . "\n"; - $change .= "\n"; - $change .= '' . $name . "\n"; - $change .= '' . $type . "\n"; - $change .= '' . $ttl . "\n"; - $change .= "\n"; - - if (!is_array($records)) { - $records = array($records); - } - - foreach ($records as $record) { - $change .= "\n"; - if (is_array($record)) { - foreach ($record as $value) { - $change .= '' . $value . "\n"; - } - } else { - $change .= '' . $record . "\n"; - } - $change .= "\n"; - } - - $change .= "\n"; - $change .= "\n"; - $change .= "\n"; - - return $change; - } - - /** - * Trigger an error message - * - * @internal Used by member functions to output errors - * @param array $error Array containing error information - * @return string - */ - public function __triggerError($functionname, $error) - { - if ($error == false) { - log_error(sprintf("Route53::%s(): Encountered an error, but no description given", $functionname)); - } elseif (isset($error['curl']) && $error['curl']) { - log_error(sprintf("Route53::%s(): %s %s", $functionname, $error['code'], $error['message'])); - } elseif (isset($error['Error'])) { - $e = $error['Error']; - $message = sprintf("Route53::%s(): %s - %s: %s\nRequest Id: %s\n", $functionname, $e['Type'], $e['Code'], $e['Message'], $error['RequestId']); - log_error($message); - } - } - - /** - * Callback handler for 503 retries. - * - * @internal Used by SimpleDBRequest to call the user-specified callback, if set - * @param $attempt The number of failed attempts so far - * @return The retry delay in microseconds, or 0 to stop retrying. - */ - public function __executeServiceTemporarilyUnavailableRetryDelay($attempt) - { - if (is_callable($this->__serviceUnavailableRetryDelayCallback)) { - $callback = $this->__serviceUnavailableRetryDelayCallback; - return $callback($attempt); - } - return 0; - } -} - -final class Route53Request -{ - private $r53, $action, $verb, $data, $parameters = array(); - public $response; - - /** - * Constructor - * - * @param string $r53 The Route53 object making this request - * @param string $action SimpleDB action - * @param string $verb HTTP verb - * @param string $data For POST requests, the data being posted (optional) - * @return mixed - */ - function __construct($r53, $action, $verb, $data = '') - { - $this->r53 = $r53; - $this->action = $action; - $this->verb = $verb; - $this->data = $data; - $this->response = new STDClass(); - $this->response->error = false; - } - - /** - * Set request parameter - * - * @param string $key Key - * @param string $value Value - * @param boolean $replace Whether to replace the key if it already exists (default true) - * @return void - */ - public function setParameter($key, $value, $replace = true) - { - if (!$replace && isset($this->parameters[$key])) { - $temp = (array)($this->parameters[$key]); - $temp[] = $value; - $this->parameters[$key] = $temp; - } else { - $this->parameters[$key] = $value; - } - } - - /** - * Get the response - * - * @return object | false - */ - public function getResponse() - { - - $params = array(); - foreach ($this->parameters as $var => $value) { - if (is_array($value)) { - foreach ($value as $v) { - $params[] = $var . '=' . $this->__customUrlEncode($v); - } - } else { - $params[] = $var . '=' . $this->__customUrlEncode($value); - } - } - - sort($params, SORT_STRING); - - $query = implode('&', $params); - - // must be in format 'Sun, 06 Nov 1994 08:49:37 GMT' - $date = gmdate('D, d M Y H:i:s e'); - - $headers = array(); - $headers[] = 'Date: ' . $date; - $headers[] = 'Host: ' . $this->r53->getHost(); - - $auth = 'AWS3-HTTPS AWSAccessKeyId=' . $this->r53->getAccessKey(); - $auth .= ',Algorithm=HmacSHA256,Signature=' . $this->__getSignature($date); - $headers[] = 'X-Amzn-Authorization: ' . $auth; - - $url = 'https://' . $this->r53->getHost() . '/' . Route53::API_VERSION . '/' . $this->action . '?' . $query; - - // Basic setup - $curl = curl_init(); - curl_setopt($curl, CURLOPT_USERAGENT, 'Route53/php'); - - curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, ($this->r53->verifyHost() ? 1 : 0)); - curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, ($this->r53->verifyPeer() ? 1 : 0)); - - curl_setopt($curl, CURLOPT_URL, $url); - curl_setopt($curl, CURLOPT_RETURNTRANSFER, false); - curl_setopt($curl, CURLOPT_WRITEFUNCTION, array(&$this, '__responseWriteCallback')); - curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); - - // Request types - switch ($this->verb) { - case 'GET': - break; - case 'POST': - curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $this->verb); - if (strlen($this->data) > 0) { - curl_setopt($curl, CURLOPT_POSTFIELDS, $this->data); - $headers[] = 'Content-Type: text/plain'; - $headers[] = 'Content-Length: ' . strlen($this->data); - } - break; - case 'DELETE': - curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'DELETE'); - break; - default: - break; - } - curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); - curl_setopt($curl, CURLOPT_HEADER, false); - - // Execute, grab errors - if (curl_exec($curl)) { - $this->response->code = curl_getinfo($curl, CURLINFO_HTTP_CODE); - } else { - $this->response->error = array( - 'curl' => true, - 'code' => curl_errno($curl), - 'message' => curl_error($curl), - 'resource' => $this->resource - ); - } - - @curl_close($curl); - - // Parse body into XML - if ($this->response->error === false && isset($this->response->body)) { - $this->response->body = simplexml_load_string($this->response->body); - - // Grab Route53 errors - if ( - !in_array($this->response->code, array(200, 201, 202, 204)) - && isset($this->response->body->Error) - ) { - $error = $this->response->body->Error; - $output = array(); - $output['curl'] = false; - $output['Error'] = array(); - $output['Error']['Type'] = (string)$error->Type; - $output['Error']['Code'] = (string)$error->Code; - $output['Error']['Message'] = (string)$error->Message; - $output['RequestId'] = (string)$this->response->body->RequestId; - - $this->response->error = $output; - unset($this->response->body); - } - } - - return $this->response; - } - - /** - * CURL write callback - * - * @param resource &$curl CURL resource - * @param string &$data Data - * @return integer - */ - private function __responseWriteCallback(&$curl, &$data) - { - $this->response->body .= $data; - return strlen($data); - } - - /** - * Contributed by afx114 - * URL encode the parameters as per http://docs.amazonwebservices.com/AWSECommerceService/latest/DG/index.html?Query_QueryAuth.html - * PHP's rawurlencode() follows RFC 1738, not RFC 3986 as required by Amazon. The only difference is the tilde (~), so convert it back after rawurlencode - * See: http://www.morganney.com/blog/API/AWS-Product-Advertising-API-Requires-a-Signed-Request.php - * - * @param string $var String to encode - * @return string - */ - private function __customUrlEncode($var) - { - return str_replace('%7E', '~', rawurlencode($var)); - } - - /** - * Generate the auth string using Hmac-SHA256 - * - * @internal Used by SimpleDBRequest::getResponse() - * @param string $string String to sign - * @return string - */ - private function __getSignature($string) - { - return base64_encode(hash_hmac('sha256', $string, $this->r53->getSecretKey(), true)); - } -} diff --git a/dns/dyndns/src/etc/rc.dyndns b/dns/dyndns/src/etc/rc.dyndns deleted file mode 100755 index 5bdc01353..000000000 --- a/dns/dyndns/src/etc/rc.dyndns +++ /dev/null @@ -1,50 +0,0 @@ -#!/usr/local/bin/php - - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -require_once("config.inc"); -require_once("interfaces.inc"); -require_once("util.inc"); -require_once("filter.inc"); -require_once("plugins.inc.d/dyndns.inc"); - -if (isset($argv[1])) { - $argument = trim($argv[1], " \n"); -} else { - $argument = null; -} - -if (empty($argument)) { - dyndns_configure_do(true); -} else { - $interface = (new \OPNsense\Routing\Gateways(legacy_interfaces_details()))->getInterfaceName($argument); - if (empty($interface)) { - $interface = $argument; - } - dyndns_configure_do(true, $interface); -} diff --git a/dns/dyndns/src/etc/rc.syshook.d/monitor/50-dyndns b/dns/dyndns/src/etc/rc.syshook.d/monitor/50-dyndns deleted file mode 100755 index 77511becc..000000000 --- a/dns/dyndns/src/etc/rc.syshook.d/monitor/50-dyndns +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/sh - -# Copyright (c) 2019 Franco Fichtner -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. - -GATEWAY="${1}" - -if [ -z "${GATEWAY}" ]; then - # require a gateway - exit 1 -fi - -echo -n "Reloading DynDNS for ${GATEWAY}: " -/usr/local/opnsense/service/configd_ctl.py dyndns reload ${GATEWAY} - -exit 0 diff --git a/dns/dyndns/src/opnsense/mvc/app/models/OPNsense/DynamicDNS/ACL/ACL.xml b/dns/dyndns/src/opnsense/mvc/app/models/OPNsense/DynamicDNS/ACL/ACL.xml deleted file mode 100644 index 108e7e653..000000000 --- a/dns/dyndns/src/opnsense/mvc/app/models/OPNsense/DynamicDNS/ACL/ACL.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - Services: Dynamic DNS clients - - services_dyndns.php* - services_dyndns_edit.php* - - - diff --git a/dns/dyndns/src/opnsense/mvc/app/models/OPNsense/DynamicDNS/Menu/Menu.xml b/dns/dyndns/src/opnsense/mvc/app/models/OPNsense/DynamicDNS/Menu/Menu.xml deleted file mode 100644 index d2a7a40f2..000000000 --- a/dns/dyndns/src/opnsense/mvc/app/models/OPNsense/DynamicDNS/Menu/Menu.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/dns/dyndns/src/opnsense/service/conf/actions.d/actions_dyndns.conf b/dns/dyndns/src/opnsense/service/conf/actions.d/actions_dyndns.conf deleted file mode 100644 index 294b7da84..000000000 --- a/dns/dyndns/src/opnsense/service/conf/actions.d/actions_dyndns.conf +++ /dev/null @@ -1,6 +0,0 @@ -[reload] -command:/usr/local/etc/rc.dyndns -description:Dynamic DNS Update -parameters:%s -type:script -message:updating dyndns %s diff --git a/dns/dyndns/src/www/services_dyndns.php b/dns/dyndns/src/www/services_dyndns.php deleted file mode 100644 index e69928559..000000000 --- a/dns/dyndns/src/www/services_dyndns.php +++ /dev/null @@ -1,203 +0,0 @@ - - - - - -
-
-
-
- -
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- - - -
- "> - "> - - - -%s', - $ipaddr != $cached_ip ? 'red' : 'green', - htmlspecialchars($cached_ip) - ); - } elseif (!empty($fdata6)) { - $cached_ipv6_s = explode('|', $fdata6); - $cached_ipv6 = $cached_ipv6_s[0]; - echo sprintf( - '%s', - $ipv6addr != $cached_ipv6 ? 'red' : 'green', - htmlspecialchars($cached_ipv6) - ); - } else { - echo sprintf('%s', gettext('N/A')); - }?> - - - -
-
-
-
-
-
-
-
- diff --git a/dns/dyndns/src/www/services_dyndns_edit.php b/dns/dyndns/src/www/services_dyndns_edit.php deleted file mode 100644 index 3b5d12cb6..000000000 --- a/dns/dyndns/src/www/services_dyndns_edit.php +++ /dev/null @@ -1,500 +0,0 @@ - - - - - -
-
-
- 0) print_input_errors($input_errors); ?> -
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - -
- " /> -
- -
- -
- - -
- - -
- - -
- /> - -
- /> - -
- /> -
- /> - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- -
  - - - - - - -
- ', ''); ?> -
-
-
-
-
-
-
-
-%s', - $ipaddr != $cached_ip ? 'text-danger' : '', - htmlspecialchars($cached_ip) - ); - } elseif (!empty($fdata6)) { - $cached_ipv6_s = explode('|', $fdata6); - $cached_ipv6 = $cached_ipv6_s[0]; - echo sprintf( - '%s', - $ipv6addr != $cached_ipv6 ? 'text-danger' : '', - htmlspecialchars($cached_ipv6) - ); - } else { - echo gettext('N/A'); - } - } - exit; -} - -?> - - - - - - - - - - - - - - - $dyndns) :?> - - - - - - - - -
- -
> - $ifdesc) { - if ($dyndns['interface'] == $if) { - echo "{$ifdesc}"; - break; - } - } - foreach ($groupslist as $if => $group) { - if ($dyndns['interface'] == $if) { - echo "{$if}"; - break; - } - }?> - > - - > - - > -
- -
-
-