Merge branch 'less-info'

* less-info:
  increase roa file TTL 3 to 5 days
  less commit info included and human readable info omitted for less file size
This commit is contained in:
Netravnen 2020-07-21 23:30:54 +00:00
commit 9f3a1aafaf
4 changed files with 18 additions and 78 deletions

View file

@ -60,18 +60,6 @@ function writeBirdConfig ($roas)
$bird2_fq4 = fopen ('roa/bird4_route_dn42.conf', 'w'); $bird2_fq4 = fopen ('roa/bird4_route_dn42.conf', 'w');
$bird2_fq6 = fopen ('roa/bird6_route_dn42.conf', 'w'); $bird2_fq6 = fopen ('roa/bird6_route_dn42.conf', 'w');
/*
fwrite ($bird1_fq, shell_exec ("/usr/bin/git -C ../registry/ log -n 1 --merges | sed 's/^/# /g'"));
fwrite ($bird1_fq4, shell_exec ("/usr/bin/git -C ../registry/ log -n 1 --merges | sed 's/^/# /g'"));
fwrite ($bird1_fq6, shell_exec ("/usr/bin/git -C ../registry/ log -n 1 --merges | sed 's/^/# /g'"));
*/
/*
fwrite ($bird2_fq, shell_exec ("/usr/bin/git -C ../registry/ log -n 1 --merges | sed 's/^/# /g'"));
fwrite ($bird2_fq4, shell_exec ("/usr/bin/git -C ../registry/ log -n 1 --merges | sed 's/^/# /g'"));
fwrite ($bird2_fq6, shell_exec ("/usr/bin/git -C ../registry/ log -n 1 --merges | sed 's/^/# /g'"));
*/
foreach ($roas["roas"] as $roa) foreach ($roas["roas"] as $roa)
{ {
$prefix = $roa["prefix"]; $prefix = $roa["prefix"];

View file

@ -106,8 +106,6 @@ foreach ($raw_array as $sub_array)
$roas["locallyAddedAssertions"]["prefixAssertions"][$k]["asn"] = trim ($_asn[0], "AS"); $roas["locallyAddedAssertions"]["prefixAssertions"][$k]["asn"] = trim ($_asn[0], "AS");
$roas["locallyAddedAssertions"]["prefixAssertions"][$k]["prefix"] = $_prefix; $roas["locallyAddedAssertions"]["prefixAssertions"][$k]["prefix"] = $_prefix;
$roas["locallyAddedAssertions"]["prefixAssertions"][$k]["maxPrefixLength"] = ($_asn[0] != "AS0" ? $_maxlength : MAX_LEN_IPV6_AS0); $roas["locallyAddedAssertions"]["prefixAssertions"][$k]["maxPrefixLength"] = ($_asn[0] != "AS0" ? $_maxlength : MAX_LEN_IPV6_AS0);
//$roas["locallyAddedAssertions"]["prefixAssertions"][$k]["url"]["inetnum"] = "$web_registry_url/data/inet6num/$prefix[1]_$prefix[2]";
//$roas["locallyAddedAssertions"]["prefixAssertions"][$k]["url"]["route"] = "$web_registry_url/data/route6/$prefix[1]_$prefix[2]";
$roas["locallyAddedAssertions"]["prefixAssertions"][$k]["source"] = "$_ta"; $roas["locallyAddedAssertions"]["prefixAssertions"][$k]["source"] = "$_ta";
$roas["locallyAddedAssertions"]["prefixAssertions"][$k]["mnt-by"] = "$_mnt"; $roas["locallyAddedAssertions"]["prefixAssertions"][$k]["mnt-by"] = "$_mnt";
@ -208,8 +206,6 @@ foreach ($raw_array as $sub_array)
$roas["locallyAddedAssertions"]["prefixAssertions"][$k]["asn"] = trim ($_asn[0], "AS"); $roas["locallyAddedAssertions"]["prefixAssertions"][$k]["asn"] = trim ($_asn[0], "AS");
$roas["locallyAddedAssertions"]["prefixAssertions"][$k]["prefix"] = $_prefix; $roas["locallyAddedAssertions"]["prefixAssertions"][$k]["prefix"] = $_prefix;
$roas["locallyAddedAssertions"]["prefixAssertions"][$k]["maxPrefixLength"] = ($_asn[0] != "AS0" ? $_maxlength : MAX_LEN_IPV4_AS0); $roas["locallyAddedAssertions"]["prefixAssertions"][$k]["maxPrefixLength"] = ($_asn[0] != "AS0" ? $_maxlength : MAX_LEN_IPV4_AS0);
//$roas["locallyAddedAssertions"]["prefixAssertions"][$k]["url"]["inetnum"] = "$web_registry_url/data/inetnum/$prefix[1]_$prefix[2]";
//$roas["locallyAddedAssertions"]["prefixAssertions"][$k]["url"]["route"] = "$web_registry_url/data/route/$prefix[1]_$prefix[2]";
$roas["locallyAddedAssertions"]["prefixAssertions"][$k]["source"] = "$_ta"; $roas["locallyAddedAssertions"]["prefixAssertions"][$k]["source"] = "$_ta";
$roas["locallyAddedAssertions"]["prefixAssertions"][$k]["mnt-by"] = "$_mnt"; $roas["locallyAddedAssertions"]["prefixAssertions"][$k]["mnt-by"] = "$_mnt";
@ -217,35 +213,6 @@ foreach ($raw_array as $sub_array)
} }
} }
//$roas["metadata"]["human"]["commit"] = shell_exec ("/usr/bin/git -C ../registry/ log -n 1 --date=iso8601 --merges --pretty='format:%H'");
//$roas["metadata"]["human"]["merge"] = shell_exec ("/usr/bin/git -C ../registry/ log -n 1 --date=iso8601 --merges --pretty='format:%p'");
//$roas["metadata"]["human"]["author"] = shell_exec ("/usr/bin/git -C ../registry/ log -n 1 --date=iso8601 --merges --pretty='format:%an'");
//$roas["metadata"]["human"]["date"] = shell_exec ("/usr/bin/git -C ../registry/ log -n 1 --date=iso8601 --merges --pretty='format:%aD'");
//$roas["metadata"]["human"]["subject"] = shell_exec ("/usr/bin/git -C ../registry/ log -n 1 --date=iso8601 --merges --pretty='format:%s'");
//$roas["metadata"]["human"]["url"] = "https://git.dn42.us/dn42/registry/commit/";
//$roas["metadata"]["human"]["url"] .= $roas["metadata"]["human"]["commit"];
/*
* Function: Add metadata
*
* Add info
* 1. generation time (now),
* 2. expire time (now + 3 days),
* 3. number of routes
*
* Numbers must be unquoted integers, and timeformat must
* be epoch format. TImezone is set to Etc/UTC.
*/
//$roas["metadata"]["counts"] = (int)count($roas["locallyAddedAssertions"]["prefixAssertions"]);
//$roas["metadata"]["generated"] = (int)(date_format(new \DateTime("now",new \DateTimeZone("UTC")),"U"));
//$roas["metadata"]["valid"] = (int)(date_format(date_modify(new \DateTime("now",new \DateTimeZone("UTC")),"+3day"),"U"));
//$roas["metadata"]["signature"] = "";
//$roas["metadata"]["signatureData"] = "";
// Additional human read-able DateTime format, example: 2013-04-12T15:52:01+00:00
//$roas["metadata"]["human"]["generated"] = date_format(new \DateTime("now",new \DateTimeZone("UTC")),"c");
//$roas["metadata"]["human"]["valid"] = date_format(date_modify(new \DateTime("now",new \DateTimeZone("UTC")),"+3day"),"c");
writeRoutinatorExceptionFile($roas); writeRoutinatorExceptionFile($roas);
?> ?>

