From b17eb19f456a4d3ee1524630a6e05a18cc5c4f0e Mon Sep 17 00:00:00 2001 From: Wildan M Date: Fri, 15 Nov 2024 08:07:55 +0700 Subject: [PATCH] Fix deleting --- src/executor/runner.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/executor/runner.js b/src/executor/runner.js index 1e7b34e..435386a 100644 --- a/src/executor/runner.js +++ b/src/executor/runner.js @@ -1,4 +1,5 @@ import { + detectCanShareSSL, executeLock, getRevision, getVersion, @@ -289,6 +290,19 @@ export default async function runConfig(config, domain, writer, sandbox = false) break; case 'delete': await writeLog("$> virtualmin delete-domain"); + const sharedSSL = detectCanShareSSL(domain); + if (sharedSSL && !domaindata['SSL shared with']) { + // OMG! + await writeLog("$> Applying SSL links with global domain before deleting"); + await writeLog(await virtualminExec.pushVirtualServerConfig(domaindata['ID'], { + 'ssl_same': sharedSSL.id, + 'ssl_key': path.join(sharedSSL.path, 'ssl.key'), + 'ssl_cert': path.join(sharedSSL.path, 'ssl.cert'), + 'ssl_chain': path.join(sharedSSL.path, 'ssl.ca'), + 'ssl_combined': path.join(sharedSSL.path, 'ssl.combined'), + 'ssl_everything': path.join(sharedSSL.path, 'ssl.everything'), + })); + } await spawnSudoUtil('SHELL_SUDO', [user, 'killall', '-u', user]); await virtExec("delete-domain", value, { domain,