EPP server update; ability to turn-off 60-day transfer lock

This commit is contained in:
Pinga 2025-06-27 17:46:22 +03:00
parent 98ae5dc19c
commit 2093023791
4 changed files with 52 additions and 52 deletions

View file

@ -26,15 +26,7 @@ systemctl status das
### 1.2. Launching EPP Server ### 1.2. Launching EPP Server
Before launching the EPP server, edit `/opt/registry/epp/config.php` to set the paths to your certificates and configure other options as needed. Before launching the EPP server, edit `/opt/registry/epp/config.php` to set the paths to your certificates and configure other options as needed. Add `'disable_60days' => true,` if you wish to disable the 60-day transfer lock.
To create test certificates (`cert.pem` and `key.pem`), execute the following commands:
```bash
cd /opt/registry/epp/
openssl genrsa -out key.pem 2048
openssl req -new -x509 -key key.pem -out cert.pem -days 365
```
Once configured, you can launch the EPP server in the same way as the others: Once configured, you can launch the EPP server in the same way as the others:
@ -1103,6 +1095,7 @@ return [
'limit' => 1000, // Request limit per period below 'limit' => 1000, // Request limit per period below
'period' => 60, // 60 Seconds 'period' => 60, // 60 Seconds
'minimum_data' => false, // Set to true to enable minimum data set support 'minimum_data' => false, // Set to true to enable minimum data set support
// 'disable_60days' => true, // Disable 60-day transfer lock for domains and contacts
]; ];
``` ```

View file

@ -19,4 +19,5 @@ return [
'limit' => 1000, 'limit' => 1000,
'period' => 60, 'period' => 60,
'minimum_data' => false, 'minimum_data' => false,
// 'disable_60days' => true, // Disable 60-day transfer lock for domains and contacts
]; ];

View file