View file

@ -211,14 +211,6 @@ foreach ($raw_array as $sub_array)
} }
} }
$roas["metadata"]["human"]["commit"] = shell_exec ("/usr/bin/git -C ../registry/ log -n 1 --date=iso8601 --merges --pretty='format:%H'");
$roas["metadata"]["human"]["merge"] = shell_exec ("/usr/bin/git -C ../registry/ log -n 1 --date=iso8601 --merges --pretty='format:%p'");
$roas["metadata"]["human"]["author"] = shell_exec ("/usr/bin/git -C ../registry/ log -n 1 --date=iso8601 --merges --pretty='format:%an'");
$roas["metadata"]["human"]["date"] = shell_exec ("/usr/bin/git -C ../registry/ log -n 1 --date=iso8601 --merges --pretty='format:%aD'");
$roas["metadata"]["human"]["subject"] = shell_exec ("/usr/bin/git -C ../registry/ log -n 1 --date=iso8601 --merges --pretty='format:%s'");
$roas["metadata"]["human"]["url"] = "https://git.dn42.us/dn42/registry/commit/";
$roas["metadata"]["human"]["url"] .= $roas["metadata"]["human"]["commit"];
/* /*
* Function: Add metadata * Function: Add metadata
* *
@ -232,13 +224,7 @@ $roas["metadata"]["human"]["url"] .= $roas["metadata"]["human"]["commit"];
*/ */
$roas["metadata"]["counts"] = (int)count($roas["roas"]); $roas["metadata"]["counts"] = (int)count($roas["roas"]);
$roas["metadata"]["generated"] = (int)(date_format(new \DateTime("now",new \DateTimeZone("UTC")),"U")); $roas["metadata"]["generated"] = (int)(date_format(new \DateTime("now",new \DateTimeZone("UTC")),"U"));
$roas["metadata"]["valid"] = (int)(date_format(date_modify(new \DateTime("now",new \DateTimeZone("UTC")),"+3day"),"U")); $roas["metadata"]["valid"] = (int)(date_format(date_modify(new \DateTime("now",new \DateTimeZone("UTC")),"+5day"),"U"));
//$roas["metadata"]["signature"] = "";
//$roas["metadata"]["signatureData"] = "";
// Additional human read-able DateTime format, example: 2013-04-12T15:52:01+00:00
$roas["metadata"]["human"]["generated"] = date_format(new \DateTime("now",new \DateTimeZone("UTC")),"c");
$roas["metadata"]["human"]["valid"] = date_format(date_modify(new \DateTime("now",new \DateTimeZone("UTC")),"+3day"),"c");
writeExportJSON($roas); writeExportJSON($roas);
writeBirdConfig($roas); writeBirdConfig($roas);

