# HG changeset patch # User Matthias Förste foerste@schlittermann.de # Date 1313412683 -7200 # Node ID 2a7ec071b4550d74882381af214f15830ba5bf75 # Parent 6c4ec099c4a89689624370f6720fb5d3754f137b saving uncommitted changes; auto add transferees if our hidden master notifies us diff -r 6c4ec099c4a8 -r 2a7ec071b455 ius/local.pm --- a/ius/local.pm Mon Aug 15 14:48:04 2011 +0200 +++ b/ius/local.pm Mon Aug 15 14:51:23 2011 +0200 @@ -13,6 +13,7 @@ # !0 ok ($@ may contain message) sub addZone($$) { my ($zone, $src) = @_; + my $hdns = '84.19.194.5'; # Filename ist für das File selbst und auch für die Konfig (my $file = $zone) =~ s/[\/&|]/_/g; @@ -24,19 +25,30 @@ file "/etc/bind/s/$file"; masters { %masters; }; allow-query { any; }; - allow-transfer { none; }; + allow-transfer { %transferees; }; }; __ + # 84.19.194.5 ist die ip unseres hidden master + my $transferees = $src eq $hdns ? 'localhost; key hh.schlittermann.de' : 'none'; + $txt =~ s/%time/scalar localtime/eg; $txt =~ s/%masters/$src/g; + $txt =~ s/%transferees/$transferees/g; - if (-f ($_ = "/etc/bind/zones.d/$file")) { + if (-f ($_ = "/etc/bind/zones.auto/$file")) { $@ = "$_ already exists"; return 0; } + if (-f ($_ = "/etc/bind/zones.auto/.removed/$file")) { + $@ = "$_ removed"; + return 0; + } + + s/\.removed\///; + open(OUT, $_ = ">$_") or die "Can't open $_: $!\n"; print OUT $txt;