show exact froxlor:config-services parameter for updater; better checks for changed acme-challenge paths; fix typo in PHP_EOL statement; remove crsf token from config-apply-parameter generation from within the ui
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
@@ -92,6 +92,7 @@ if ($userinfo['change_serversettings'] == '1') {
|
|||||||
|
|
||||||
if ($distribution != "" && isset($_POST['finish'])) {
|
if ($distribution != "" && isset($_POST['finish'])) {
|
||||||
unset($_POST['finish']);
|
unset($_POST['finish']);
|
||||||
|
unset($_POST['csrf_token']);
|
||||||
$params = $_POST;
|
$params = $_POST;
|
||||||
$params['distro'] = $distribution;
|
$params['distro'] = $distribution;
|
||||||
$params['system'] = [];
|
$params['system'] = [];
|
||||||
@@ -121,8 +122,6 @@ if ($userinfo['change_serversettings'] == '1') {
|
|||||||
'distribution' => $distribution
|
'distribution' => $distribution
|
||||||
]);
|
]);
|
||||||
} else {
|
} else {
|
||||||
// @fixme check set distribution from settings
|
|
||||||
|
|
||||||
$cfg_formfield = [
|
$cfg_formfield = [
|
||||||
'config' => [
|
'config' => [
|
||||||
'title' => lng('admin.configfiles.serverconfiguration'),
|
'title' => lng('admin.configfiles.serverconfiguration'),
|
||||||
|
|||||||
@@ -222,7 +222,7 @@ EOF;
|
|||||||
file_put_contents($complete_filedir . '/froxlor_master_cronjob.php', $compCron);
|
file_put_contents($complete_filedir . '/froxlor_master_cronjob.php', $compCron);
|
||||||
Update::lastStepStatus(0);
|
Update::lastStepStatus(0);
|
||||||
} else {
|
} else {
|
||||||
$cron_run_cmd = 'chmod +x ' . FileDir::makeCorrectFile(Froxlor::getInstallDir() . '/bin/froxlor-cli') . PHO_EOL;
|
$cron_run_cmd = 'chmod +x ' . FileDir::makeCorrectFile(Froxlor::getInstallDir() . '/bin/froxlor-cli') . PHP_EOL;
|
||||||
$cron_run_cmd .= FileDir::makeCorrectFile(Froxlor::getInstallDir() . '/bin/froxlor-cli') . ' froxlor:cron -r 99';
|
$cron_run_cmd .= FileDir::makeCorrectFile(Froxlor::getInstallDir() . '/bin/froxlor-cli') . ' froxlor:cron -r 99';
|
||||||
Update::lastStepStatus(1, 'manual commands needed', 'Please run the following commands manually:<br><pre>' . $cron_run_cmd . '</pre>');
|
Update::lastStepStatus(1, 'manual commands needed', 'Please run the following commands manually:<br><pre>' . $cron_run_cmd . '</pre>');
|
||||||
}
|
}
|
||||||
@@ -323,7 +323,17 @@ if (Froxlor::isDatabaseVersion('202212060')) {
|
|||||||
$system_letsencryptchallengepath_upd = isset($_POST['system_letsencryptchallengepath_upd']) ? $_POST['system_letsencryptchallengepath_upd'] : $acmesh_challenge_dir;
|
$system_letsencryptchallengepath_upd = isset($_POST['system_letsencryptchallengepath_upd']) ? $_POST['system_letsencryptchallengepath_upd'] : $acmesh_challenge_dir;
|
||||||
if ($acmesh_challenge_dir != $system_letsencryptchallengepath_upd) {
|
if ($acmesh_challenge_dir != $system_letsencryptchallengepath_upd) {
|
||||||
Settings::Set('system.letsencryptchallengepath', $system_letsencryptchallengepath_upd);
|
Settings::Set('system.letsencryptchallengepath', $system_letsencryptchallengepath_upd);
|
||||||
Update::lastStepStatus(1, 'manual commands needed', 'Please reconfigure webserver service using <pre>bin/froxlor-cli froxlor:config-services</pre> or adjust the path manually in <pre>' . Settings::Get('system.letsencryptacmeconf') . '</pre>');
|
// 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 <pre>bin/froxlor-cli froxlor:config-services --apply=' . $apply_json . '</pre><br> or adjust the path manually in <pre>' . Settings::Get('system.letsencryptacmeconf') . '</pre>');
|
||||||
} else {
|
} else {
|
||||||
Update::lastStepStatus(0);
|
Update::lastStepStatus(0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -74,15 +74,16 @@ if (Update::versionInUpdate($current_version, '2.0.0-beta1')) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (Update::versionInUpdate($current_db_version, '202301120')) {
|
if (Update::versionInUpdate($current_db_version, '202301120')) {
|
||||||
$acmesh_challenge_dir = Settings::Get('system.letsencryptchallengepath');
|
$acmesh_challenge_dir = rtrim(FileDir::makeCorrectDir(Settings::Get('system.letsencryptchallengepath')), "/");
|
||||||
if ($acmesh_challenge_dir != Froxlor::getInstallDir()) {
|
$recommended = rtrim(FileDir::makeCorrectDir(Froxlor::getInstallDir()), "/");
|
||||||
|
if ($acmesh_challenge_dir != $recommended) {
|
||||||
$has_preconfig = true;
|
$has_preconfig = true;
|
||||||
$description = 'ACME challenge docroot from settings differs from the current installation directory.';
|
$description = 'ACME challenge docroot from settings differs from the current installation directory.';
|
||||||
$question = '<strong>Validate Let\'s Encrypt challenge path ';
|
$question = '<strong>Validate Let\'s Encrypt challenge path (recommended value: ' . $recommended . ') ';
|
||||||
$return['system_letsencryptchallengepath_upd'] = [
|
$return['system_letsencryptchallengepath_upd'] = [
|
||||||
'type' => 'text',
|
'type' => 'text',
|
||||||
'value' => $acmesh_challenge_dir,
|
'value' => $recommended,
|
||||||
'placeholder' => Froxlor::getInstallDir(),
|
'placeholder' => $acmesh_challenge_dir,
|
||||||
'label' => $question,
|
'label' => $question,
|
||||||
'prior_infotext' => $description
|
'prior_infotext' => $description
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ final class ValidateAcmeWebroot extends CliCommand
|
|||||||
protected function configure()
|
protected function configure()
|
||||||
{
|
{
|
||||||
$this->setName('froxlor:validate-acme-webroot');
|
$this->setName('froxlor:validate-acme-webroot');
|
||||||
$this->setDescription('Validates the Le_Webroot value is correct for froxlor managed domains with Let\s Encrypt certificate.');
|
$this->setDescription('Validates the Le_Webroot value is correct for froxlor managed domains with Let\'s Encrypt certificate.');
|
||||||
$this->addOption('yes-to-all', 'A', InputOption::VALUE_NONE, 'Do not ask for confirmation, update files if necessary');
|
$this->addOption('yes-to-all', 'A', InputOption::VALUE_NONE, 'Do not ask for confirmation, update files if necessary');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -71,19 +71,20 @@ final class ValidateAcmeWebroot extends CliCommand
|
|||||||
$domains = $sel_stmt->fetchAll(PDO::FETCH_ASSOC);
|
$domains = $sel_stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||||
$upd_stmt = Database::prepare("UPDATE domain_ssl_settings SET expirationdate=NULL WHERE `domainid` = :did");
|
$upd_stmt = Database::prepare("UPDATE domain_ssl_settings SET expirationdate=NULL WHERE `domainid` = :did");
|
||||||
$acmesh_dir = dirname(Settings::Get('system.acmeshpath'));
|
$acmesh_dir = dirname(Settings::Get('system.acmeshpath'));
|
||||||
$acmesh_challenge_dir = Settings::Get('system.letsencryptchallengepath');
|
$acmesh_challenge_dir = rtrim(FileDir::makeCorrectDir(Settings::Get('system.letsencryptchallengepath')), "/");
|
||||||
|
$recommended = rtrim(FileDir::makeCorrectDir(Froxlor::getInstallDir()), "/");
|
||||||
|
|
||||||
if ($acmesh_challenge_dir != Froxlor::getInstallDir()) {
|
if ($acmesh_challenge_dir != $recommended) {
|
||||||
$io->warning([
|
$io->warning([
|
||||||
"ACME challenge docroot from settings differs from the current installation directory.",
|
"ACME challenge docroot from settings differs from the current installation directory.",
|
||||||
"Settings: '" . $acmesh_challenge_dir . "'",
|
"Settings: '" . $acmesh_challenge_dir . "'",
|
||||||
"Default/recommended value: '" . Froxlor::getInstallDir() . "'",
|
"Default/recommended value: '" . $recommended . "'",
|
||||||
]);
|
]);
|
||||||
$question = new ConfirmationQuestion('Fix ACME challenge docroot setting? [yes] ', true, '/^(y|j)/i');
|
$question = new ConfirmationQuestion('Fix ACME challenge docroot setting? [yes] ', true, '/^(y|j)/i');
|
||||||
if ($yestoall || $helper->ask($input, $output, $question)) {
|
if ($yestoall || $helper->ask($input, $output, $question)) {
|
||||||
Settings::Set('system.letsencryptchallengepath', Froxlor::getInstallDir());
|
Settings::Set('system.letsencryptchallengepath', $recommended);
|
||||||
$former_value = $acmesh_challenge_dir;
|
$former_value = $acmesh_challenge_dir;
|
||||||
$acmesh_challenge_dir = Froxlor::getInstallDir();
|
$acmesh_challenge_dir = $recommended;
|
||||||
// need to update the corresponding acme-alias config-file
|
// need to update the corresponding acme-alias config-file
|
||||||
$acme_alias_file = Settings::Get('system.letsencryptacmeconf');
|
$acme_alias_file = Settings::Get('system.letsencryptacmeconf');
|
||||||
$sed_params = "s@".$former_value."@" . $acmesh_challenge_dir . "@";
|
$sed_params = "s@".$former_value."@" . $acmesh_challenge_dir . "@";
|
||||||
|
|||||||
@@ -112,7 +112,6 @@
|
|||||||
{{ lng('admin.configfiles.recommendednote') }}
|
{{ lng('admin.configfiles.recommendednote') }}
|
||||||
</div>
|
</div>
|
||||||
<div class="col-12 col-md-6 text-end">
|
<div class="col-12 col-md-6 text-end">
|
||||||
<input type="hidden" name="dist" value="{{ distribution }}"/>
|
|
||||||
<button type="button" class="btn btn-outline-secondary" id="selectRecommendedConfig">{{ lng('admin.configfiles.selectrecommended') }}</button>
|
<button type="button" class="btn btn-outline-secondary" id="selectRecommendedConfig">{{ lng('admin.configfiles.selectrecommended') }}</button>
|
||||||
<button type="button" class="btn btn-outline-secondary" id="downloadSelectionAsJson">
|
<button type="button" class="btn btn-outline-secondary" id="downloadSelectionAsJson">
|
||||||
<i class="fa-solid fa-download"></i>
|
<i class="fa-solid fa-download"></i>
|
||||||
|
|||||||
Reference in New Issue
Block a user