diff --git a/update-dns.sh b/update-dns.sh index 41cd7bc..f46d91a 100755 --- a/update-dns.sh +++ b/update-dns.sh @@ -15,6 +15,7 @@ export DNSSCRIPT_SERVER_NAME=dns.herpf.fff.community UpdateScriptsFolder="/usr/lib/ffdns/" ZoneFilesFolder="/etc/bind/fff/" BindIncludeFileFolder="/etc/bind/" +RoutingTables="10" # -1 -> disable bind [restart|reload] # 0 -> Debian (and like) systemctl [reload|restart] bind9 @@ -117,7 +118,7 @@ for Hood in $Hoods; do ./update-extzone.sh "$HoodZoneFile" "$ExternFile" "$HoodDomain" "$ExternalView" done -./update-public-acl.sh "$BindIcvpnAclTmp" "$RemoteLocation" +./update-public-acl.sh "$BindIcvpnAclTmp" "$RemoteLocation" "$RoutingTables" ReConfigBind=1 UpdateBindConfig() { diff --git a/update-public-acl.sh b/update-public-acl.sh index 9e8ad90..7a871ec 100755 --- a/update-public-acl.sh +++ b/update-public-acl.sh @@ -4,17 +4,23 @@ IncludeFile="$1" RemoteLocation="$2" +Tables="$3" rm -f "$IncludeFile" -InstalledRoutes="$(echo "dump" | nc ::1 33123 | \ - sed -e '/\(add route .* installed yes\|add xroute\)/!d')" -PublicSubs="$(echo "$InstalledRoutes" | \ - sed -e '/\( from ::\/0\| from 0\.0\.0\.0\/0\)/d;s/.* from \(\S\+\).*/\t\1;/g')" +Installed4Routes="" +Installed6Routes="" +for Table in $Tables; do + Installed4Routes="$(echo "$Installed4Routes" && ip -4 ro sh ta "$Table")" + Installed6Routes="$(echo "$Installed6Routes" && ip -6 ro sh ta "$Table")" +done +PublicSubs="$(echo "$Installed6Routes" | \ + sed -e '/^default from/!d;s/.* from \(\S\+\).*/\t\1;/g')" PrivatePrefix="\(192\.168\.\|172\.\(1[6-9]\|2[0-9]\|3[01]\)\.\|10\.\|[fF][cCdD][0-9a-fA-F]\{2\}:\)" -PublicSingles="$(echo "$InstalledRoutes" | \ - sed -e '/\( from ::\/0\| from 0\.0\.0\.0\/0\)/!d;s/.* prefix \(\S\+\) .*/\1/g;'" \ - "'/^'"$PrivatePrefix"'/d;/^\(0\.\|::\|64:ff9b::\)/d;s/^/\t/g;s/$/;/g')" +PublicSingles="$(echo "$Installed4Routes" | \ + sed -e 's/^\(\S\+\)\s.*/\t\1;/g;/^\t'"$PrivatePrefix"'\|^\t\(default\|0\.\)\|^$/d' \ + && echo "$Installed6Routes" | \ + sed -e 's/^\(\S\+\)\s.*/\t\1;/g;/^\t'"$PrivatePrefix"'\|^\t\(default\|::\|64:ff9b::\)\|^$/d')" { echo "acl icvpnrange {"