2018-12-10 16:33:34 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
ISO_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
|
|
|
|
|
2018-12-23 17:21:41 +00:00
|
|
|
# Ensure registry repository is up-to-date
|
2018-12-26 21:47:45 +00:00
|
|
|
git -C ../registry/ pull upstream master:master --quiet 2>&1
|
2018-12-23 17:21:41 +00:00
|
|
|
|
|
|
|
# Checkout master branch in dn42/repository
|
|
|
|
git -C ../registry/ checkout master --quiet
|
|
|
|
|
2019-01-04 11:18:41 +00:00
|
|
|
# Do a git pull beforehand to ensure our repository is up-to-date
|
2019-01-04 11:21:36 +00:00
|
|
|
git checkout master --quiet
|
2019-01-04 14:43:52 +00:00
|
|
|
git pull origin master:master --quiet --rebase
|
2019-01-04 11:18:41 +00:00
|
|
|
|
|
|
|
# Do the same for sub-repo if exists
|
|
|
|
if [ -d roa/.git/ ] ; then
|
|
|
|
git -C roa/ checkout master --quiet
|
|
|
|
if [ $(git -C roa/ remote | grep origin) ] ; then
|
2019-01-04 14:43:52 +00:00
|
|
|
git -C roa/ pull origin master:master --quiet --rebase
|
2019-01-04 11:18:41 +00:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2018-12-23 17:21:41 +00:00
|
|
|
# Update with data from registry
|
|
|
|
php roagen.php
|
|
|
|
php rfc8416.php
|
|
|
|
|
2019-01-04 10:11:22 +00:00
|
|
|
# Ensure sub-repo is created to track roa file udpates
|
|
|
|
if [ ! -d roa/ ] ; then mkdir roa ; fi
|
2019-01-04 14:43:52 +00:00
|
|
|
if [ ! -f roa/.git/config ] ; then
|
2019-01-04 10:11:22 +00:00
|
|
|
git -C roa/ init
|
|
|
|
if [ ! -f roa/README.md ; then
|
|
|
|
touch roa/README.md
|
|
|
|
echo '## roas' | tee roa/README.md ; fi
|
|
|
|
git -C roa/ commit --allow-empty -m "Initial commit"
|
2019-01-04 10:31:03 +00:00
|
|
|
git -C roa/ commit README.md -m "Add README.md" ; fi
|
2019-01-04 10:11:22 +00:00
|
|
|
|
2018-12-23 20:53:22 +00:00
|
|
|
# Write out last commit to file
|
2019-01-03 13:37:29 +00:00
|
|
|
echo "## Notes
|
|
|
|
|
|
|
|
- These files are Bird 1.x compatible:
|
2019-01-05 23:41:44 +00:00
|
|
|
- [bird_roa_dn42.conf](bird_roa_dn42.conf)
|
|
|
|
- [bird4_roa_dn42.conf](bird4_roa_dn42.conf)
|
|
|
|
- [bird6_roa_dn42.conf](bird6_roa_dn42.conf)
|
2019-01-03 13:37:29 +00:00
|
|
|
- These files are Bird 2.x compatible:
|
2019-01-05 23:41:44 +00:00
|
|
|
- [bird_route_dn42.conf](bird_route_dn42.conf)
|
|
|
|
- [bird4_route_dn42.conf](bird4_route_dn42.conf)
|
|
|
|
- [bird6_route_dn42.conf](bird6_route_dn42.conf)
|
2019-01-05 23:36:31 +00:00
|
|
|
- These files are [Routinator][2] compatible:
|
2019-01-05 23:41:44 +00:00
|
|
|
- [export_rfc8416_dn42.json](export_rfc8416_dn42.json) _(SLURM standard, format specified in [RFC 8416][4])_
|
2019-01-05 23:36:31 +00:00
|
|
|
- These files are [gortr][3] compatible:
|
2019-01-05 23:41:44 +00:00
|
|
|
- [export_dn42.json](export_dn42.json)
|
2019-01-03 13:37:29 +00:00
|
|
|
|
2019-01-06 20:21:41 +00:00
|
|
|
## [Last merge commit][0] at [dn42 registry][1]
|
2018-12-23 20:53:22 +00:00
|
|
|
|
|
|
|
\`\`\`
|
2019-01-05 18:02:18 +00:00
|
|
|
$(git -C ../registry/ log -n 1 --merges)
|
2019-01-05 17:35:06 +00:00
|
|
|
\`\`\`
|
|
|
|
|
2019-01-06 20:21:41 +00:00
|
|
|
## crontab
|
|
|
|
|
|
|
|
You can setup a cronjob to check in with updates to the ROA files listed
|
|
|
|
above on regular intervals.
|
|
|
|
|
|
|
|
Currently the ROA files published here is refreshed every 3rd hour if
|
|
|
|
updates has been made to the [DN42 registry[1].
|
|
|
|
|
2019-01-05 23:16:05 +00:00
|
|
|
## Misc statistics
|
|
|
|
|
|
|
|
- ROAs IPv4: $(cat roa/bird4_route_dn42.conf | grep -v '^#' | grep -v '^$' | wc -l)
|
|
|
|
- ROAs IPv6: $(cat roa/bird6_route_dn42.conf | grep -v '^#' | grep -v '^$' | wc -l)
|
|
|
|
- ROAs total: $(cat roa/bird_route_dn42.conf | grep -v '^#' | grep -v '^$' | wc -l)
|
|
|
|
|
2019-01-05 18:02:18 +00:00
|
|
|
[0]: https://git.dn42.us/dn42/registry/commit/$(git -C ../registry/ log -n 1 --merges --pretty='format:%H')
|
2019-01-05 17:35:06 +00:00
|
|
|
[1]: https://git.dn42.us/dn42/registry
|
2019-01-05 23:36:31 +00:00
|
|
|
[2]: https://github.com/NLnetLabs/routinator
|
|
|
|
[3]: https://github.com/cloudflare/gortr
|
|
|
|
[4]: https://tools.ietf.org/html/rfc8416
|
2019-01-05 17:35:06 +00:00
|
|
|
" > roa/README.md
|
2018-12-23 20:53:22 +00:00
|
|
|
|
2018-12-14 18:51:54 +00:00
|
|
|
# Commit latest version of ROA files
|
2019-01-04 10:31:03 +00:00
|
|
|
git -C roa/ add README.md *.conf *.json
|
|
|
|
git -C roa/ commit -m "Updated ROA files - $ISO_DATE" --quiet
|
2018-12-10 16:33:34 +00:00
|
|
|
|
2019-01-04 10:16:37 +00:00
|
|
|
# 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
|
|
|
|
|
|
|
|
# Push local roagen repository to every remote configured
|
2018-12-23 20:53:22 +00:00
|
|
|
for REMOTE in $(git remote | egrep -v upstream | paste -sd " " -) ; do git push $REMOTE master:master --quiet ; done
|