From d86da2318784d34b425e510aabc57a8072cc0902 Mon Sep 17 00:00:00 2001 From: Michael Kaufmann Date: Sun, 3 Mar 2024 10:35:58 +0100 Subject: [PATCH] remove unused hidden-settings; correct setting-language-strings-layout; add blacklist for usernames when creating a Customer which may lead to internal issues Signed-off-by: Michael Kaufmann --- actions/admin/settings/120.system.php | 12 ------------ lib/Froxlor/Api/Commands/Customers.php | 22 ++++++++++++++++++++++ lib/Froxlor/PhpHelper.php | 1 + lng/de.lng.php | 10 +++++++--- lng/en.lng.php | 10 +++++++--- 5 files changed, 37 insertions(+), 18 deletions(-) diff --git a/actions/admin/settings/120.system.php b/actions/admin/settings/120.system.php index d0aa1c6f..7781a474 100644 --- a/actions/admin/settings/120.system.php +++ b/actions/admin/settings/120.system.php @@ -180,18 +180,6 @@ return [ 'default' => true, 'save_method' => 'storeSettingField' ], - 'system_httpuser' => [ - 'settinggroup' => 'system', - 'varname' => 'httpuser', - 'type' => 'hidden', - 'default' => 'www-data' - ], - 'system_httpgroup' => [ - 'settinggroup' => 'system', - 'varname' => 'httpgroup', - 'type' => 'hidden', - 'default' => 'www-data' - ], 'system_report_enable' => [ 'label' => lng('serversettings.report.report'), 'settinggroup' => 'system', diff --git a/lib/Froxlor/Api/Commands/Customers.php b/lib/Froxlor/Api/Commands/Customers.php index 40ffe5d9..40ecda45 100644 --- a/lib/Froxlor/Api/Commands/Customers.php +++ b/lib/Froxlor/Api/Commands/Customers.php @@ -460,6 +460,28 @@ class Customers extends ApiCommand implements ResourceEntity if (function_exists('posix_getpwnam') && !in_array("posix_getpwnam", explode(",", ini_get('disable_functions'))) && posix_getpwnam($loginname)) { Response::standardError('loginnameissystemaccount', $loginname, true); } + + // blacklist some system-internal names that might lead to issues + Database::needSqlData(); + $sqldata = Database::getSqlData(); + Database::needRoot(true); + Database::needSqlData(); + $sqlrdata = Database::getSqlData(); + $login_blacklist = [ + 'root', + 'admin', + 'froxroot', + 'froxlor', + $sqldata['user'], + $sqldata['db'], + $sqlrdata['user'], + ]; + unset($sqldata); + usnet($sqlrdata); + $login_blacklist = array_unique($login_blacklist); + if (in_array($loginname, $login_blacklist)) { + Response::standardError('loginnameisreservedname', $loginname, true); + } } else { $accountnumber = intval(Settings::Get('system.lastaccountnumber')) + 1; $loginname = Settings::Get('customer.accountprefix') . $accountnumber; diff --git a/lib/Froxlor/PhpHelper.php b/lib/Froxlor/PhpHelper.php index 5bf3cc24..9a7243e1 100644 --- a/lib/Froxlor/PhpHelper.php +++ b/lib/Froxlor/PhpHelper.php @@ -416,6 +416,7 @@ class PhpHelper 'mysql_unprivileged_pass', 'admin_pass', 'admin_pass_confirm', + 'panel_password_special_char', ]; if (!empty($global)) { $tmp = $global; diff --git a/lng/de.lng.php b/lng/de.lng.php index eac909a1..63923c56 100644 --- a/lng/de.lng.php +++ b/lng/de.lng.php @@ -408,7 +408,10 @@ return [ 'description' => 'Hier kann ein eigenes RSS-Feed angegeben werden, welches den Kunden auf dem Dashboard angezeigt wird.
Leerlassen um das offizielle Froxlor Newsfeed (https://inside.froxlor.org/news/) zu verwenden.', ], 'movetoadmin' => 'Kunde verschieben', - 'movecustomertoadmin' => 'Verschiebe den Kunden zum angegebenen Admin/Reseller
Leerlassen für keine Änderung.
Wird der gewünschte Admin/Reseller hier nicht aufgelistet, hat er sein Kunden-Kontigent erreicht.
', + 'movecustomertoadmin' => [ + 'title' => 'Verschiebe den Kunden zum angegebenen Admin/Reseller', + 'description' => 'Leerlassen für keine Änderung.
Wird der gewünschte Admin/Reseller hier nicht aufgelistet, hat er sein Kunden-Kontigent erreicht.', + ], 'note' => 'Hinweis', 'mod_fcgid_umask' => [ 'title' => 'Umask (Standard: 022)', @@ -432,8 +435,8 @@ return [ 'description' => 'Die optionale "includeSubDomains" Direktive, wenn vorhanden, signalisiert dem UA, dass die HSTS Regel für diese Domain und auch jede Subdomain dieser gilt.', ], 'domain_hsts_preload' => [ - 'title' => 'Füge Domain in die HSTS preload Liste hinzu', - 'description' => 'Wenn die Domain in die HSTS preload Liste, verwaltet von Chrome (und genutzt von Firefox und Safari), hinzugefügt werden soll, dann aktivieren Sie diese Einstellung.
Die preload-Direktive zu senden kann PERMANTENTE KONSEQUENZEN haben und dazu führen, dass Benutzer auf diese Domain und auch Subdomains nicht zugreifen können.
Beachten Sie die Details unter https://hstspreload.org/#removal bevor ein Header mit "preload" gesendet wird.', + 'title' => 'Füge Domain in die HSTS preload Liste hinzu', + 'description' => 'Wenn die Domain in die HSTS preload Liste, verwaltet von Chrome (und genutzt von Firefox und Safari), hinzugefügt werden soll, dann aktivieren Sie diese Einstellung.
Die preload-Direktive zu senden kann PERMANTENTE KONSEQUENZEN haben und dazu führen, dass Benutzer auf diese Domain und auch Subdomains nicht zugreifen können.
Beachten Sie die Details unter https://hstspreload.org/#removal bevor ein Header mit "preload" gesendet wird.', ], 'domain_ocsp_stapling' => [ 'title' => 'OCSP stapling', @@ -810,6 +813,7 @@ return [ 'stringformaterror' => 'Der Wert des Feldes "%s" hat nicht das erwartete Format.', 'loginnameisusingprefix' => 'Sie können keinen Account anlegen, der mit "%s" beginnt, da dieser Prefix für die automatische Namensvergabe eingestellt ist. Bitte wählen Sie einen anderen Accountnamen.', 'loginnameissystemaccount' => 'Der Account "%s" existiert bereits auf dem System und kann daher nicht verwendet werden. Bitte wählen Sie einen anderen Accountnamen.', + 'loginnameisreservedname' => 'Der Account-Name "%s" ist systemseitig reserviert und kann nicht verwenden werden.', 'youcantdeleteyourself' => 'Aus Sicherheitsgründen können Sie sich nicht selbst löschen.', 'youcanteditallfieldsofyourself' => 'Hinweis: Aus Sicherheitsgründen können Sie nicht alle Felder Ihres eigenen Accounts bearbeiten.', 'documentrootexists' => 'Es existiert noch ein Verzeichnis "%s" für diesen Kunden. Bitte löschen Sie dieses vorher.', diff --git a/lng/en.lng.php b/lng/en.lng.php index 272511fe..c1e7bcce 100644 --- a/lng/en.lng.php +++ b/lng/en.lng.php @@ -413,7 +413,10 @@ return [ 'description' => 'Specify a custom RSS-feed that will be shown to your customers on their dashboard.
Leave this empty to use the official froxlor newsfeed (https://inside.froxlor.org/news/).', ], 'movetoadmin' => 'Move customer', - 'movecustomertoadmin' => 'Move customer to the selected admin/reseller
Leave this empty for no change.
If the desired admin does not show up in the list, his customer-limit has been reached.
', + 'movecustomertoadmin' => [ + 'title' => 'Move customer to the selected admin/reseller', + 'description' => 'Leave this empty for no change.
If the desired admin does not show up in the list, his customer-limit has been reached.', + ], 'note' => 'Note', 'mod_fcgid_umask' => [ 'title' => 'Umask (default: 022)', @@ -440,8 +443,8 @@ return [ 'description' => 'The optional "includeSubDomains" directive, if present, signals the UA that the HSTS Policy applies to this HSTS Host as well as any subdomains of the host\'s domain name.', ], 'domain_hsts_preload' => [ - 'title' => 'Include domain in HSTS preload list', - 'description' => 'If you would like this domain to be included in the HSTS preload list maintained by Chrome (and used by Firefox and Safari), then use activate this.
Sending the preload directive from your site can have PERMANENT CONSEQUENCES and prevent users from accessing your site and any of its subdomains.
Please read the details at https://hstspreload.org/#removal before sending the header with "preload".', + 'title' => 'Include domain in HSTS preload list', + 'description' => 'If you would like this domain to be included in the HSTS preload list maintained by Chrome (and used by Firefox and Safari), then use activate this.
Sending the preload directive from your site can have PERMANENT CONSEQUENCES and prevent users from accessing your site and any of its subdomains.
Please read the details at https://hstspreload.org/#removal before sending the header with "preload".', ], 'domain_ocsp_stapling' => [ 'title' => 'OCSP stapling', @@ -882,6 +885,7 @@ return [ 'stringformaterror' => 'The value for the field "%s" is not in the expected format.', 'loginnameisusingprefix' => 'You cannot create accounts that begin with "%s", as this prefix is set to be used for the automatic account-naming. Please enter another account name.', 'loginnameissystemaccount' => 'The account "%s" already exists on the system and cannot be used. Please enter another account name.', + 'loginnameisreservedname' => 'The account-name "%s" is reserved for system internals and cannot be used.', 'youcantdeleteyourself' => 'You cannot delete yourself for security reasons.', 'youcanteditallfieldsofyourself' => 'Note: You cannot edit all fields of your own account for security reasons.', 'documentrootexists' => 'The directory "%s" already exists for this customer. Please remove this before adding the customer again.',