A shell script fragment to generate a BIND ACL from an IRR object
#!/bin/bash | |
# | |
# Using IRR and BGPQ3 to auto-generate BIND ACLs | |
# Kenneth Finnegan, 2019 | |
# The IRR aut-num or as-set to generate the ACL off of | |
ACL_AS_SET='AS7034:AS-DNS' | |
( | |
bgpq3 -j -4 -l ACL $ACL_AS_SET; | |
bgpq3 -j -6 -l ACL $ACL_AS_SET; | |
) | \ | |
# Parse out just the prefixes from the JSON | |
jq '.ACL[].prefix' | \ | |
# Format it as a BIND ACL | |
awk -F '"' 'BEGIN {print "// BIND DNS ACL generated from IRR"} | |
BEGIN {print "acl \"serviceacl\" {" } | |
{print " " $2 ";"} | |
END {print "};"}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment