BRDA fixes

This commit is contained in:
Pinga 2023-12-01 20:14:51 +02:00
parent c06c7c3496
commit 0a4057f812
2 changed files with 307 additions and 299 deletions

View file

@ -14,6 +14,7 @@ return [
'escrow_deleteXML' => false,
'escrow_RDEupload' => false,
'escrow_BRDAupload' => false,
'escrow_BRDAday' => 'Tuesday',
'escrow_keyPath' => '/opt/escrow/escrowKey.asc',
'escrow_keyPath_brda' => '/opt/escrow/icann-brda-gpg.pub',
'escrow_privateKey' => '/opt/escrow/privatekey.asc',

View file

@ -530,7 +530,7 @@ try {
$reportXML->writeElement('rdeReport:version', '1');
$reportXML->writeElement('rdeReport:rydeSpecEscrow', 'RFC8909');
$reportXML->writeElement('rdeReport:rydeSpecMapping', 'RFC9022');
$reportXML->writeElement('rdeReport:resend', $deposit_id['revision']);
$reportXML->writeElement('rdeReport:resend', $finalDepositId);
$currentDateTime = new DateTime();
$crDateWithMilliseconds = $currentDateTime->format("Y-m-d\TH:i:s.v\Z");
$reportXML->writeElement('rdeReport:crDate', $crDateWithMilliseconds);
@ -584,6 +584,10 @@ try {
$reportFilePath = $c['escrow_deposit_path']."/{$tldname}_".date('Y-m-d')."_full_R{$finalDepositId}.rep";
file_put_contents($reportFilePath, $reps, LOCK_EX);
$dayOfWeekToRunBRDA = $c['escrow_BRDAday'];
$currentDayOfWeek = date('l');
if ($currentDayOfWeek === $dayOfWeekToRunBRDA) {
// Start BRDA generation
$xml = new XMLWriter();
$xml->openMemory();
@ -797,12 +801,12 @@ try {
$deposit = $xml->outputMemory();
// Define the base name without the extension
$baseFileName = "{$tldname}_".date('Y-m-d')."_brda_S1_R{$finalDepositId}";
$baseFileNameBrda = "{$tldname}_".date('Y-m-d')."_brda_S1_R{$finalDepositId}";
// XML, tar, and gzip filenames
$xmlFileName = $baseFileName . ".xml";
$tarFileName = $baseFileName . ".tar";
$gzipFileName = $baseFileName . ".tar.gz";
$xmlFileName = $baseFileNameBrda . ".xml";
$tarFileName = $baseFileNameBrda . ".tar";
$gzipFileName = $baseFileNameBrda . ".tar.gz";
// Save the main XML file
file_put_contents($c['escrow_deposit_path']."/".$xmlFileName, $deposit, LOCK_EX);
@ -851,12 +855,12 @@ try {
}
// Save the encrypted data to a new file
file_put_contents($c['escrow_deposit_path'] . "/" . $baseFileName . ".ryde", $encryptedData);
file_put_contents($c['escrow_deposit_path'] . "/" . $baseFileNameBrda . ".ryde", $encryptedData);
// Delete the original .tar.gz file
unlink($c['escrow_deposit_path'] . "/" . $gzipFileName);
$encryptedFilePathBrda = $c['escrow_deposit_path'] . "/" . $baseFileName . ".ryde";
$encryptedFilePathBrda = $c['escrow_deposit_path'] . "/" . $baseFileNameBrda . ".ryde";
// Initialize the GnuPG extension
$gpg = new gnupg();
@ -883,6 +887,7 @@ try {
// Optionally, delete the encrypted file if you don't need it anymore
// unlink($encryptedFilePathBrda);
}
if ($c['escrow_RDEupload']) {
// Connect to the SFTP server
@ -944,6 +949,7 @@ try {
}
if ($currentDayOfWeek === $dayOfWeekToRunBRDA) {
if ($c['escrow_BRDAupload']) {
// Connect to the SFTP server
$sftp = new SFTP($c['brda_sftp_host']);
@ -971,6 +977,7 @@ try {
}
}
}
}
$depositDate = date('Y-m-d');
$fileName = $c['escrow_deposit_path'] . "/" . $baseFileName . ".ryde";