diff --git a/automation/escrow.php b/automation/escrow.php index 0bf6d0a..75f1b49 100644 --- a/automation/escrow.php +++ b/automation/escrow.php @@ -414,20 +414,33 @@ try { // Start of svcExtension $xml->startElementNS('rdeEppParams', 'svcExtension', null); + $extUriArray = []; + if (file_exists('/opt/registry/epp/extensions.json')) { + $json = file_get_contents('/opt/registry/epp/extensions.json'); + $data = json_decode($json, true); - // Add extURI elements - $extUriArray = [ - 'https://namingo.org/epp/funds-1.0', - 'https://namingo.org/epp/identica-1.0', - 'urn:ietf:params:xml:ns:secDNS-1.1', - 'urn:ietf:params:xml:ns:rgp-1.0', - 'urn:ietf:params:xml:ns:launch-1.0', - 'urn:ietf:params:xml:ns:idn-1.0', - 'urn:ietf:params:xml:ns:epp:fee-1.0', - 'urn:ietf:params:xml:ns:mark-1.0', - 'urn:ietf:params:xml:ns:allocationToken-1.0' - ]; - + if (is_array($data)) { + foreach ($data as $urn => $ext) { + if (!empty($ext['enabled'])) { + $extUriArray[] = $urn; + } + } + } + } + // Fallback to hardcoded list if needed + if (empty($extUriArray)) { + $extUriArray = [ + 'https://namingo.org/epp/funds-1.0', + 'https://namingo.org/epp/identica-1.0', + 'urn:ietf:params:xml:ns:secDNS-1.1', + 'urn:ietf:params:xml:ns:rgp-1.0', + 'urn:ietf:params:xml:ns:launch-1.0', + 'urn:ietf:params:xml:ns:idn-1.0', + 'urn:ietf:params:xml:ns:epp:fee-1.0', + 'urn:ietf:params:xml:ns:mark-1.0', + 'urn:ietf:params:xml:ns:allocationToken-1.0' + ]; + } foreach ($extUriArray as $extUri) { $xml->writeElementNS('epp', 'extURI', null, $extUri); } diff --git a/cp/app/Controllers/ContactsController.php b/cp/app/Controllers/ContactsController.php index 22f9a03..d66aae8 100644 --- a/cp/app/Controllers/ContactsController.php +++ b/cp/app/Controllers/ContactsController.php @@ -244,8 +244,8 @@ class ContactsController extends Controller return $response->withHeader('Location', '/contact/create')->withStatus(302); } - if ((strlen($authInfo_pw) < 6) || (strlen($authInfo_pw) > 16)) { - $this->container->get('flash')->addMessage('error', 'Unable to create contact: Password needs to be at least 6 and up to 16 characters long'); + if ((strlen($authInfo_pw) < 6) || (strlen($authInfo_pw) > 64)) { + $this->container->get('flash')->addMessage('error', 'Unable to create contact: Password needs to be at least 6 and up to 64 characters long'); return $response->withHeader('Location', '/contact/create')->withStatus(302); } @@ -644,8 +644,8 @@ class ContactsController extends Controller return $response->withHeader('Content-Type', 'application/json')->withStatus(400); } - if ((strlen($authInfo_pw) < 6) || (strlen($authInfo_pw) > 16)) { - $error = ["error" => "Unable to create contact: Password needs to be at least 6 and up to 16 characters long"]; + if ((strlen($authInfo_pw) < 6) || (strlen($authInfo_pw) > 64)) { + $error = ["error" => "Unable to create contact: Password needs to be at least 6 and up to 64 characters long"]; $response->getBody()->write(json_encode($error)); return $response->withHeader('Content-Type', 'application/json')->withStatus(400); } @@ -1498,8 +1498,8 @@ class ContactsController extends Controller return $response->withHeader('Location', '/contact/update/'.$identifier)->withStatus(302); } - if ((strlen($authInfo_pw) < 6) || (strlen($authInfo_pw) > 16)) { - $this->container->get('flash')->addMessage('error', 'Unable to update contact: Password needs to be at least 6 and up to 16 characters long'); + if ((strlen($authInfo_pw) < 6) || (strlen($authInfo_pw) > 64)) { + $this->container->get('flash')->addMessage('error', 'Unable to update contact: Password needs to be at least 6 and up to 64 characters long'); return $response->withHeader('Location', '/contact/update/'.$identifier)->withStatus(302); } diff --git a/epp/extensions.json b/epp/extensions.json new file mode 100644 index 0000000..3b2b672 --- /dev/null +++ b/epp/extensions.json @@ -0,0 +1,41 @@ +{ + "urn:ietf:params:xml:ns:secDNS-1.1": { + "enabled": true + }, + "urn:ietf:params:xml:ns:rgp-1.0": { + "enabled": true + }, + "urn:ietf:params:xml:ns:launch-1.0": { + "enabled": true + }, + "urn:ietf:params:xml:ns:epp:fee-1.0": { + "enabled": true + }, + "urn:ietf:params:xml:ns:secDNS-1.1": { + "enabled": true + }, + "urn:ietf:params:xml:ns:allocationToken-1.0": { + "enabled": true + }, + "urn:ietf:params:xml:ns:epp:loginSec-1.0": { + "enabled": false + }, + "urn:ietf:params:xml:ns:epp:unhandled-namespaces-1.0": { + "enabled": false + }, + "urn:ietf:params:xml:ns:epp:secure-authinfo-transfer-1.0": { + "enabled": false + }, + "urn:ietf:params:xml:ns:idn-1.0": { + "enabled": true + }, + "urn:ietf:params:xml:ns:mark-1.0": { + "enabled": true + }, + "https://namingo.org/epp/funds-1.0": { + "enabled": true + }, + "https://namingo.org/epp/identica-1.0": { + "enabled": true + } +} \ No newline at end of file diff --git a/epp/src/EppWriter.php b/epp/src/EppWriter.php index c0a862b..b5bd301 100644 --- a/epp/src/EppWriter.php +++ b/epp/src/EppWriter.php @@ -377,8 +377,12 @@ class EppWriter { private function _postamble($writer, $resp) { if (isset($resp['clTRID']) || isset($resp['svTRID'])) { $writer->startElement('trID'); - $writer->writeElement('clTRID', $resp['clTRID']); - $writer->writeElement('svTRID', $resp['svTRID']); + if (isset($resp['clTRID']) && $resp['clTRID'] !== '') { + $writer->writeElement('clTRID', $resp['clTRID']); + } + if (isset($resp['svTRID']) && $resp['svTRID'] !== '') { + $writer->writeElement('svTRID', $resp['svTRID']); + } $writer->endElement(); // End of 'trID' } $writer->endElement(); // End of 'response' diff --git a/epp/src/epp-create.php b/epp/src/epp-create.php index 23a72eb..422e286 100644 --- a/epp/src/epp-create.php +++ b/epp/src/epp-create.php @@ -242,8 +242,8 @@ function processContactCreate($conn, $db, $xml, $clid, $database_type, $trans) { return; } - if ((strlen($authInfo_pw) < 6) || (strlen($authInfo_pw) > 16)) { - sendEppError($conn, $db, 2005, 'Password needs to be at least 6 and up to 16 characters long', $clTRID, $trans); + if ((strlen($authInfo_pw) < 6) || (strlen($authInfo_pw) > 64)) { + sendEppError($conn, $db, 2005, 'Password needs to be at least 6 and up to 64 characters long', $clTRID, $trans); return; } @@ -1228,8 +1228,8 @@ function processDomainCreate($conn, $db, $xml, $clid, $database_type, $trans, $m return; } - if (strlen($authInfo_pw) < 6 || strlen($authInfo_pw) > 16) { - sendEppError($conn, $db, 2005, 'Password needs to be at least 6 and up to 16 characters long', $clTRID, $trans); + if (strlen($authInfo_pw) < 6 || strlen($authInfo_pw) > 64) { + sendEppError($conn, $db, 2005, 'Password needs to be at least 6 and up to 64 characters long', $clTRID, $trans); return; } diff --git a/epp/src/epp-update.php b/epp/src/epp-update.php index 7023f22..c0bcee9 100644 --- a/epp/src/epp-update.php +++ b/epp/src/epp-update.php @@ -318,8 +318,8 @@ function processContactUpdate($conn, $db, $xml, $clid, $database_type, $trans) { $authInfo_pw = (string) $contactUpdate->chg->authInfo->pw; if ($authInfo_pw) { - if ((strlen($authInfo_pw) < 6) || (strlen($authInfo_pw) > 16)) { - sendEppError($conn, $db, 2005, 'Password needs to be at least 6 and up to 16 characters long', $clTRID, $trans); + if ((strlen($authInfo_pw) < 6) || (strlen($authInfo_pw) > 64)) { + sendEppError($conn, $db, 2005, 'Password needs to be at least 6 and up to 64 characters long', $clTRID, $trans); return; } @@ -1349,8 +1349,8 @@ function processDomainUpdate($conn, $db, $xml, $clid, $database_type, $trans) { $authInfo_pw = (string)$authInfo_pw_elements[0]; if ($authInfo_pw) { - if (strlen($authInfo_pw) < 6 || strlen($authInfo_pw) > 16) { - sendEppError($conn, $db, 2005, 'Password needs to be at least 6 and up to 16 characters long', $clTRID, $trans); + if (strlen($authInfo_pw) < 6 || strlen($authInfo_pw) > 64) { + sendEppError($conn, $db, 2005, 'Password needs to be at least 6 and up to 64 characters long', $clTRID, $trans); return; } diff --git a/epp/src/helpers.php b/epp/src/helpers.php index 0f2dacd..b6a0916 100644 --- a/epp/src/helpers.php +++ b/epp/src/helpers.php @@ -99,10 +99,15 @@ function checkLogin($db, $clID, $pw) { return password_verify($pw, $hashedPassword); } -function sendGreeting($conn) { +function sendGreeting($conn, Swoole\Table $eppExtensionsTable) { global $c; $currentDateTime = new DateTime("now", new DateTimeZone("UTC")); $currentDate = $currentDateTime->format("Y-m-d\TH:i:s.v\Z"); + + $extensions = []; + foreach ($eppExtensionsTable as $urn => $row) { + $extensions[] = $urn; + } $response = [ 'command' => 'greeting', @@ -115,17 +120,7 @@ function sendGreeting($conn) { 'urn:ietf:params:xml:ns:contact-1.0', 'urn:ietf:params:xml:ns:host-1.0' ], - 'extensions' => [ - 'https://namingo.org/epp/funds-1.0', - 'https://namingo.org/epp/identica-1.0', - 'urn:ietf:params:xml:ns:secDNS-1.1', - 'urn:ietf:params:xml:ns:rgp-1.0', - 'urn:ietf:params:xml:ns:launch-1.0', - 'urn:ietf:params:xml:ns:idn-1.0', - 'urn:ietf:params:xml:ns:epp:fee-1.0', - 'urn:ietf:params:xml:ns:mark-1.0', - 'urn:ietf:params:xml:ns:allocationToken-1.0' - ], + 'extensions' => $extensions, 'dcp' => [ // Data Collection Policy (optional) 'access' => ['all'], 'statement' => [