Don't attempt to create validation records in non-master zones https://www.virtualmin.com/node/69928

This commit is contained in:
Jamie Cameron
2020-09-24 21:06:07 -07:00
parent f99cbe4bd3
commit b490c63f0e
3 changed files with 3 additions and 1 deletions

View File

@ -21,6 +21,7 @@ $dname || die "Missing CERTBOT_DOMAIN environment variable";
# Find the DNS domain and records
my ($zone, $zname) = &get_bind_zone_for_domain($dname);
$zone || die "No zone named $dname found";
$zone->{'file'} || die "Zone $dname does not have a records file";
&lock_file(&bind8::make_chroot(&bind8::absolute_path($zone->{'file'})));
my @recs = &bind8::read_zone_file($zone->{'file'}, $zname);

View File

@ -23,6 +23,7 @@ $val || die "Missing CERTBOT_VALIDATION environment variable";
# Find the DNS domain and records
my ($zone, $zname) = &get_bind_zone_for_domain($dname);
$zone || die "No zone named $dname found";
$zone->{'file'} || die "Zone $dname does not have a records file";
&lock_file(&bind8::make_chroot(&bind8::absolute_path($zone->{'file'})));
my @recs = &bind8::read_zone_file($zone->{'file'}, $zname);

View File

@ -388,7 +388,7 @@ my ($d) = @_;
my $bd = $d;
while ($bd =~ /\./) {
my $z = &bind8::get_zone_name($bd, "any");
if ($z) {
if ($z && $z->{'file'} && $z->{'type'} eq 'master') {
return ($z, $bd);
}
$bd =~ s/^[^\.]+\.//;