Created
January 16, 2019 05:56
-
-
Save PhirePhly/ed5b6c20b21f6f16d1f7da980829b05c to your computer and use it in GitHub Desktop.
A shell script fragment to generate a BIND ACL from an IRR object
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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