added configuration adjustment for prodtpd if renew-hook for lets encrypt is used; updater-compatibility if gui_access field is not present yet (froxlor <2.2); removed depercated gentoo config templates

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2024-01-14 09:40:33 +01:00
parent 854c930696
commit f420551888
8 changed files with 43 additions and 2913 deletions

View File

@@ -165,12 +165,16 @@ if ($action == '2fa_entercode') {
$loginname = Validate::validate($_POST['loginname'], 'loginname'); $loginname = Validate::validate($_POST['loginname'], 'loginname');
$password = Validate::validate($_POST['password'], 'password'); $password = Validate::validate($_POST['password'], 'password');
$select_additional = '';
if (Settings::Get('panel.db_version') >= 202312230) {
$select_additional = ' AND `gui_access` = 1';
}
$stmt = Database::prepare(" $stmt = Database::prepare("
SELECT `loginname` AS `customer` SELECT `loginname` AS `customer`
FROM `" . TABLE_PANEL_CUSTOMERS . "` FROM `" . TABLE_PANEL_CUSTOMERS . "`
WHERE `loginname`= :loginname WHERE `loginname`= :loginname" .
AND `gui_access` = 1 $select_additional
"); );
Database::pexecute($stmt, [ Database::pexecute($stmt, [
"loginname" => $loginname "loginname" => $loginname
]); ]);
@@ -243,12 +247,16 @@ if ($action == '2fa_entercode') {
exit(); exit();
} }
} else { } else {
$select_additional = '';
if (Settings::Get('panel.db_version') >= 202312230) {
$select_additional = ' AND `gui_access` = 1';
}
$stmt = Database::prepare(" $stmt = Database::prepare("
SELECT `loginname` AS `admin` SELECT `loginname` AS `admin`
FROM `" . TABLE_PANEL_ADMINS . "` FROM `" . TABLE_PANEL_ADMINS . "`
WHERE `loginname`= :loginname WHERE `loginname`= :loginname" .
AND `gui_access` = 1 $select_additional
"); );
Database::pexecute($stmt, [ Database::pexecute($stmt, [
"loginname" => $loginname "loginname" => $loginname
]); ]);

View File

@@ -621,6 +621,7 @@ EOC;
$certificate_folder = self::getCertificateFolder(strtolower(Settings::Get('system.hostname'))); $certificate_folder = self::getCertificateFolder(strtolower(Settings::Get('system.hostname')));
$fullchain = FileDir::makeCorrectFile($certificate_folder . '/fullchain.cer'); $fullchain = FileDir::makeCorrectFile($certificate_folder . '/fullchain.cer');
$keyfile = FileDir::makeCorrectFile($certificate_folder . '/' . strtolower(Settings::Get('system.hostname')) . '.key'); $keyfile = FileDir::makeCorrectFile($certificate_folder . '/' . strtolower(Settings::Get('system.hostname')) . '.key');
$ca_file = FileDir::makeCorrectFile($certificate_folder . '/ca.cer');
if (Settings::IsInList('system.le_renew_services', 'postfix')) { if (Settings::IsInList('system.le_renew_services', 'postfix')) {
// "postconf -e" for postfix // "postconf -e" for postfix
@@ -641,7 +642,23 @@ EOSSL;
file_put_contents($dovecot_conf, $ssl_content); file_put_contents($dovecot_conf, $ssl_content);
} }
if (Settings::IsInList('system.le_renew_services', 'proftpd')) { if (Settings::IsInList('system.le_renew_services', 'proftpd')) {
// @todo $proftpd_conf = '/etc/proftpd/tls.conf'; // @fixme setting?
if (strpos($certificate_folder, '_ecc') === false) {
// comment out RSA related settings
FileDir::safe_exec("sed -i.bak 's|^TLSRSACertificateFile|# TLSRSACertificateFile|' " . escapeshellarg($proftpd_conf));
FileDir::safe_exec("sed -i.bak 's|^TLSRSACertificateKeyFile|# TLSRSACertificateKeyFile|' " . escapeshellarg($proftpd_conf));
// add ECC directives
FileDir::safe_exec("sed -i.bak 's|^#\?\s\?TLSECCertificateFile.*|TLSECCertificateFile " . $fullchain . "|' " . escapeshellarg($proftpd_conf));
FileDir::safe_exec("sed -i.bak 's|^#\?\s\?TLSECCertificateKeyFile.*|TLSECCertificateKeyFile " . $keyfile . "|' " . escapeshellarg($proftpd_conf));
} else {
// comment out ECC related settings
FileDir::safe_exec("sed -i.bak 's|^TLSECCertificateFile|# TLSECCertificateFile|' " . escapeshellarg($proftpd_conf));
FileDir::safe_exec("sed -i.bak 's|^TLSECCertificateKeyFile|# TLSECCertificateKeyFile|' " . escapeshellarg($proftpd_conf));
// add RSA directives
FileDir::safe_exec("sed -i.bak 's|^#\?\s\?TLSRSACertificateFile.*|TLSRSACertificateFile " . $fullchain . "|' " . escapeshellarg($proftpd_conf));
FileDir::safe_exec("sed -i.bak 's|^#\?\s\?TLSRSACertificateKeyFile.*|TLSRSACertificateKeyFile " . $keyfile . "|' " . escapeshellarg($proftpd_conf));
}
FileDir::safe_exec("sed -i.bak 's|^#\?\s\?TLSCACertificateFile.*|TLSCACertificateFile " . $ca_file . "|' " . escapeshellarg($proftpd_conf));
} }
// reload the services // reload the services
FileDir::safe_exec(Settings::Get('system.le_renew_hook')); FileDir::safe_exec(Settings::Get('system.le_renew_hook'));

View File

@@ -431,23 +431,14 @@ class Core
// check currently used php version and set values of fpm/fcgid accordingly // check currently used php version and set values of fpm/fcgid accordingly
if (defined('PHP_MAJOR_VERSION') && defined('PHP_MINOR_VERSION')) { if (defined('PHP_MAJOR_VERSION') && defined('PHP_MINOR_VERSION')) {
// gentoo specific // php-fpm
if ($this->validatedData['distribution'] == 'gentoo') { $reload = "service php" . PHP_MAJOR_VERSION . "." . PHP_MINOR_VERSION . "-fpm restart";
// php-fpm $config_dir = "/etc/php/" . PHP_MAJOR_VERSION . "." . PHP_MINOR_VERSION . "/fpm/pool.d/";
$reload = "/etc/init.d/php-fpm restart"; // fcgid
$config_dir = "/etc/php/fpm-php" . PHP_MAJOR_VERSION . "." . PHP_MINOR_VERSION . "/fpm.d/"; if ($this->validatedData['distribution'] == 'bookworm') {
// fcgid $binary = "/usr/bin/php-cgi" . PHP_MAJOR_VERSION . "." . PHP_MINOR_VERSION;
$binary = "/usr/bin/php-cgi";
} else { } else {
// php-fpm $binary = "/usr/bin/php" . PHP_MAJOR_VERSION . "." . PHP_MINOR_VERSION . "-cgi";
$reload = "service php" . PHP_MAJOR_VERSION . "." . PHP_MINOR_VERSION . "-fpm restart";
$config_dir = "/etc/php/" . PHP_MAJOR_VERSION . "." . PHP_MINOR_VERSION . "/fpm/pool.d/";
// fcgid
if ($this->validatedData['distribution'] == 'bookworm') {
$binary = "/usr/bin/php-cgi" . PHP_MAJOR_VERSION . "." . PHP_MINOR_VERSION;
} else {
$binary = "/usr/bin/php" . PHP_MAJOR_VERSION . "." . PHP_MINOR_VERSION . "-cgi";
}
} }
$db_user->query("UPDATE `" . TABLE_PANEL_FPMDAEMONS . "` SET `reload_cmd` = '" . $reload . "', `config_dir` = '" . $config_dir . "' WHERE `id` ='1';"); $db_user->query("UPDATE `" . TABLE_PANEL_FPMDAEMONS . "` SET `reload_cmd` = '" . $reload . "', `config_dir` = '" . $config_dir . "' WHERE `id` ='1';");
$db_user->query("UPDATE `" . TABLE_PANEL_PHPCONFIGS . "` SET `binary` = '" . $binary . "';"); $db_user->query("UPDATE `" . TABLE_PANEL_PHPCONFIGS . "` SET `binary` = '" . $binary . "';");

View File

@@ -3056,6 +3056,7 @@ TLSRSACertificateFile /etc/ssl/certs/proftpd.crt
TLSRSACertificateKeyFile /etc/ssl/private/proftpd.key TLSRSACertificateKeyFile /etc/ssl/private/proftpd.key
TLSECCertificateFile /etc/ssl/certs/proftpd_ec.crt TLSECCertificateFile /etc/ssl/certs/proftpd_ec.crt
TLSECCertificateKeyFile /etc/ssl/private/proftpd_ec.key TLSECCertificateKeyFile /etc/ssl/private/proftpd_ec.key
# TLSCACertificateFile
TLSOptions NoSessionReuseRequired TLSOptions NoSessionReuseRequired
TLSVerifyClient off TLSVerifyClient off

View File

@@ -4624,6 +4624,7 @@ TLSRSACertificateFile /etc/ssl/certs/proftpd.crt
TLSRSACertificateKeyFile /etc/ssl/private/proftpd.key TLSRSACertificateKeyFile /etc/ssl/private/proftpd.key
TLSECCertificateFile /etc/ssl/certs/proftpd_ec.crt TLSECCertificateFile /etc/ssl/certs/proftpd_ec.crt
TLSECCertificateKeyFile /etc/ssl/private/proftpd_ec.key TLSECCertificateKeyFile /etc/ssl/private/proftpd_ec.key
# TLSCACertificateFile
TLSOptions NoSessionReuseRequired TLSOptions NoSessionReuseRequired
TLSVerifyClient off TLSVerifyClient off

View File

@@ -3843,6 +3843,7 @@ TLSRSACertificateFile /etc/ssl/certs/proftpd.crt
TLSRSACertificateKeyFile /etc/ssl/private/proftpd.key TLSRSACertificateKeyFile /etc/ssl/private/proftpd.key
TLSECCertificateFile /etc/ssl/certs/proftpd_ec.crt TLSECCertificateFile /etc/ssl/certs/proftpd_ec.crt
TLSECCertificateKeyFile /etc/ssl/private/proftpd_ec.key TLSECCertificateKeyFile /etc/ssl/private/proftpd_ec.key
# TLSCACertificateFile
TLSOptions NoSessionReuseRequired TLSOptions NoSessionReuseRequired
TLSVerifyClient off TLSVerifyClient off

File diff suppressed because it is too large Load Diff

View File

@@ -3835,6 +3835,7 @@ TLSRSACertificateFile /etc/ssl/certs/proftpd.crt
TLSRSACertificateKeyFile /etc/ssl/private/proftpd.key TLSRSACertificateKeyFile /etc/ssl/private/proftpd.key
TLSECCertificateFile /etc/ssl/certs/proftpd_ec.crt TLSECCertificateFile /etc/ssl/certs/proftpd_ec.crt
TLSECCertificateKeyFile /etc/ssl/private/proftpd_ec.key TLSECCertificateKeyFile /etc/ssl/private/proftpd_ec.key
# TLSCACertificateFile
TLSOptions NoSessionReuseRequired TLSOptions NoSessionReuseRequired
TLSVerifyClient off TLSVerifyClient off