fix issues in login when 'login with domain' is activated; improved php8.3 compatibity; updated ubuntu noble config-template for dovecot and proftpd

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann 2024-05-31 08:41:18 +02:00
parent 1f5982e8a0
commit d4a6c2cacc
No known key found for this signature in database
GPG Key ID: C121F97338D7A352
9 changed files with 57 additions and 1361 deletions

View File

@ -176,6 +176,7 @@ return [
'varname' => 'mod_fcgid_httpuser', 'varname' => 'mod_fcgid_httpuser',
'type' => 'text', 'type' => 'text',
'default' => 'froxlorlocal', 'default' => 'froxlorlocal',
'string_emptyallowed' => false,
'save_method' => 'storeSettingWebserverFcgidFpmUser', 'save_method' => 'storeSettingWebserverFcgidFpmUser',
'websrv_avail' => [ 'websrv_avail' => [
'apache2' 'apache2'
@ -193,6 +194,7 @@ return [
'type' => 'text', 'type' => 'text',
'default' => 'froxlorlocal', 'default' => 'froxlorlocal',
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
'string_emptyallowed' => false,
'websrv_avail' => [ 'websrv_avail' => [
'apache2' 'apache2'
], ],
@ -243,6 +245,7 @@ return [
'varname' => 'vhost_httpuser', 'varname' => 'vhost_httpuser',
'type' => 'text', 'type' => 'text',
'default' => 'froxlorlocal', 'default' => 'froxlorlocal',
'string_emptyallowed' => false,
'save_method' => 'storeSettingWebserverFcgidFpmUser', 'save_method' => 'storeSettingWebserverFcgidFpmUser',
'visible' => Settings::Get('phpfpm.enabled') && call_user_func([ 'visible' => Settings::Get('phpfpm.enabled') && call_user_func([
'\Froxlor\Settings\FroxlorVhostSettings', '\Froxlor\Settings\FroxlorVhostSettings',
@ -256,6 +259,7 @@ return [
'varname' => 'vhost_httpgroup', 'varname' => 'vhost_httpgroup',
'type' => 'text', 'type' => 'text',
'default' => 'froxlorlocal', 'default' => 'froxlorlocal',
'string_emptyallowed' => false,
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
'visible' => Settings::Get('phpfpm.enabled') && call_user_func([ 'visible' => Settings::Get('phpfpm.enabled') && call_user_func([
'\Froxlor\Settings\FroxlorVhostSettings', '\Froxlor\Settings\FroxlorVhostSettings',

View File

@ -181,6 +181,7 @@ if ($action == '2fa_entercode') {
$row = $stmt->fetch(PDO::FETCH_ASSOC); $row = $stmt->fetch(PDO::FETCH_ASSOC);
$is_admin = false; $is_admin = false;
$table = "";
if ($row && $row['customer'] == $loginname) { if ($row && $row['customer'] == $loginname) {
$table = "`" . TABLE_PANEL_CUSTOMERS . "`"; $table = "`" . TABLE_PANEL_CUSTOMERS . "`";
$uid = 'customerid'; $uid = 'customerid';
@ -220,11 +221,14 @@ if ($action == '2fa_entercode') {
} }
} }
} }
} else {
$is_admin = true;
} }
} }
if (empty($table)) {
// try login as admin of no customer-login method worked
$is_admin = true;
}
if ((Froxlor::hasUpdates() || Froxlor::hasDbUpdates()) && $is_admin == false) { if ((Froxlor::hasUpdates() || Froxlor::hasDbUpdates()) && $is_admin == false) {
Response::redirectTo('index.php'); Response::redirectTo('index.php');
exit(); exit();

View File

@ -75,6 +75,18 @@ if (Froxlor::isFroxlorVersion('2.1.9')) {
Database::pexecute($upd_stmt, ['pkey' => $pubkey, 'did' => $domain['id']]); Database::pexecute($upd_stmt, ['pkey' => $pubkey, 'did' => $domain['id']]);
} }
Update::lastStepStatus(0); Update::lastStepStatus(0);
Update::showUpdateStep("Configure antispam services");
$froxlorCliBin = Froxlor::getInstallDir() . '/bin/froxlor-cli';
$currentDistro = Settings::Get('system.distribution');
$manual_command = <<<EOC
{$froxlorCliBin} froxlor:config-services -a '{"http":"x","dns":"x","smtp":"x","mail":"x","antispam":"rspamd","ftp":"x","distro":"{$currentDistro}","system":[]}'
EOC;
Update::lastStepStatus(
1,
'manual action needed',
"Please run the following command manually as root:<br><pre>" . $manual_command . "</pre>"
);
} else { } else {
Update::showUpdateStep("Removing existing domainkeys because antispam is disabled"); Update::showUpdateStep("Removing existing domainkeys because antispam is disabled");
Database::query("UPDATE `" . TABLE_PANEL_DOMAINS . "` SET `dkim` = '0', `dkim_id` = '0', `dkim_privkey` = '', `dkim_pubkey` = '' WHERE `dkim` = '1';"); Database::query("UPDATE `" . TABLE_PANEL_DOMAINS . "` SET `dkim` = '0', `dkim_id` = '0', `dkim_privkey` = '', `dkim_pubkey` = '' WHERE `dkim` = '1';");

View File

@ -156,7 +156,7 @@ class GlobalSearch
], ],
'result_key' => 'domain_ace', 'result_key' => 'domain_ace',
'result_format' => [ 'result_format' => [
'title' => ['self', 'getFieldFromResult'], 'title' => ['\\Froxlor\\Ajax\\GlobalSearch', 'getFieldFromResult'],
'title_args' => 'domain_ace', 'title_args' => 'domain_ace',
'href' => 'admin_domains.php?page=domains&searchfield=d.domain_ace&searchtext=' 'href' => 'admin_domains.php?page=domains&searchfield=d.domain_ace&searchtext='
] ]
@ -172,7 +172,7 @@ class GlobalSearch
'result_key' => 'ip', 'result_key' => 'ip',
'result_groupkey' => 'ip', 'result_groupkey' => 'ip',
'result_format' => [ 'result_format' => [
'title' => ['self', 'getFieldFromResult'], 'title' => ['\\Froxlor\\Ajax\\GlobalSearch', 'getFieldFromResult'],
'title_args' => 'ip', 'title_args' => 'ip',
'href' => 'admin_ipsandports.php?page=ipsandports&searchfield=ip&searchtext=' 'href' => 'admin_ipsandports.php?page=ipsandports&searchfield=ip&searchtext='
] ]
@ -186,7 +186,7 @@ class GlobalSearch
], ],
'result_key' => 'id', 'result_key' => 'id',
'result_format' => [ 'result_format' => [
'title' => ['self', 'getFieldFromResult'], 'title' => ['\\Froxlor\\Ajax\\GlobalSearch', 'getFieldFromResult'],
'title_args' => 'name', 'title_args' => 'name',
'href' => 'admin_plans.php?page=overview&searchfield=id&searchtext=' 'href' => 'admin_plans.php?page=overview&searchfield=id&searchtext='
] ]
@ -201,7 +201,7 @@ class GlobalSearch
], ],
'result_key' => 'id', 'result_key' => 'id',
'result_format' => [ 'result_format' => [
'title' => ['self', 'getFieldFromResult'], 'title' => ['\\Froxlor\\Ajax\\GlobalSearch', 'getFieldFromResult'],
'title_args' => 'description', 'title_args' => 'description',
'href' => 'admin_phpsettings.php?page=overview&searchfield=id&searchtext=' 'href' => 'admin_phpsettings.php?page=overview&searchfield=id&searchtext='
] ]
@ -215,7 +215,7 @@ class GlobalSearch
], ],
'result_key' => 'id', 'result_key' => 'id',
'result_format' => [ 'result_format' => [
'title' => ['self', 'getFieldFromResult'], 'title' => ['\\Froxlor\\Ajax\\GlobalSearch', 'getFieldFromResult'],
'title_args' => 'description', 'title_args' => 'description',
'href' => 'admin_phpsettings.php?page=fpmdaemons&searchfield=id&searchtext=' 'href' => 'admin_phpsettings.php?page=fpmdaemons&searchfield=id&searchtext='
] ]
@ -234,7 +234,7 @@ class GlobalSearch
], ],
'result_key' => 'loginname', 'result_key' => 'loginname',
'result_format' => [ 'result_format' => [
'title' => ['self', 'getFieldFromResult'], 'title' => ['\\Froxlor\\Ajax\\GlobalSearch', 'getFieldFromResult'],
'title_args' => 'name', 'title_args' => 'name',
'href' => 'admin_admins.php?page=admins&searchfield=loginname&searchtext=' 'href' => 'admin_admins.php?page=admins&searchfield=loginname&searchtext='
] ]
@ -252,7 +252,7 @@ class GlobalSearch
], ],
'result_key' => 'domain_ace', 'result_key' => 'domain_ace',
'result_format' => [ 'result_format' => [
'title' => ['self', 'getFieldFromResult'], 'title' => ['\\Froxlor\\Ajax\\GlobalSearch', 'getFieldFromResult'],
'title_args' => 'domain_ace', 'title_args' => 'domain_ace',
'href' => 'customer_domains.php?page=domains&searchfield=d.domain_ace&searchtext=' 'href' => 'customer_domains.php?page=domains&searchfield=d.domain_ace&searchtext='
] ]
@ -266,7 +266,7 @@ class GlobalSearch
], ],
'result_key' => 'email', 'result_key' => 'email',
'result_format' => [ 'result_format' => [
'title' => ['self', 'getFieldFromResult'], 'title' => ['\\Froxlor\\Ajax\\GlobalSearch', 'getFieldFromResult'],
'title_args' => 'email', 'title_args' => 'email',
'href' => 'customer_email.php?page=email_domain&domainid={domainid}&searchfield=m.email&searchtext=' 'href' => 'customer_email.php?page=email_domain&domainid={domainid}&searchfield=m.email&searchtext='
] ]
@ -279,7 +279,7 @@ class GlobalSearch
], ],
'result_key' => 'domain', 'result_key' => 'domain',
'result_format' => [ 'result_format' => [
'title' => ['self', 'getFieldFromResult'], 'title' => ['\\Froxlor\\Ajax\\GlobalSearch', 'getFieldFromResult'],
'title_args' => 'domain', 'title_args' => 'domain',
'href' => 'customer_email.php?page=emails&searchfield=d.domain&searchtext=' 'href' => 'customer_email.php?page=emails&searchfield=d.domain&searchtext='
] ]
@ -293,7 +293,7 @@ class GlobalSearch
], ],
'result_key' => 'databasename', 'result_key' => 'databasename',
'result_format' => [ 'result_format' => [
'title' => ['self', 'getFieldFromResult'], 'title' => ['\\Froxlor\\Ajax\\GlobalSearch', 'getFieldFromResult'],
'title_args' => 'databasename', 'title_args' => 'databasename',
'href' => 'customer_mysql.php?page=mysqls&searchfield=databasename&searchtext=' 'href' => 'customer_mysql.php?page=mysqls&searchfield=databasename&searchtext='
] ]
@ -307,7 +307,7 @@ class GlobalSearch
], ],
'result_key' => 'username', 'result_key' => 'username',
'result_format' => [ 'result_format' => [
'title' => ['self', 'getFieldFromResult'], 'title' => ['\\Froxlor\\Ajax\\GlobalSearch', 'getFieldFromResult'],
'title_args' => 'username', 'title_args' => 'username',
'href' => 'customer_ftp.php?page=accounts&searchfield=username&searchtext=' 'href' => 'customer_ftp.php?page=accounts&searchfield=username&searchtext='
] ]

