From b490c63f0e949ba79a7dcdd7966a9e66bba6cf0c Mon Sep 17 00:00:00 2001 From: Jamie Cameron Date: Thu, 24 Sep 2020 21:06:07 -0700 Subject: [PATCH] Don't attempt to create validation records in non-master zones https://www.virtualmin.com/node/69928 --- webmin/letsencrypt-cleanup.pl | 1 + webmin/letsencrypt-dns.pl | 1 + webmin/letsencrypt-lib.pl | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/webmin/letsencrypt-cleanup.pl b/webmin/letsencrypt-cleanup.pl index 0c09c03b5..834f2a773 100755 --- a/webmin/letsencrypt-cleanup.pl +++ b/webmin/letsencrypt-cleanup.pl @@ -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); diff --git a/webmin/letsencrypt-dns.pl b/webmin/letsencrypt-dns.pl index 1d57f7703..ad5df3916 100755 --- a/webmin/letsencrypt-dns.pl +++ b/webmin/letsencrypt-dns.pl @@ -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); diff --git a/webmin/letsencrypt-lib.pl b/webmin/letsencrypt-lib.pl index 6a8a5cbe0..a72c5ce4f 100755 --- a/webmin/letsencrypt-lib.pl +++ b/webmin/letsencrypt-lib.pl @@ -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/^[^\.]+\.//;