From 1e013d9e9ab4fb698a13947a6f66c73d3ada315b Mon Sep 17 00:00:00 2001 From: Michael Kaufmann Date: Wed, 18 Jan 2023 11:47:55 +0100 Subject: [PATCH] enhance information on updater regarding acme-challenge (if lets encrypt is enabled and applicable) Signed-off-by: Michael Kaufmann --- install/updates/froxlor/update_2.x.inc.php | 27 ++++++++++++------- .../updates/preconfig/preconfig_2.x.inc.php | 5 ++-- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/install/updates/froxlor/update_2.x.inc.php b/install/updates/froxlor/update_2.x.inc.php index 6635ea0a..246185e0 100644 --- a/install/updates/froxlor/update_2.x.inc.php +++ b/install/updates/froxlor/update_2.x.inc.php @@ -323,17 +323,26 @@ if (Froxlor::isDatabaseVersion('202212060')) { $system_letsencryptchallengepath_upd = isset($_POST['system_letsencryptchallengepath_upd']) ? $_POST['system_letsencryptchallengepath_upd'] : $acmesh_challenge_dir; if ($acmesh_challenge_dir != $system_letsencryptchallengepath_upd) { Settings::Set('system.letsencryptchallengepath', $system_letsencryptchallengepath_upd); - // create JSON string for --apply - $dist = Settings::Get('system.distribution'); - $webserver = Settings::Get('system.webserver'); - if ($webserver == 'apache2') { - $webserver = 'apache22'; - if (Settings::Get('system.apache24')) { - $webserver = 'apache24'; + if ((int) Settings::Get('system.leenabled') == 1) { + // create JSON string for --apply + $dist = Settings::Get('system.distribution'); + $webserver = Settings::Get('system.webserver'); + if ($webserver == 'apache2') { + $webserver = 'apache22'; + if (Settings::Get('system.apache24')) { + $webserver = 'apache24'; + } } + $apply_json = '{"http":"' . $webserver . '","dns":"x","smtp":"x","mail":"x","ftp":"x","distro":"' . $dist . '","system":[]}'; + Update::lastStepStatus(1, 'manual commands needed', + 'Please reconfigure webserver service using
bin/froxlor-cli froxlor:config-services --apply=' . $apply_json . '
' . + '
or adjust the path manually in
' . Settings::Get('system.letsencryptacmeconf') . '
' . + '

In case you already have certificates issued, run the following command to validate and correct the webroot used for renewal:
' . + '
bin/froxlor-cli froxlor:validate-acme-webroot

' + ); + } else { + Update::lastStepStatus(0); } - $apply_json = '{"http":"' . $webserver .'","dns":"x","smtp":"x","mail":"x","ftp":"x","distro":"' . $dist . '","system":[]}'; - Update::lastStepStatus(1, 'manual commands needed', 'Please reconfigure webserver service using
bin/froxlor-cli froxlor:config-services --apply=' . $apply_json . '

or adjust the path manually in
' . Settings::Get('system.letsencryptacmeconf') . '
'); } else { Update::lastStepStatus(0); } diff --git a/install/updates/preconfig/preconfig_2.x.inc.php b/install/updates/preconfig/preconfig_2.x.inc.php index ad15d812..af89668a 100644 --- a/install/updates/preconfig/preconfig_2.x.inc.php +++ b/install/updates/preconfig/preconfig_2.x.inc.php @@ -76,7 +76,7 @@ if (Update::versionInUpdate($current_version, '2.0.0-beta1')) { if (Update::versionInUpdate($current_db_version, '202301120')) { $acmesh_challenge_dir = rtrim(FileDir::makeCorrectDir(Settings::Get('system.letsencryptchallengepath')), "/"); $recommended = rtrim(FileDir::makeCorrectDir(Froxlor::getInstallDir()), "/"); - if ($acmesh_challenge_dir != $recommended) { + if ((int) Settings::Get('system.leenabled') == 1 && $acmesh_challenge_dir != $recommended) { $has_preconfig = true; $description = 'ACME challenge docroot from settings differs from the current installation directory.'; $question = 'Validate Let\'s Encrypt challenge path (recommended value: ' . $recommended . ') '; @@ -85,7 +85,8 @@ if (Update::versionInUpdate($current_db_version, '202301120')) { 'value' => $recommended, 'placeholder' => $acmesh_challenge_dir, 'label' => $question, - 'prior_infotext' => $description + 'prior_infotext' => $description, + 'mandatory' => true, ]; } }