View File

@ -46,7 +46,7 @@ class CurrentUser
*/ */
public static function hasSession(): bool public static function hasSession(): bool
{ {
return !empty($_SESSION) && isset($_SESSION['userinfo']) && !empty($_SESSION['userinfo']); return !empty($_SESSION) && !empty($_SESSION['userinfo']);
} }
/** /**

View File

@ -52,7 +52,7 @@ class ErrorBag
*/ */
public static function addError(string $data): void public static function addError(string $data): void
{ {
if (!is_array($_SESSION['_errors'])) { if (!isset($_SESSION['_errors']) || !is_array($_SESSION['_errors'])) {
$_SESSION['_errors'] = []; $_SESSION['_errors'] = [];
} }
$_SESSION['_errors'][] = $data; $_SESSION['_errors'][] = $data;

View File

@ -374,6 +374,9 @@ class PhpHelper
): bool ): bool
{ {
foreach ($haystack as $key => $value) { foreach ($haystack as $key => $value) {
if (empty($value)) {
continue;
}
$pathkey = empty($currentKey) ? $key : $currentKey . '.' . $key; $pathkey = empty($currentKey) ? $key : $currentKey . '.' . $key;
if (is_array($value)) { if (is_array($value)) {
self::recursive_array_search($needle, $value, $keys, $pathkey); self::recursive_array_search($needle, $value, $keys, $pathkey);

File diff suppressed because it is too large Load Diff

View File

@ -980,7 +980,7 @@ return [
'editpassdescription' => 'Neues Passwort setzen oder leer für keine Änderung.', 'editpassdescription' => 'Neues Passwort setzen oder leer für keine Änderung.',
], ],
'gender' => [ 'gender' => [
'title' => 'Geschlecht', 'title' => 'Anrede',
'male' => 'Herr', 'male' => 'Herr',
'female' => 'Frau', 'female' => 'Frau',
'undef' => '', 'undef' => '',