diff --git a/README.md b/README.md index 75e0a6f..9493340 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ In der Datei update-dns.sh die Konfigurationsparameter setzen. #### Cron anlegen -Schließlich muss noch ein Cron angelegt werden, der regelmäßig das Skript aufruft, welches die Zonendatei aktualisiert und die Reverse-Skripte aufruft: +Schließlich muss noch ein Cron angelegt werden, der regelmäßig das Skript aufruft: ``` 1-59/5 * * * * /usr/lib/ffdns/update-dns.sh ``` diff --git a/update-dns.sh b/update-dns.sh index a511619..41cd7bc 100755 --- a/update-dns.sh +++ b/update-dns.sh @@ -117,7 +117,7 @@ for Hood in $Hoods; do ./update-extzone.sh "$HoodZoneFile" "$ExternFile" "$HoodDomain" "$ExternalView" done -./update-public-acl.sh "$BindIcvpnAclTmp" +./update-public-acl.sh "$BindIcvpnAclTmp" "$RemoteLocation" ReConfigBind=1 UpdateBindConfig() { diff --git a/update-public-acl.sh b/update-public-acl.sh index 446c556..9e8ad90 100755 --- a/update-public-acl.sh +++ b/update-public-acl.sh @@ -3,14 +3,24 @@ . ./dns-functions.sh IncludeFile="$1" +RemoteLocation="$2" 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')" +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')" + { echo "acl icvpnrange {" echo " icvpnlocal;" - echo "dump" | nc ::1 33123 | \ - sed -e '/add route/!d;/installed yes/!d;/\(from ::\/0\|from 0\.0\.0\.0\/0\)/d;' | \ - sed -ne 's/^.*from \(\S\+\).*/\t\1;/p' + echo "$PublicSubs" + echo "$(curl -s -S -f "$RemoteLocation""external.dnsserverips" | sed -e 's/^/\t/g;s/$/;/g')" + echo "$PublicSingles" echo "};" -} > "$IncludeFile" +} > "$IncludeFile" \ No newline at end of file diff --git a/update-rdnszone.sh b/update-rdnszone.sh index 77c00ed..7831943 100755 --- a/update-rdnszone.sh +++ b/update-rdnszone.sh @@ -54,7 +54,7 @@ if [ $((NewReverseSerial)) -gt $((OldSerial)) ]; then Static="/""$ReverseZoneFile" Static="${Static%/*}""/static.""${Static##*/}" Static="${Static#*/}" - [ -f "$Static" ] && cat "$Static" + [ -f "$Static" ] && echo "$(cat "$Static")" echo } > "$TempDir/$ReverseZone"