Small updates in preparation of new release

This commit is contained in:
Pinga 2025-06-21 17:13:38 +03:00
parent 32e2b24b0b
commit 8c0f3804fb
4 changed files with 99 additions and 40 deletions

View file

@ -231,6 +231,23 @@ systemctl daemon-reload
echo "Enabling and starting namingo-epp-reload.path..."
systemctl enable --now namingo-epp-reload.path
CONFIG_FILE="/opt/registry/automation/config.php"
if [[ ! -f "$CONFIG_FILE" ]]; then
echo "Error: File $CONFIG_FILE not found."
fi
awk '
/'\''escrow_privateKey'\''[[:space:]]*=>/ {
print
print " '\''escrow_signing_fingerprint'\'' => '\''REPLACE_WITH_YOUR_40_CHAR_KEY_FINGERPRINT'\'',"
next
}
{ print }
' "$CONFIG_FILE" > "${CONFIG_FILE}.tmp" && mv "${CONFIG_FILE}.tmp" "$CONFIG_FILE"
echo "Automation config modified successfully."
# Start services
echo "Starting services..."
systemctl start epp

View file

@ -76,7 +76,7 @@ function setupLogger($logFilePath, $channelName = 'app') {
return $log;
}
function mapContactToVCard($contactDetails, $role, $c) {
function mapContactToVCard($contactDetails, $role, $roid) {
// Determine which type of disclosure to use
$disclose_name = ($contactDetails['type'] == 'loc') ? $contactDetails['disclose_name_loc'] : $contactDetails['disclose_name_int'];
$disclose_org = ($contactDetails['type'] == 'loc') ? $contactDetails['disclose_org_loc'] : $contactDetails['disclose_org_int'];
@ -87,7 +87,7 @@ function mapContactToVCard($contactDetails, $role, $c) {
return [
'objectClassName' => 'entity',
'handle' => 'C' . $contactDetails['id'] . '-' . $c['roid'],
'handle' => 'C' . $contactDetails['id'] . '-' . $roid,
'roles' => [$role],
'remarks' => [
[

View file

@ -526,6 +526,9 @@ function handleDomainQuery($request, $response, $pdo, $domainName, $c, $log) {
$abuseContactName = ($registrarAbuseDetails) ? $registrarAbuseDetails['first_name'] . ' ' . $registrarAbuseDetails['last_name'] : '';
$rdapClean = rtrim(preg_replace('#^.*?//#', '', $registrarDetails['rdap_server'] ?? ''), '/');
$stmt = $pdo->query("SELECT value FROM settings WHERE name = 'handle'");
$roid = $stmt->fetchColumn();
// Construct the RDAP response in JSON format
$rdapResponse = [
'rdapConformance' => [
@ -556,7 +559,7 @@ function handleDomainQuery($request, $response, $pdo, $domainName, $c, $log) {
],
],
],
"handle" => (string)($registrarDetails['iana_id'] ?: 'R' . $registrarDetails['id'] . '-' . $c['roid'] . ''),
"handle" => (string)($registrarDetails['iana_id'] ?: 'R' . $registrarDetails['id'] . '-' . $roid . ''),
"links" => [
[
"href" => $c['rdap_url'] . "/entity/" . ($registrarDetails['iana_id'] ?: $registrarDetails['id']),
@ -604,7 +607,7 @@ function handleDomainQuery($request, $response, $pdo, $domainName, $c, $log) {
] : [] */
),
'events' => $events,
//'handle' => 'D' . $domainDetails['id'] . '-' . $c['roid'] . '',
//'handle' => 'D' . $domainDetails['id'] . '-' . $roid . '',
'ldhName' => $domain,
'links' => [
[
@ -623,7 +626,7 @@ function handleDomainQuery($request, $response, $pdo, $domainName, $c, $log) {
'nameservers' => array_map(function ($nameserverDetails) use ($c) {
return [
'objectClassName' => 'nameserver',
'handle' => 'H' . $nameserverDetails['host_id'] . '-' . $c['roid'] . '',
'handle' => 'H' . $nameserverDetails['host_id'] . '-' . $roid . '',
'ldhName' => $nameserverDetails['name'],
'links' => [
[
@ -1040,6 +1043,9 @@ function handleEntityQuery($request, $response, $pdo, $entityHandle, $c, $log) {
}
}
$stmt = $pdo->query("SELECT value FROM settings WHERE name = 'handle'");
$roid = $stmt->fetchColumn();
// Construct the RDAP response in JSON format
$rdapResponse = [
'rdapConformance' => [
@ -1051,7 +1057,7 @@ function handleEntityQuery($request, $response, $pdo, $entityHandle, $c, $log) {
],
'objectClassName' => 'entity',
'entities' => $entityBlocks,
"handle" => (string)($registrarDetails['iana_id'] ?: 'R' . $registrarDetails['id'] . '-' . $c['roid'] . ''),
"handle" => (string)($registrarDetails['iana_id'] ?: 'R' . $registrarDetails['id'] . '-' . $roid . ''),
'events' => $events,
'links' => [
[
@ -1405,6 +1411,9 @@ function handleNameserverQuery($request, $response, $pdo, $nameserverHandle, $c,
}
$statuses = array_unique(array_map(fn($s) => $s === 'ok' ? 'active' : $s, $statuses));
$stmt = $pdo->query("SELECT value FROM settings WHERE name = 'handle'");
$roid = $stmt->fetchColumn();
// Construct the RDAP response in JSON format
$rdapResponse = [
'rdapConformance' => [
@ -1435,7 +1444,7 @@ function handleNameserverQuery($request, $response, $pdo, $nameserverHandle, $c,
],
],
],
"handle" => (string)($registrarDetails['iana_id'] ?: 'R' . $registrarDetails['id'] . '-' . $c['roid'] . ''),
"handle" => (string)($registrarDetails['iana_id'] ?: 'R' . $registrarDetails['id'] . '-' . $roid . ''),
"links" => [
[
"href" => $c['rdap_url'] . "/entity/" . ($registrarDetails['iana_id'] ?: $registrarDetails['id']),
@ -1468,7 +1477,7 @@ function handleNameserverQuery($request, $response, $pdo, $nameserverHandle, $c,
],
],
),
'handle' => 'H' . $hostDetails['id'] . '-' . $c['roid'] . '',
'handle' => 'H' . $hostDetails['id'] . '-' . $roid . '',
'ipAddresses' => $ipAddresses,
'events' => $events,
'ldhName' => $hostDetails['name'],
@ -1967,6 +1976,9 @@ function handleDomainSearchQuery($request, $response, $pdo, $searchPattern, $c,
$abuseContactName = ($registrarAbuseDetails) ? $registrarAbuseDetails['first_name'] . ' ' . $registrarAbuseDetails['last_name'] : '';
$stmt = $pdo->query("SELECT value FROM settings WHERE name = 'handle'");
$roid = $stmt->fetchColumn();
// Construct the RDAP response in JSON format
$rdapResponse = [
'rdapConformance' => [
@ -1999,7 +2011,7 @@ function handleDomainSearchQuery($request, $response, $pdo, $searchPattern, $c,
],
],
],
"handle" => (string)($registrarDetails['iana_id'] ?: 'R' . $registrarDetails['id'] . '-' . $c['roid'] . ''),
"handle" => (string)($registrarDetails['iana_id'] ?: 'R' . $registrarDetails['id'] . '-' . $roid . ''),
"links" => [
[
"href" => $c['rdap_url'] . "/entity/" . ($registrarDetails['iana_id'] ?: $registrarDetails['id']),
@ -2032,20 +2044,20 @@ function handleDomainSearchQuery($request, $response, $pdo, $searchPattern, $c,
],
],
[
mapContactToVCard($registrantDetails, 'registrant', $c)
mapContactToVCard($registrantDetails, 'registrant', $roid)
],
array_map(function ($contact) use ($c) {
return mapContactToVCard($contact, 'admin', $c);
return mapContactToVCard($contact, 'admin', $roid);
}, $adminDetails),
array_map(function ($contact) use ($c) {
return mapContactToVCard($contact, 'tech', $c);
return mapContactToVCard($contact, 'tech', $roid);
}, $techDetails),
array_map(function ($contact) use ($c) {
return mapContactToVCard($contact, 'billing', $c);
return mapContactToVCard($contact, 'billing', $roid);
}, $billingDetails)
),
'events' => $events,
'handle' => 'D' . $domainDetails['id'] . '-' . $c['roid'] . '',
'handle' => 'D' . $domainDetails['id'] . '-' . $roid . '',
'ldhName' => $domain,
'links' => [
[
@ -2062,7 +2074,7 @@ function handleDomainSearchQuery($request, $response, $pdo, $searchPattern, $c,
'nameservers' => array_map(function ($nameserverDetails) use ($c) {
return [
'objectClassName' => 'nameserver',
'handle' => 'H' . $nameserverDetails['host_id'] . '-' . $c['roid'] . '',
'handle' => 'H' . $nameserverDetails['host_id'] . '-' . $roid . '',
'ldhName' => $nameserverDetails['name'],
'links' => [
[
@ -2389,6 +2401,9 @@ function handleNameserverSearchQuery($request, $response, $pdo, $searchPattern,
return;
}
$stmt = $pdo->query("SELECT value FROM settings WHERE name = 'handle'");
$roid = $stmt->fetchColumn();
if ($ipS) {
$rdapResult = [];
foreach ($hostDetails as $individualHostDetail) {
@ -2438,7 +2453,7 @@ function handleNameserverSearchQuery($request, $response, $pdo, $searchPattern,
// Build the RDAP response for the current host
$rdapResult[] = [
'objectClassName' => 'nameserver',
'handle' => 'H' . $individualHostDetail['id'] . '-' . $c['roid'],
'handle' => 'H' . $individualHostDetail['id'] . '-' . $roid,
'ipAddresses' => $ipAddresses,
'events' => $events,
'ldhName' => $individualHostDetail['name'],
@ -2589,6 +2604,9 @@ function handleNameserverSearchQuery($request, $response, $pdo, $searchPattern,
$statuses[] = 'associated';
}
$stmt = $pdo->query("SELECT value FROM settings WHERE name = 'handle'");
$roid = $stmt->fetchColumn();
// Construct the RDAP response in JSON format
$rdapResponse = [
'rdapConformance' => [
@ -2621,7 +2639,7 @@ function handleNameserverSearchQuery($request, $response, $pdo, $searchPattern,
],
],
],
"handle" => (string)($registrarDetails['iana_id'] ?: 'R' . $registrarDetails['id'] . '-' . $c['roid'] . ''),
"handle" => (string)($registrarDetails['iana_id'] ?: 'R' . $registrarDetails['id'] . '-' . $roid . ''),
"links" => [
[
"href" => $c['rdap_url'] . "/entity/" . ($registrarDetails['iana_id'] ?: $registrarDetails['id']),
@ -2654,7 +2672,7 @@ function handleNameserverSearchQuery($request, $response, $pdo, $searchPattern,
],
],
),
'handle' => 'H' . $hostDetails['id'] . '-' . $c['roid'] . '',
'handle' => 'H' . $hostDetails['id'] . '-' . $roid . '',
'ipAddresses' => $ipAddresses,
'events' => $events,
'ldhName' => $hostDetails['name'],
@ -2986,6 +3004,9 @@ function handleEntitySearchQuery($request, $response, $pdo, $searchPattern, $c,
}
}
$stmt = $pdo->query("SELECT value FROM settings WHERE name = 'handle'");
$roid = $stmt->fetchColumn();
// Construct the RDAP response in JSON format
$rdapResponse = [
'rdapConformance' => [
@ -2999,7 +3020,7 @@ function handleEntitySearchQuery($request, $response, $pdo, $searchPattern, $c,
[
'objectClassName' => 'entity',
'entities' => $entityBlocks,
"handle" => (string)($registrarDetails['iana_id'] ?: 'R' . $registrarDetails['id'] . '-' . $c['roid'] . ''),
"handle" => (string)($registrarDetails['iana_id'] ?: 'R' . $registrarDetails['id'] . '-' . $roid . ''),
'events' => $events,
'links' => [
[

View file

@ -526,6 +526,9 @@ function handleDomainQuery($request, $response, $pdo, $domainName, $c, $log) {
$abuseContactName = ($registrarAbuseDetails) ? $registrarAbuseDetails['first_name'] . ' ' . $registrarAbuseDetails['last_name'] : '';
$rdapClean = rtrim(preg_replace('#^.*?//#', '', $registrarDetails['rdap_server'] ?? ''), '/');
$stmt = $pdo->query("SELECT value FROM settings WHERE name = 'handle'");
$roid = $stmt->fetchColumn();
// Construct the RDAP response in JSON format
$rdapResponse = [
'rdapConformance' => [
@ -556,7 +559,7 @@ function handleDomainQuery($request, $response, $pdo, $domainName, $c, $log) {
],
],
],
"handle" => (string)($registrarDetails['iana_id'] ?: 'R' . $registrarDetails['id'] . '-' . $c['roid'] . ''),
"handle" => (string)($registrarDetails['iana_id'] ?: 'R' . $registrarDetails['id'] . '-' . $roid . ''),
"links" => [
[
"href" => $c['rdap_url'] . "/entity/" . ($registrarDetails['iana_id'] ?: $registrarDetails['id']),
@ -590,21 +593,21 @@ function handleDomainQuery($request, $response, $pdo, $domainName, $c, $log) {
],
!$c['minimum_data']
? array_merge(
[mapContactToVCard($registrantDetails, 'registrant', $c)],
[mapContactToVCard($registrantDetails, 'registrant', $roid)],
array_map(function ($contact) use ($c) {
return mapContactToVCard($contact, 'administrative', $c);
return mapContactToVCard($contact, 'administrative', $roid);
}, $adminDetails),
array_map(function ($contact) use ($c) {
return mapContactToVCard($contact, 'technical', $c);
return mapContactToVCard($contact, 'technical', $roid);
}, $techDetails),
array_map(function ($contact) use ($c) {
return mapContactToVCard($contact, 'billing', $c);
return mapContactToVCard($contact, 'billing', $roid);
}, $billingDetails)
)
: []
),
'events' => $events,
'handle' => 'D' . $domainDetails['id'] . '-' . $c['roid'] . '',
'handle' => 'D' . $domainDetails['id'] . '-' . $roid . '',
'ldhName' => $domain,
'links' => [
[
@ -623,7 +626,7 @@ function handleDomainQuery($request, $response, $pdo, $domainName, $c, $log) {
'nameservers' => array_map(function ($nameserverDetails) use ($c) {
return [
'objectClassName' => 'nameserver',
'handle' => 'H' . $nameserverDetails['host_id'] . '-' . $c['roid'] . '',
'handle' => 'H' . $nameserverDetails['host_id'] . '-' . $roid . '',
'ldhName' => $nameserverDetails['name'],
'links' => [
[
@ -1040,6 +1043,9 @@ function handleEntityQuery($request, $response, $pdo, $entityHandle, $c, $log) {
}
}
$stmt = $pdo->query("SELECT value FROM settings WHERE name = 'handle'");
$roid = $stmt->fetchColumn();
// Construct the RDAP response in JSON format
$rdapResponse = [
'rdapConformance' => [
@ -1051,7 +1057,7 @@ function handleEntityQuery($request, $response, $pdo, $entityHandle, $c, $log) {
],
'objectClassName' => 'entity',
'entities' => $entityBlocks,
"handle" => (string)($registrarDetails['iana_id'] ?: 'R' . $registrarDetails['id'] . '-' . $c['roid'] . ''),
"handle" => (string)($registrarDetails['iana_id'] ?: 'R' . $registrarDetails['id'] . '-' . $roid . ''),
'events' => $events,
'links' => [
[
@ -1405,6 +1411,9 @@ function handleNameserverQuery($request, $response, $pdo, $nameserverHandle, $c,
}
$statuses = array_unique(array_map(fn($s) => $s === 'ok' ? 'active' : $s, $statuses));
$stmt = $pdo->query("SELECT value FROM settings WHERE name = 'handle'");
$roid = $stmt->fetchColumn();
// Construct the RDAP response in JSON format
$rdapResponse = [
'rdapConformance' => [
@ -1435,7 +1444,7 @@ function handleNameserverQuery($request, $response, $pdo, $nameserverHandle, $c,
],
],
],
"handle" => (string)($registrarDetails['iana_id'] ?: 'R' . $registrarDetails['id'] . '-' . $c['roid'] . ''),
"handle" => (string)($registrarDetails['iana_id'] ?: 'R' . $registrarDetails['id'] . '-' . $roid . ''),
"links" => [
[
"href" => $c['rdap_url'] . "/entity/" . ($registrarDetails['iana_id'] ?: $registrarDetails['id']),
@ -1468,7 +1477,7 @@ function handleNameserverQuery($request, $response, $pdo, $nameserverHandle, $c,
],
],
),
'handle' => 'H' . $hostDetails['id'] . '-' . $c['roid'] . '',
'handle' => 'H' . $hostDetails['id'] . '-' . $roid . '',
'ipAddresses' => $ipAddresses,
'events' => $events,
'ldhName' => $hostDetails['name'],
@ -1967,6 +1976,9 @@ function handleDomainSearchQuery($request, $response, $pdo, $searchPattern, $c,
$abuseContactName = ($registrarAbuseDetails) ? $registrarAbuseDetails['first_name'] . ' ' . $registrarAbuseDetails['last_name'] : '';
$stmt = $pdo->query("SELECT value FROM settings WHERE name = 'handle'");
$roid = $stmt->fetchColumn();
// Construct the RDAP response in JSON format
$rdapResponse = [
'rdapConformance' => [
@ -1999,7 +2011,7 @@ function handleDomainSearchQuery($request, $response, $pdo, $searchPattern, $c,
],
],
],
"handle" => (string)($registrarDetails['iana_id'] ?: 'R' . $registrarDetails['id'] . '-' . $c['roid'] . ''),
"handle" => (string)($registrarDetails['iana_id'] ?: 'R' . $registrarDetails['id'] . '-' . $roid . ''),
"links" => [
[
"href" => $c['rdap_url'] . "/entity/" . ($registrarDetails['iana_id'] ?: $registrarDetails['id']),
@ -2032,20 +2044,20 @@ function handleDomainSearchQuery($request, $response, $pdo, $searchPattern, $c,
],
],
[
mapContactToVCard($registrantDetails, 'registrant', $c)
mapContactToVCard($registrantDetails, 'registrant', $roid)
],
array_map(function ($contact) use ($c) {
return mapContactToVCard($contact, 'admin', $c);
return mapContactToVCard($contact, 'admin', $roid);
}, $adminDetails),
array_map(function ($contact) use ($c) {
return mapContactToVCard($contact, 'tech', $c);
return mapContactToVCard($contact, 'tech', $roid);
}, $techDetails),
array_map(function ($contact) use ($c) {
return mapContactToVCard($contact, 'billing', $c);
return mapContactToVCard($contact, 'billing', $roid);
}, $billingDetails)
),
'events' => $events,
'handle' => 'D' . $domainDetails['id'] . '-' . $c['roid'] . '',
'handle' => 'D' . $domainDetails['id'] . '-' . $roid . '',
'ldhName' => $domain,
'links' => [
[
@ -2062,7 +2074,7 @@ function handleDomainSearchQuery($request, $response, $pdo, $searchPattern, $c,
'nameservers' => array_map(function ($nameserverDetails) use ($c) {
return [
'objectClassName' => 'nameserver',
'handle' => 'H' . $nameserverDetails['host_id'] . '-' . $c['roid'] . '',
'handle' => 'H' . $nameserverDetails['host_id'] . '-' . $roid . '',
'ldhName' => $nameserverDetails['name'],
'links' => [
[
@ -2389,6 +2401,9 @@ function handleNameserverSearchQuery($request, $response, $pdo, $searchPattern,
return;
}
$stmt = $pdo->query("SELECT value FROM settings WHERE name = 'handle'");
$roid = $stmt->fetchColumn();
if ($ipS) {
$rdapResult = [];
foreach ($hostDetails as $individualHostDetail) {
@ -2438,7 +2453,7 @@ function handleNameserverSearchQuery($request, $response, $pdo, $searchPattern,
// Build the RDAP response for the current host
$rdapResult[] = [
'objectClassName' => 'nameserver',
'handle' => 'H' . $individualHostDetail['id'] . '-' . $c['roid'],
'handle' => 'H' . $individualHostDetail['id'] . '-' . $roid,
'ipAddresses' => $ipAddresses,
'events' => $events,
'ldhName' => $individualHostDetail['name'],
@ -2589,6 +2604,9 @@ function handleNameserverSearchQuery($request, $response, $pdo, $searchPattern,
$statuses[] = 'associated';
}
$stmt = $pdo->query("SELECT value FROM settings WHERE name = 'handle'");
$roid = $stmt->fetchColumn();
// Construct the RDAP response in JSON format
$rdapResponse = [
'rdapConformance' => [
@ -2621,7 +2639,7 @@ function handleNameserverSearchQuery($request, $response, $pdo, $searchPattern,
],
],
],
"handle" => (string)($registrarDetails['iana_id'] ?: 'R' . $registrarDetails['id'] . '-' . $c['roid'] . ''),
"handle" => (string)($registrarDetails['iana_id'] ?: 'R' . $registrarDetails['id'] . '-' . $roid . ''),
"links" => [
[
"href" => $c['rdap_url'] . "/entity/" . ($registrarDetails['iana_id'] ?: $registrarDetails['id']),
@ -2654,7 +2672,7 @@ function handleNameserverSearchQuery($request, $response, $pdo, $searchPattern,
],
],
),
'handle' => 'H' . $hostDetails['id'] . '-' . $c['roid'] . '',
'handle' => 'H' . $hostDetails['id'] . '-' . $roid . '',
'ipAddresses' => $ipAddresses,
'events' => $events,
'ldhName' => $hostDetails['name'],
@ -2986,6 +3004,9 @@ function handleEntitySearchQuery($request, $response, $pdo, $searchPattern, $c,
}
}
$stmt = $pdo->query("SELECT value FROM settings WHERE name = 'handle'");
$roid = $stmt->fetchColumn();
// Construct the RDAP response in JSON format
$rdapResponse = [
'rdapConformance' => [
@ -2999,7 +3020,7 @@ function handleEntitySearchQuery($request, $response, $pdo, $searchPattern, $c,
[
'objectClassName' => 'entity',
'entities' => $entityBlocks,
"handle" => (string)($registrarDetails['iana_id'] ?: 'R' . $registrarDetails['id'] . '-' . $c['roid'] . ''),
"handle" => (string)($registrarDetails['iana_id'] ?: 'R' . $registrarDetails['id'] . '-' . $roid . ''),
'events' => $events,
'links' => [
[