usage: netcalc split [-h] NETWORK LENGTH [MAXLENGTH]
netcalc split: error: argument LENGTH: invalid int value: '172.31.16.0/21'
This commit is contained in:
parent
ee80d07fb6
commit
f094a6e4cc
@ -10,3 +10,5 @@
|
|||||||
|
|
||||||
${tld:-lixo} CNAME rpz-passthru.
|
${tld:-lixo} CNAME rpz-passthru.
|
||||||
*.${tld:-lixo} CNAME rpz-passthru.
|
*.${tld:-lixo} CNAME rpz-passthru.
|
||||||
|
{{ range "$root_reverse_zones" | split "," }}*.{{ . }} CNAME rpz-passthru.
|
||||||
|
{{ end }}
|
||||||
|
@ -60,6 +60,14 @@ view "lixonet" {
|
|||||||
forwarders { ${bind_forward_address-"${internal_gateway}"}; };
|
forwarders { ${bind_forward_address-"${internal_gateway}"}; };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Local reverse zone forwarders
|
||||||
|
{{ if len "${local_reverse_zones:-}" }}{{ range "$local_reverse_zones" | split "," }}zone "{{ . }}" {
|
||||||
|
type forward;
|
||||||
|
forward only;
|
||||||
|
forwarders { ${bind_forward_address-"${internal_gateway}"}; };
|
||||||
|
};
|
||||||
|
{{ end }}{{ end }}
|
||||||
|
|
||||||
# Peer forwarding zones
|
# Peer forwarding zones
|
||||||
{{ range files "bind/peers" }} {{ if ne . "${tinc_peer_name}" }}
|
{{ range files "bind/peers" }} {{ if ne . "${tinc_peer_name}" }}
|
||||||
zone "{{ . | replace "_" "." }}" {
|
zone "{{ . | replace "_" "." }}" {
|
||||||
@ -69,10 +77,10 @@ view "lixonet" {
|
|||||||
};{{ end }}{{ end }}
|
};{{ end }}{{ end }}
|
||||||
|
|
||||||
# Custom mesh zones
|
# Custom mesh zones
|
||||||
{{ range files "bind/zones" }}
|
{{ range files "bind/zones" }}zone "{{ . | replace "_" "." }}" {
|
||||||
zone "{{ . | replace "_" "." }}" {
|
|
||||||
{{ include (print "bind/zones/" .) }}
|
{{ include (print "bind/zones/" .) }}
|
||||||
};{{ end }}
|
};
|
||||||
|
{{ end }}
|
||||||
};
|
};
|
||||||
|
|
||||||
view "default" {
|
view "default" {
|
||||||
|
10
build.sh
10
build.sh
@ -7,6 +7,8 @@ process_template ( ) {
|
|||||||
rm $1
|
rm $1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function join_by { local IFS="$1"; shift; echo "$*"; }
|
||||||
|
|
||||||
process_templates ( ) {
|
process_templates ( ) {
|
||||||
for template_filename in `find $1 -type f -name '*.tmpl'`
|
for template_filename in `find $1 -type f -name '*.tmpl'`
|
||||||
do
|
do
|
||||||
@ -18,8 +20,6 @@ topdir=`pwd`
|
|||||||
|
|
||||||
for dir in `find /etc/lixonet/* -type d -maxdepth 0`
|
for dir in `find /etc/lixonet/* -type d -maxdepth 0`
|
||||||
do
|
do
|
||||||
echo "Inspecting $dir..."
|
|
||||||
|
|
||||||
dir=${dir%*/} # remove the trailing "/"
|
dir=${dir%*/} # remove the trailing "/"
|
||||||
netname=${dir##*/} # print everything after the final "/"
|
netname=${dir##*/} # print everything after the final "/"
|
||||||
|
|
||||||
@ -29,6 +29,12 @@ do
|
|||||||
if [ -z "$git" ]; then echo "Missing 'git' variable in $dir/lixonet.conf"; exit 1; fi
|
if [ -z "$git" ]; then echo "Missing 'git' variable in $dir/lixonet.conf"; exit 1; fi
|
||||||
sigil_vars=$(cat /etc/lixonet/${netname}/lixonet.conf | tr "\\n" " ")
|
sigil_vars=$(cat /etc/lixonet/${netname}/lixonet.conf | tr "\\n" " ")
|
||||||
|
|
||||||
|
# Parse subnets into a collection of IP reverse zones
|
||||||
|
root_reverse_zones=$(echo '${network_address}/${global_prefix:-16}' | sigil -p $sigil_vars | xargs -I '{}' netcalc split {} 24 | sed 's/.0\/24$//' | awk 'BEGIN{FS="."}{print $3"."$2"."$1".in-addr.arpa"}' | sed -e ':a;N;$!ba;s/\n/,/g')
|
||||||
|
sigil_vars=$(echo "$sigil_vars root_reverse_zones=$root_reverse_zones")
|
||||||
|
local_reverse_zones=$(echo "$bgp_routes" | tr "," "\n" | xargs -I '{}' netcalc split {} 24 | sed 's/.0\/24$//' | awk 'BEGIN{FS="."}{print $3"."$2"."$1".in-addr.arpa"}' | sed -e ':a;N;$!ba;s/\n/,/g')
|
||||||
|
sigil_vars=$(echo "$sigil_vars local_reverse_zones=$local_reverse_zones")
|
||||||
|
|
||||||
echo "Configuring Lixonet3 network $netname from $git..."
|
echo "Configuring Lixonet3 network $netname from $git..."
|
||||||
echo "Variables: $sigil_vars"
|
echo "Variables: $sigil_vars"
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user