diff --git a/actions/admin/settings/131.ssl.php b/actions/admin/settings/131.ssl.php index cfdfbb48..2d30bf3c 100644 --- a/actions/admin/settings/131.ssl.php +++ b/actions/admin/settings/131.ssl.php @@ -133,6 +133,15 @@ return array( 'cronmodule' => 'froxlor/letsencrypt', 'save_method' => 'storeSettingField' ), + 'system_acmeshpath' => array( + 'label' => $lng['serversettings']['acmeshpath'], + 'settinggroup' => 'system', + 'varname' => 'acmeshpath', + 'type' => 'string', + 'string_type' => 'file', + 'default' => '/root/.acme.sh/acme.sh', + 'save_method' => 'storeSettingField' + ), 'system_letsencryptacmeconf' => array( 'label' => $lng['serversettings']['letsencryptacmeconf'], 'settinggroup' => 'system', diff --git a/install/froxlor.sql b/install/froxlor.sql index 248d1fd9..b937c16e 100644 --- a/install/froxlor.sql +++ b/install/froxlor.sql @@ -682,6 +682,7 @@ opcache.interned_strings_buffer'), ('system', 'createstdsubdom_default', '1'), ('system', 'froxlorusergroup', ''), ('system', 'froxlorusergroup_gid', ''), + ('system', 'acmeshpath', '/root/.acme.sh/acme.sh'), ('api', 'enabled', '0'), ('2fa', 'enabled', '1'), ('panel', 'decimal_places', '4'), @@ -723,7 +724,7 @@ opcache.interned_strings_buffer'), ('panel', 'logo_overridetheme', '0'), ('panel', 'logo_overridecustom', '0'), ('panel', 'version', '0.10.31'), - ('panel', 'db_version', '202109040'); + ('panel', 'db_version', '202112310'); DROP TABLE IF EXISTS `panel_tasks`; diff --git a/install/updates/froxlor/0.10/update_0.10.inc.php b/install/updates/froxlor/0.10/update_0.10.inc.php index 698dc568..1f6e01fd 100644 --- a/install/updates/froxlor/0.10/update_0.10.inc.php +++ b/install/updates/froxlor/0.10/update_0.10.inc.php @@ -953,3 +953,10 @@ if (\Froxlor\Froxlor::isFroxlorVersion('0.10.30')) { showUpdateStep("Updating from 0.10.30 to 0.10.31", false); \Froxlor\Froxlor::updateToVersion('0.10.31'); } + +if (\Froxlor\Froxlor::isDatabaseVersion('202109040')) { + showUpdateStep("Add setting for acme.sh install location", true); + Settings::AddNew("system.acmeshpath", '/root/.acme.sh/acme.sh'); + lastStepStatus(0); + \Froxlor\Froxlor::updateToDbVersion('202112310'); +} diff --git a/lib/Froxlor/Cron/Http/LetsEncrypt/AcmeSh.php b/lib/Froxlor/Cron/Http/LetsEncrypt/AcmeSh.php index 9b3938d6..da0c796a 100644 --- a/lib/Froxlor/Cron/Http/LetsEncrypt/AcmeSh.php +++ b/lib/Froxlor/Cron/Http/LetsEncrypt/AcmeSh.php @@ -310,7 +310,7 @@ class AcmeSh extends \Froxlor\Cron\FroxlorCron { if (! empty($domains)) { - $acmesh_cmd = self::$acmesh . " --server " . self::$apiserver . " --issue -d " . implode(" -d ", $domains); + $acmesh_cmd = self::getAcmeSh() . " --server " . self::$apiserver . " --issue -d " . implode(" -d ", $domains); // challenge path $acmesh_cmd .= " -w " . Settings::Get('system.letsencryptchallengepath'); if (Settings::Get('system.leecc') > 0) { @@ -530,7 +530,7 @@ class AcmeSh extends \Froxlor\Cron\FroxlorCron if (Settings::Get('system.leecc') > 0 && ! $forced_noecc) { $domain .= "_ecc"; } - $env_file = FileDir::makeCorrectFile(dirname(self::$acmesh) . '/acme.sh.env'); + $env_file = FileDir::makeCorrectFile(dirname(self::getAcmeSh()) . '/acme.sh.env'); if (file_exists($env_file)) { $output = []; $cut = << 0) { - FroxlorLogger::getInstanceOf()->logAction(FroxlorLogger::CRON_ACTION, LOG_ERR, "Download/installation of acme.sh seems to have failed. Re-run cronjob to try again or install manually to '" . self::$acmesh . "'"); - echo PHP_EOL . "Download/installation of acme.sh seems to have failed. Re-run cronjob to try again or install manually to '" . self::$acmesh . "'" . PHP_EOL; + if (! file_exists(self::getAcmeSh()) && $tries > 0) { + FroxlorLogger::getInstanceOf()->logAction(FroxlorLogger::CRON_ACTION, LOG_ERR, "Download/installation of acme.sh seems to have failed. Re-run cronjob to try again or install manually to '" . self::getAcmeSh() . "'"); + echo PHP_EOL . "Download/installation of acme.sh seems to have failed. Re-run cronjob to try again or install manually to '" . self::getAcmeSh() . "'" . PHP_EOL; return false; - } else if (! file_exists(self::$acmesh)) { + } else if (! file_exists(self::getAcmeSh())) { FroxlorLogger::getInstanceOf()->logAction(FroxlorLogger::CRON_ACTION, LOG_INFO, "Could not find acme.sh - installing it to /root/.acme.sh/"); $return = false; - \Froxlor\FileDir::safe_exec("wget -O - https://get.acme.sh | sh", $return, array( + \Froxlor\FileDir::safe_exec("wget -O - https://get.acme.sh | sh -s email=" . Settings::Get('panel.adminmail'), $return, array( '|' )); + $set_path = self::getAcmeSh(); + // after this, regardless of what the user specified, the acme.sh installation will be in /root/.acme.sh + if ($set_path != '/root/.acme.sh/acme.sh') { + Settings::Set('system.acmeshpath', '/root/.acme.sh/acme.sh', true); + // let the user know + FroxlorLogger::getInstanceOf()->logAction(FroxlorLogger::CRON_ACTION, LOG_WARNING, "Acme.sh could not be found in '" . $set_path . "' so froxlor installed it to the default location, which is '/root/.acme.sh/'"); + echo PHP_EOL . "Acme.sh could not be found in '" . $set_path . "' so froxlor installed it to the default location, which is '/root/.acme.sh/'" . PHP_EOL; + } // check whether the installation worked return self::checkInstall(++ $tries); } @@ -620,9 +632,9 @@ EOC; */ private static function checkUpgrade() { - $acmesh_result = \Froxlor\FileDir::safe_exec(self::$acmesh . " --upgrade --auto-upgrade 0"); + $acmesh_result = \Froxlor\FileDir::safe_exec(self::getAcmeSh() . " --upgrade --auto-upgrade 0"); // check for activated cron - $acmesh_result2 = \Froxlor\FileDir::safe_exec(self::$acmesh . " --install-cronjob"); + $acmesh_result2 = \Froxlor\FileDir::safe_exec(self::getAcmeSh() . " --install-cronjob"); FroxlorLogger::getInstanceOf()->logAction(FroxlorLogger::CRON_ACTION, LOG_INFO, "Checking for LetsEncrypt client upgrades before renewing certificates:\n" . implode("\n", $acmesh_result) . "\n" . implode("\n", $acmesh_result2)); } } diff --git a/lib/Froxlor/FileDir.php b/lib/Froxlor/FileDir.php index 60251b0d..f19a4271 100644 --- a/lib/Froxlor/FileDir.php +++ b/lib/Froxlor/FileDir.php @@ -16,7 +16,7 @@ class FileDir * @param array $allowedChars * optional array of allowed characters in path/command * - * @return string result of exec() + * @return array result of exec() */ public static function safe_exec($exec_string, &$return_value = false, $allowedChars = null) { diff --git a/lib/Froxlor/Froxlor.php b/lib/Froxlor/Froxlor.php index 538f1758..a47986ec 100644 --- a/lib/Froxlor/Froxlor.php +++ b/lib/Froxlor/Froxlor.php @@ -10,7 +10,7 @@ final class Froxlor const VERSION = '0.10.31'; // Database version (YYYYMMDDC where C is a daily counter) - const DBVERSION = '202109040'; + const DBVERSION = '202112310'; // Distribution branding-tag (used for Debian etc.) const BRANDING = ''; diff --git a/lng/english.lng.php b/lng/english.lng.php index 64d33b3c..96e38fd6 100644 --- a/lng/english.lng.php +++ b/lng/english.lng.php @@ -2136,3 +2136,5 @@ $lng['error']['notallowedphpconfigused'] = 'Trying to use php-config which is no $lng['serversettings']['phpfpm_settings']['allow_all_customers']['title'] = 'Assign this configuration to all currently existing customers'; $lng['serversettings']['phpfpm_settings']['allow_all_customers']['description'] = 'Set this to "true" if you want to assign this configuration to all currently existing customers so it can be used by them. This setting is not permanent but can be run multiple times.'; $lng['error']['pathmustberelative'] = 'The user does not have the permission to specify directories outside the customers home-directory. Please specify a relative path (no leading /).'; +$lng['serversettings']['acmeshpath']['title'] = 'Path to acme.sh'; +$lng['serversettings']['acmeshpath']['description'] = 'Set this to where acme.sh is installed to, including the acme.sh script
Default is /root/.acme.sh/acme.sh'; diff --git a/lng/german.lng.php b/lng/german.lng.php index c5b7bcc6..be21e7b1 100644 --- a/lng/german.lng.php +++ b/lng/german.lng.php @@ -1782,3 +1782,5 @@ $lng['error']['notallowedphpconfigused'] = 'Nutzung einer PHP-Konfiguration welc $lng['serversettings']['phpfpm_settings']['allow_all_customers']['title'] = 'Für aktuelle Kunden automatisch hinzufügen'; $lng['serversettings']['phpfpm_settings']['allow_all_customers']['description'] = 'Ist diese Einstellung aktiv, wird die Konfiguration automatisch allen aktuell existierenden Kunden-Accounts zugewiesen. Diese Einstellung ist nicht permanent, kann aber mehrfach / nach Bedarf ausgeführt werden.'; $lng['error']['pathmustberelative'] = 'Der Benutzer hat nicht die benötigten Berechtigungen, um Pfade außerhalb des Kunden-Heimatverzeichnisses anzugeben. Bitte einen relativen Pfad angeben (kein führendes /).'; +$lng['serversettings']['acmeshpath']['title'] = 'Pfad zu acme.sh'; +$lng['serversettings']['acmeshpath']['description'] = 'Installationspfad zu acme.sh, inklusive acme.sh Script
Standard ist /root/.acme.sh/acme.sh';