diff --git a/epp.php b/epp.php index 12ce48e..b152394 100644 --- a/epp.php +++ b/epp.php @@ -1469,6 +1469,200 @@ function epp_RequestDelete($params = array()) return $return; } +function epp_manageDNSSECDSRecords($params = array()) +{ + _epp_log(__FUNCTION__, $params); + $return = array(); + try { + $s = _epp_startEppClient($params); + + if (isset($_POST['command']) && ($_POST['command'] === 'secDNSadd')) { + $keyTag = $_POST['keyTag']; + $alg = $_POST['alg']; + $digestType = $_POST['digestType']; + $digest = $_POST['digest']; + + $from = $to = array(); + $from[] = '/{{ name }}/'; + $to[] = htmlspecialchars($params['domainname']); + + $from[] = '/{{ keyTag }}/'; + $to[] = htmlspecialchars($keyTag); + + $from[] = '/{{ alg }}/'; + $to[] = htmlspecialchars($alg); + + $from[] = '/{{ digestType }}/'; + $to[] = htmlspecialchars($digestType); + + $from[] = '/{{ digest }}/'; + $to[] = htmlspecialchars($digest); + + $from[] = '/{{ clTRID }}/'; + $clTRID = str_replace('.', '', round(microtime(1), 3)); + $to[] = htmlspecialchars($params['registrarprefix'] . '-domain-update-' . $clTRID); + $xml = preg_replace($from, $to, ' + + + + + {{ name }} + + + + + + + {{ keyTag }} + {{ alg }} + {{ digestType }} + {{ digest }} + + + + + {{ clTRID }} + +'); + $r = $s->write($xml, __FUNCTION__); + } + + if (isset($_POST['command']) && ($_POST['command'] === 'secDNSrem')) { + $keyTag = $_POST['keyTag']; + $alg = $_POST['alg']; + $digestType = $_POST['digestType']; + $digest = $_POST['digest']; + + $from = $to = array(); + $from[] = '/{{ name }}/'; + $to[] = htmlspecialchars($params['domainname']); + + $from[] = '/{{ keyTag }}/'; + $to[] = htmlspecialchars($keyTag); + + $from[] = '/{{ alg }}/'; + $to[] = htmlspecialchars($alg); + + $from[] = '/{{ digestType }}/'; + $to[] = htmlspecialchars($digestType); + + $from[] = '/{{ digest }}/'; + $to[] = htmlspecialchars($digest); + + $from[] = '/{{ clTRID }}/'; + $clTRID = str_replace('.', '', round(microtime(1), 3)); + $to[] = htmlspecialchars($params['registrarprefix'] . '-domain-update-' . $clTRID); + $xml = preg_replace($from, $to, ' + + + + + {{ name }} + + + + + + + {{ keyTag }} + {{ alg }} + {{ digestType }} + {{ digest }} + + + + + {{ clTRID }} + +'); + $r = $s->write($xml, __FUNCTION__); + } + + $from = $to = array(); + $from[] = '/{{ name }}/'; + $to[] = htmlspecialchars($params['domainname']); + $from[] = '/{{ clTRID }}/'; + $clTRID = str_replace('.', '', round(microtime(1), 3)); + $to[] = htmlspecialchars($params['registrarprefix'] . '-domain-info-' . $clTRID); + $xml = preg_replace($from, $to, ' + + + + + {{ name }} + + + {{ clTRID }} + +'); + $r = $s->write($xml, __FUNCTION__); + + $secDNSdsData = array(); + if ($r->response->extension && $r->response->extension->children('urn:ietf:params:xml:ns:secDNS-1.1')->infData) { + $DSRecords = 'YES'; + $i = 0; + $r = $r->response->extension->children('urn:ietf:params:xml:ns:secDNS-1.1')->infData; + foreach($r->dsData as $dsData) { + $i++; + $secDNSdsData[$i]["domainid"] = (int)$params['domainid']; + $secDNSdsData[$i]["keyTag"] = (string)$dsData->keyTag; + $secDNSdsData[$i]["alg"] = (int)$dsData->alg; + $secDNSdsData[$i]["digestType"] = (int)$dsData->digestType; + $secDNSdsData[$i]["digest"] = (string)$dsData->digest; + } + } + else { + $DSRecords = "You don't have any DS records"; + } + + $return = array( + 'templatefile' => 'manageDNSSECDSRecords', + 'requirelogin' => true, + 'vars' => array( + 'DSRecords' => $DSRecords, + 'DSRecordslist' => $secDNSdsData + ) + ); + } + + catch(exception $e) { + $return = array( + 'templatefile' => 'manageDNSSECDSRecords', + 'requirelogin' => true, + 'vars' => array( + 'error' => $e->getMessage() + ) + ); + } + + if (!empty($s)) { + $s->logout($params['registrarprefix']); + } + + return $return; +} + +function epp_ClientAreaCustomButtonArray() +{ + $buttonarray = array( + Lang::Trans('Manage DNSSEC DS Records') => 'manageDNSSECDSRecords' + ); + + return $buttonarray; +} + function epp_AdminCustomButtonArray($params = array()) { _epp_log(__FUNCTION__, $params); diff --git a/manageDNSSECDSRecords.tpl b/manageDNSSECDSRecords.tpl new file mode 100644 index 0000000..95f66f4 --- /dev/null +++ b/manageDNSSECDSRecords.tpl @@ -0,0 +1,124 @@ +
+
+

Manage DNSSEC DS Records

+ +{if $error} +
+ {$error} +
+{else} + {if $DSRecords eq 'YES'} + {foreach $DSRecordslist as $item} +
+ + + + + + +

DS records:

+ +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+ +
+ +
+ +
+ {/foreach} + {else} +
+ {$DSRecords} +
+ {/if} +{/if} +
+
+ +
+
+
+ + + + + + +

Create a DS Record

+ +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+ +
+ +
+ +
+
+
\ No newline at end of file