@ -1,6 +1,7 @@
<?php <?php
function processContactTransfer($conn, $db, $xml, $clid, $database_type, $trans) { function processContactTransfer($conn, $db, $xml, $clid, $config, $trans) {
// $config['db_type'] for future
$contactID = (string) $xml->command->transfer->children('urn:ietf:params:xml:ns:contact-1.0')->transfer->{'id'}; $contactID = (string) $xml->command->transfer->children('urn:ietf:params:xml:ns:contact-1.0')->transfer->{'id'};
$clTRID = (string) $xml->command->clTRID; $clTRID = (string) $xml->command->clTRID;
$op = (string) $xml->xpath('//@op')[0] ?? null; $op = (string) $xml->xpath('//@op')[0] ?? null;
@ -298,6 +299,7 @@ function processContactTransfer($conn, $db, $xml, $clid, $database_type, $trans)
return; return;
} }
} elseif ($op == 'request') { } elseif ($op == 'request') {
if (!($config['disable_60days'] ?? false)) {
// Check if contact is within 60 days of its initial registration // Check if contact is within 60 days of its initial registration
$stmt = $db->prepare("SELECT DATEDIFF(CURRENT_TIMESTAMP(3),crdate) FROM contact WHERE id = :contact_id LIMIT 1"); $stmt = $db->prepare("SELECT DATEDIFF(CURRENT_TIMESTAMP(3),crdate) FROM contact WHERE id = :contact_id LIMIT 1");
$stmt->execute([':contact_id' => $contact_id]); $stmt->execute([':contact_id' => $contact_id]);
@ -321,6 +323,7 @@ function processContactTransfer($conn, $db, $xml, $clid, $database_type, $trans)
sendEppError($conn, $db, 2201, 'The contact name must not be within 60 days of its last transfer from another registrar', $clTRID, $trans); sendEppError($conn, $db, 2201, 'The contact name must not be within 60 days of its last transfer from another registrar', $clTRID, $trans);
return; return;
} }
}
// Check the <contact:authInfo> element // Check the <contact:authInfo> element
$stmt = $db->prepare("SELECT id FROM contact_authInfo WHERE contact_id = :contact_id AND authtype = 'pw' AND authinfo = :authInfo_pw LIMIT 1"); $stmt = $db->prepare("SELECT id FROM contact_authInfo WHERE contact_id = :contact_id AND authtype = 'pw' AND authinfo = :authInfo_pw LIMIT 1");
@ -418,7 +421,8 @@ function processContactTransfer($conn, $db, $xml, $clid, $database_type, $trans)
} }
} }
function processDomainTransfer($conn, $db, $xml, $clid, $database_type, $trans) { function processDomainTransfer($conn, $db, $xml, $clid, $config, $trans) {
// $config['db_type'] for future
$domainName = (string) $xml->command->transfer->children('urn:ietf:params:xml:ns:domain-1.0')->transfer->name; $domainName = (string) $xml->command->transfer->children('urn:ietf:params:xml:ns:domain-1.0')->transfer->name;
$clTRID = (string) $xml->command->clTRID; $clTRID = (string) $xml->command->clTRID;
$op = (string) $xml->xpath('//@op')[0] ?? null; $op = (string) $xml->xpath('//@op')[0] ?? null;
@ -428,7 +432,7 @@ function processDomainTransfer($conn, $db, $xml, $clid, $database_type, $trans)
$allocation_token = $xml->xpath('//allocationToken:allocationToken')[0] ?? null; $allocation_token = $xml->xpath('//allocationToken:allocationToken')[0] ?? null;
} }
// - An OPTIONAL <domain:authInfo> for op="query" and mandatory for other op values "approve|cancel|reject|request" // An OPTIONAL <domain:authInfo> for op="query" and mandatory for other op values "approve|cancel|reject|request"
$result = $xml->xpath('//domain:authInfo/domain:pw[1]'); $result = $xml->xpath('//domain:authInfo/domain:pw[1]');
$authInfo_pw = $result ? (string)$result[0] : null; $authInfo_pw = $result ? (string)$result[0] : null;
@ -1017,6 +1021,7 @@ function processDomainTransfer($conn, $db, $xml, $clid, $database_type, $trans)
} }
} }
if (!($config['disable_60days'] ?? false)) {
// Check days from registration // Check days from registration
$stmt = $db->prepare("SELECT DATEDIFF(CURRENT_TIMESTAMP(3), crdate) FROM domain WHERE id = :domain_id LIMIT 1"); $stmt = $db->prepare("SELECT DATEDIFF(CURRENT_TIMESTAMP(3), crdate) FROM domain WHERE id = :domain_id LIMIT 1");
$stmt->execute(['domain_id' => $domain_id]); $stmt->execute(['domain_id' => $domain_id]);
@ -1040,6 +1045,7 @@ function processDomainTransfer($conn, $db, $xml, $clid, $database_type, $trans)
sendEppError($conn, $db, 2201, 'The domain name must not be within 60 days of its last transfer from another registrar', $clTRID, $trans); sendEppError($conn, $db, 2201, 'The domain name must not be within 60 days of its last transfer from another registrar', $clTRID, $trans);
return; return;
} }
}
// Check days from expiry date // Check days from expiry date
$stmt = $db->prepare("SELECT DATEDIFF(CURRENT_TIMESTAMP(3),exdate) FROM domain WHERE id = :domain_id LIMIT 1"); $stmt = $db->prepare("SELECT DATEDIFF(CURRENT_TIMESTAMP(3),exdate) FROM domain WHERE id = :domain_id LIMIT 1");

View file

@ -433,7 +433,7 @@ $server->handle(function (Connection $conn) use ($table, $eppExtensionsTable, $p
sendEppError($conn, $pdo, 2101, 'Contact commands are not supported in minimum data mode', $clTRID); sendEppError($conn, $pdo, 2101, 'Contact commands are not supported in minimum data mode', $clTRID);
$conn->close(); $conn->close();
} }
processContactTransfer($conn, $pdo, $xml, $data['clid'], $c['db_type'], $trans); processContactTransfer($conn, $pdo, $xml, $data['clid'], $c, $trans);
break; break;
} }
@ -523,7 +523,7 @@ $server->handle(function (Connection $conn) use ($table, $eppExtensionsTable, $p
sendEppError($conn, $pdo, 2202, 'Authorization error', $clTRID); sendEppError($conn, $pdo, 2202, 'Authorization error', $clTRID);
$conn->close(); $conn->close();
} }
processDomainTransfer($conn, $pdo, $xml, $data['clid'], $c['db_type'], $trans); processDomainTransfer($conn, $pdo, $xml, $data['clid'], $c, $trans);
break; break;
} }