saving uncommitted changes; auto add transferees if our hidden master notifies us
--- 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;