View file

@ -3,32 +3,29 @@
ISO_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ") ISO_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
# Ensure registry repository is up-to-date # Ensure registry repository is up-to-date
git -C ../registry/ pull upstream master:master --quiet 2>&1 #git -C ../registry/ pull upstream master:master --quiet 2>&1
# Checkout master branch in dn42/repository # Checkout master branch in dn42/repository
git -C ../registry/ checkout master --quiet git -C ../registry/ checkout master --quiet
# Do a git pull beforehand to ensure our repository is up-to-date # Do a git pull beforehand to ensure our repository is up-to-date
git checkout master --quiet #git checkout master --quiet
git pull origin master:master --quiet --rebase #git pull origin master:master --quiet --rebase
if ! [ -d roa ] ; then mkdir -p roa ; fi
if ! [ -d roa/ ] ; then mkdir -p roa ; fi
for file in README.md {bird,bird4,bird6}_{route,roa}_dn42.conf export{_rfc8416,}_dn42.json ; do for file in README.md {bird,bird4,bird6}_{route,roa}_dn42.conf export{_rfc8416,}_dn42.json ; do
if ! [ -f roa/$file ] ; then touch roa/$file ; fi if ! [ -f roa/$file ] ; then touch roa/$file ; fi
done done
# Do the same for sub-repo if exists # Do the same for sub-repo if exists
if [ -d roa/.git/ ] ; then if [ -d roa/.git ] ; then
git -C roa/ checkout master --quiet git -C roa/ checkout master --quiet
if [ $(git -C roa/ remote | grep origin) ] ; then if [ $(git -C roa/ remote | grep origin) ] ; then
git -C roa/ pull origin master:master --quiet --rebase git -C roa/ pull origin master:master --quiet --rebase
fi fi
fi fi
# Update with data from registry
php roagen.php
php rfc8416.php
# Ensure sub-repo is created to track roa file udpates # Ensure sub-repo is created to track roa file udpates
if [ ! -d roa/ ] ; then mkdir roa ; fi if [ ! -d roa/ ] ; then mkdir roa ; fi
if [ ! -f roa/.git/config ] ; then if [ ! -f roa/.git/config ] ; then
@ -39,6 +36,10 @@ if [ ! -f roa/.git/config ] ; then
git -C roa/ commit --allow-empty -m "Initial commit" git -C roa/ commit --allow-empty -m "Initial commit"
git -C roa/ commit README.md -m "Add README.md" ; fi git -C roa/ commit README.md -m "Add README.md" ; fi
# Update with data from registry
php roagen.php
php rfc8416.php
# Write out last commit to file # Write out last commit to file
echo "## Notes echo "## Notes
@ -57,15 +58,12 @@ echo "## Notes
Note the gortr source file is DateTime stamped only, it is not signed with any certificaty. So you will need to add Note the gortr source file is DateTime stamped only, it is not signed with any certificaty. So you will need to add
\`-verify=false\` as a runtime parameter when loading the cache file. Alternatively, use gortr with a slurm file \`-verify=false\` as a runtime parameter when loading the cache file. Alternatively, use gortr with a slurm file
instead (e.g. `-slurm export_rfc8416_dn42.json`) as a command-line parameter. instead (e.g. \`-slurm export_rfc8416_dn42.json\`) as a command-line parameter.
## [Last merge commit][0] at [dn42 registry][1] ## [Last merge commit][0] at [dn42 registry][1]
\`\`\` \`\`\`
$(git -C ../registry/ log -n 1 --date=iso8601 --merges | $(git -C ../registry/ log -n 1 --date=iso8601 --merges | grep -v Reviewed- | grep -v Author | sed -E -e 's/^[Cc]ommit ([a-f0-9]+).*/Commit \1/' -e 's/[ ]+$//g')
sed -E -e 's/^Author: ([a-zA-Z0-9]+) <.*>/Author: \1/' \
-e 's/^commit ([a-f0-9]+) .*/commit \1/' \
-e 's/[ ]+$//g' )
\`\`\` \`\`\`
## crontab ## crontab
@ -104,7 +102,8 @@ git -C roa/ add README.md *.conf *.json *.sha256
git -C roa/ commit -m "Updated ROA files - $ISO_DATE" --quiet git -C roa/ commit -m "Updated ROA files - $ISO_DATE" --quiet
# Push ROA repository to every remote configured # Push ROA repository to every remote configured
for REMOTE in $(git -C roa/ remote | egrep -v upstream | paste -sd " " -) ; do git -C roa/ push $REMOTE master:master --quiet ; done if [ $(git -C roa/ remote | grep -vi upstream | wc -l) > 0 ] ; then
for REMOTE in $(git -C roa/ remote | grep -vi upstream | paste -sd " " -) ; do
# Push local roagen repository to every remote configured git -C roa/ push $REMOTE master:master --quiet
for REMOTE in $(git remote | egrep -v upstream | paste -sd " " -) ; do git push $REMOTE master:master --quiet ; done done
fi