1
0
Fork 0

Update roagen.php

o Added generator for bird roa file
This commit is contained in:
netravnen 2018-12-14 18:28:27 +00:00
parent f355060e9a
commit dd79b8f4d2
1 changed files with 26 additions and 1 deletions

View File

@ -238,10 +238,35 @@ foreach ($raw_array as $sub_array)
$json = json_encode ($roas, JSON_UNESCAPED_SLASHES|JSON_PRETTY_PRINT);
// Write JSON to file
$fp = fopen ('dn42-rpki-export.json', 'w');
$fp = fopen ('roa/export_dn42.json', 'w');
fwrite ($fp, $json);
fclose ($fp);
// Write TEXT to file in bird format
$fq = fopen ('roa/bird_roa_dn42.conf', 'w');
$fr = fopen ('roa/bird4_roa_dn42.conf', 'w');
$fs = fopen ('roa/bird6_roa_dn42.conf', 'w');
foreach ($roas["roas"] as $roa)
{
$prfx = $roa["prefix"];
$mxLngth = $roa["maxLength"];
$sn = $roa["asn"];
$strng = "roa $prfx max $mxLngth as $sn;\n";
fwrite ($fq, $strng);
if (strpos ($prfx, ":") !== false)
fwrite ($fr, $strng);
else
fwrite ($fs, $strng);
}
fclose ($fq);
fclose ($fr);
fclose ($fs);
// Commit and push to all git remote repositories
echo shell_exec ("./update.sh 2>&1");