From 16b163661b1d1a5bcc9a24ce023f7a06c5fb420e Mon Sep 17 00:00:00 2001 From: Jason McCormick Date: Wed, 31 Aug 2016 00:09:41 -0400 Subject: move back to r53.class for license continuity --- src/etc/inc/dyndns.class | 38 +++++++------------------------------- 1 file changed, 7 insertions(+), 31 deletions(-) (limited to 'src/etc/inc/dyndns.class') diff --git a/src/etc/inc/dyndns.class b/src/etc/inc/dyndns.class index f397873..a9f6813 100644 --- a/src/etc/inc/dyndns.class +++ b/src/etc/inc/dyndns.class @@ -620,43 +620,19 @@ } 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': - /* http://docs.aws.amazon.com/Route53/latest/APIReference/Welcome.html */ - /* AWS3 Signature generation inspired by Dan Myers http://sourceforge.net/projects/php-r53/ */ - $reqdate = gmdate('D, d M Y H:i:s e'); - $httphead[] = array(); - $httphead[] = sprintf("Date: %s", $reqdate); - /* to avoid having user to know their AWS Region, for now use V3 */ - $httphead[] = sprintf( - "X-Amzn-Authorization: AWS3-HTTPS AWSAccessKeyId=%s,Algorithm=HMACSHA256,SignedHeaders=date,Signature=%s", - $this->_dnsUser, - base64_encode(hash_hmac("sha256", $reqdate, $this->_dnsPass, true)) - ); - $apiurl = sprintf("https://route53.amazonaws.com/2013-04-01/hostedzone/%s/rrset", $this->_dnsZoneID); - $xmlreq .= ""; - $xmlreq .= ""; - $xmlreq .= ""; - $xmlreq .= "UPSERT"; - $xmlreq .= ""; - $xmlreq .= sprintf("%s", $this->_dnsHost); - $xmlreq .= "A"; - $xmlreq .= sprintf("%d", $this->_dnsTTL); - $xmlreq .= sprintf("%s", - $this->_dnsIP); - $xmlreq .= ""; - $xmlreq .= ""; - $xmlreq .= ""; - - $httphead[] = "Content-Type: text/plain"; - $httphead[] = sprintf("Content-Length: %d", strlen($xmlreq)); - + case 'route53': + require_once("r53.class"); + $r53 = new Route53($this->_dnsUser, $this->_dnsPass); + $apiurl = $r53->getApiUrl($this->_dnsZoneID); + $xmlreq = $r53->getRequestBody($this->_dnsHost, $this->_dnsIP, $this->_dnsTTL); + $httphead = $r53->getHttpPostHeaders(strlen($xmlreq)); curl_setopt($ch, CURLOPT_HTTPHEADER, $httphead); if($this->_dnsVerboseLog){ log_error(sprintf("Sending reuquest to: %s", $apiurl)); foreach($httphead as $hv){ log_error(sprintf("Header: %s", $hv)); } - log_error(sprintf("XMLPOST:\n%s\n\n", $xmlreq)); + log_error(sprintf("XMLPOST: %s", $xmlreq)); } curl_setopt($ch, CURLOPT_URL, $apiurl); curl_setopt($ch, CURLOPT_POSTFIELDS, $xmlreq); -- cgit v1.1