From b3b58d9e4a5fc49679b5a30164a47c2c5b9245c5 Mon Sep 17 00:00:00 2001 From: Jamie Cameron Date: Mon, 1 May 2023 20:28:21 -0700 Subject: [PATCH] Break SSL linkage when using Nginx and cloning the domain https://forum.virtualmin.com/t/sub-site-letsencrypt-conflict/120491 --- virtual_feature.pl | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/virtual_feature.pl b/virtual_feature.pl index 1b09c9d..6bd620e 100644 --- a/virtual_feature.pl +++ b/virtual_feature.pl @@ -547,10 +547,20 @@ sub feature_validate } # feature_clone(&domain, &old-domain) -# This function does nothing, but needs to exist so that the ssl feature is -# preserved when cloning +# This function does almost nothing, but needs to exist so that the ssl +# feature is preserved when cloning sub feature_clone { +my ($d, $oldd) = @_; + +# Is the linked SSL cert still valid for the new domain? If not, break the +# linkage by copying over the cert. +if ($d->{'ssl_same'} && !&virtual_server::check_domain_certificate($d->{'dom'}, $d)) { + my $oldsame = &virtual_server::get_domain($d->{'ssl_same'}); + &virtual_server::break_ssl_linkage($d, $oldsame); + &virtual_server::sync_combined_ssl_cert($d); + } + return 1; }