Compare commits

..

17 Commits
2.1.2 ... 2.1.4

Author SHA1 Message Date
Michael Kaufmann
63bbcd4e00 add missing language string
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2024-01-05 14:48:28 +01:00
Michael Kaufmann
49d67d7c27 set version to 2.1.4 for bugfix release
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2024-01-05 14:33:45 +01:00
Michael Kaufmann
7cc4c9fedb possibility to specify sender address for froxlor as the admin-email address, custom or empty for system-default; fixes #1217
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2024-01-04 08:29:19 +01:00
Michael Kaufmann
afd110a6ed use correct regex for dnscheck-resolver; fixes #1220
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2024-01-03 07:35:28 +01:00
Michael Kaufmann
7cdf6c8d64 don't output ipv6 in brackets for system.ipaddress setting as the brackets will be added to the value resulting in an invalid mysql-access-host; fixes #1215
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2024-01-01 17:04:02 +01:00
Michael Kaufmann
60621da243 dont use deprecated 'mysql_native_password' for mysql8; fixes #1214
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2024-01-01 12:24:45 +01:00
Michael Kaufmann
96ccdda304 use different language string for password-placeholder when adding a new customer; fixes #1216
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2023-12-31 18:01:39 +01:00
Michael Kaufmann
4073984fd7 traffic-cron: check for standardsubdomain to be in the domainlist array to avoid undefined index if e.g. an alias was set to the standardsubdomain
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2023-12-31 16:16:01 +01:00
Michael Kaufmann
ea31c8a64d fix font-color in apcu info; clear updatecheck-cache for nightly users
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2023-12-30 23:30:52 +01:00
Michael Kaufmann
832ee07e0e Don't show stats-icon for domains with redirect; hide goaccess output in traffic cron and keepalive database connection for long-running log-analysis; use same certificate-file if child-domain inherits the parentdomains certificate data (avoid possible http 421 Misdirected Request)
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2023-12-29 10:15:45 +01:00
Michael Kaufmann
b542b140c6 set version to 2.1.3 for bugfix release
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2023-12-22 14:33:11 +01:00
Michael Kaufmann
ac89fc7120 adjust order of css files
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2023-12-22 14:30:23 +01:00
Michael Kaufmann
150858485d include custom.css from config.json if preset correctly
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2023-12-21 10:59:15 +01:00
Michael Kaufmann
e7810e2066 correctly merge fielddetails with prefetched-formfielddata in form-processing
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2023-12-20 09:39:01 +01:00
Michael Kaufmann
4879446567 domains in php-configs are not sortable
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2023-12-19 17:17:51 +01:00
Michael Kaufmann
43eff78088 use panel.password_min_length setting for Froxlor.generatePassword() default length parameter; allow '::1' as valid mysql localhost value; wrapper to clean output for cli installation
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2023-12-16 20:20:58 +01:00
Gamerboy59
55a2ae3801 Add manual_config install var to cli (#1208)
Make the manual_config var, which is available to the web installer, usuable for the cli installer too. If manual_config is set to true skip else (not set or false) proceed with auto config.
2023-12-16 20:13:58 +01:00
34 changed files with 145 additions and 88 deletions

View File

@@ -248,7 +248,7 @@ return [
'settinggroup' => 'system',
'varname' => 'le_domain_dnscheck_resolver',
'type' => 'text',
'string_regexp' => '/^(([0-9]+ [a-z0-9\-\._]+, ?)*[0-9]+ [a-z0-9\-\._]+)?$/i',
'string_type' => 'validate_ip',
'string_emptyallowed' => true,
'default' => '',
'save_method' => 'storeSettingField'

View File

@@ -57,7 +57,7 @@
"pear/net_dns2": "^1.5",
"amnuts/opcache-gui": "^3.4",
"league/commonmark": "^2.4"
},
},
"require-dev": {
"phpunit/phpunit": "^9",
"ext-pcntl": "*",

View File

@@ -686,7 +686,7 @@ opcache.validate_timestamps'),
('api', 'customer_default', '1'),
('2fa', 'enabled', '1'),
('panel', 'decimal_places', '4'),
('panel', 'adminmail', 'admin@SERVERNAME'),
('panel', 'adminmail', 'ADMIN_MAIL'),
('panel', 'phpmyadmin_url', ''),
('panel', 'webmail_url', ''),
('panel', 'webftp_url', ''),
@@ -726,7 +726,7 @@ opcache.validate_timestamps'),
('panel', 'logo_overridecustom', '0'),
('panel', 'settings_mode', '0'),
('panel', 'menu_collapsed', '1'),
('panel', 'version', '2.1.2'),
('panel', 'version', '2.1.4'),
('panel', 'db_version', '202312120');

View File

@@ -269,3 +269,13 @@ if (Froxlor::isFroxlorVersion('2.1.1')) {
Update::showUpdateStep("Updating from 2.1.1 to 2.1.2", false);
Froxlor::updateToVersion('2.1.2');
}
if (Froxlor::isFroxlorVersion('2.1.2')) {
Update::showUpdateStep("Updating from 2.1.2 to 2.1.3", false);
Froxlor::updateToVersion('2.1.3');
}
if (Froxlor::isFroxlorVersion('2.1.3')) {
Update::showUpdateStep("Updating from 2.1.3 to 2.1.4", false);
Froxlor::updateToVersion('2.1.4');
}

View File

@@ -259,14 +259,15 @@ class Froxlor extends ApiCommand
* returns a random password based on froxlor settings for min-length, included characters, etc.
*
* @param int $length
* optional length of password, defaults to 10
* optional length of password, defaults to 0 (panel.password_min_length)
*
* @access admin, customer
* @return string
* @throws Exception
*/
public function generatePassword()
public function generatePassword(): string
{
$length = $this->getParam('length', true, 10);
$length = $this->getParam('length', true, 0);
return $this->response(Crypt::generatePassword($length));
}

View File

@@ -402,7 +402,7 @@ final class ConfigServices extends CliCommand
case "file":
if (array_key_exists('content', $action)) {
$output->writeln('<comment>Creating file "' . $action['name'] . '"</>');
file_put_contents($action['name'], trim(strtr($action['content'], $replace_arr)));
file_put_contents($action['name'], trim(strtr($action['content'], $replace_arr)) . PHP_EOL);
} elseif (array_key_exists('subcommands', $action)) {
foreach ($action['subcommands'] as $fileaction) {
if (array_key_exists('execute', $fileaction) && $fileaction['execute'] == "pre") {
@@ -411,7 +411,7 @@ final class ConfigServices extends CliCommand
exec(strtr($fileaction['content'], $replace_arr));
} elseif ($fileaction['type'] == 'file') {
$output->writeln('<comment>Creating file "' . $fileaction['name'] . '"</>');
file_put_contents($fileaction['name'], trim(strtr($fileaction['content'], $replace_arr)));
file_put_contents($fileaction['name'], trim(strtr($fileaction['content'], $replace_arr)) . PHP_EOL);
}
}
}
@@ -514,6 +514,7 @@ final class ConfigServices extends CliCommand
'<WEBSERVER_GROUP>' => Settings::Get('system.httpgroup'),
'<SSL_CERT_FILE>' => Settings::Get('system.ssl_cert_file'),
'<SSL_KEY_FILE>' => Settings::Get('system.ssl_key_file'),
'<ADMIN_MAIL>' => Settings::Get('panel.adminmail'),
];
}
}

View File

@@ -211,7 +211,7 @@ final class InstallCommand extends Command
$ask_field = false;
}
$fielddata['value'] = $this->formfielddata[$fieldname] ?? ($fielddata['value'] ?? null);
$fielddata['label'] = strip_tags(str_replace("<br>", " ", $fielddata['label']));
$fielddata['label'] = $this->cliTextFormat($fielddata['label'], " ");
if ($ask_field) {
if ($fielddata['type'] == 'password') {
$this->formfielddata[$fieldname] = $this->io->askHidden($fielddata['label'], function ($value) use ($fielddata) {
@@ -267,14 +267,16 @@ final class InstallCommand extends Command
case 4:
$section = $inst->formfield['install']['sections']['step' . $step] ?? [];
$this->io->section($section['title']);
$this->io->note($section['description']);
$this->io->note($this->cliTextFormat($section['description']));
$cmdfield = $section['fields']['system'];
$this->io->success([
$cmdfield['label'],
$cmdfield['value']
]);
if (!empty($decoded_input) || $this->io->confirm('Execute command now?', false)) {
passthru($cmdfield['value']);
if (!isset($decoded_input['manual_config']) || (bool)$decoded_input['manual_config'] === false) {
if (!empty($decoded_input) || $this->io->confirm('Execute command now?', false)) {
passthru($cmdfield['value']);
}
}
break;
}
@@ -305,7 +307,7 @@ final class InstallCommand extends Command
$json_output = [];
foreach ($fields['install']['sections'] as $section => $section_fields) {
foreach ($section_fields['fields'] as $name => $field) {
if ($name == 'system' || $name == 'manual_config' || $name == 'target_servername') {
if ($name == 'system' || $name == 'target_servername') {
continue;
}
if ($field['type'] == 'text' || $field['type'] == 'email') {
@@ -318,7 +320,7 @@ final class InstallCommand extends Command
$fieldval = '******';
} elseif ($field['type'] == 'select') {
$fieldval = implode("|", array_keys($field['select_var']));
} else if ($field['type'] == 'checkbox') {
} elseif ($field['type'] == 'checkbox') {
$fieldval = "1|0";
} else {
$fieldval = "?";
@@ -346,4 +348,10 @@ final class InstallCommand extends Command
curl_close($ch);
fclose($fp);
}
private function cliTextFormat(string $text, string $nl_char = "\n"): string
{
$text = str_replace(['<br>', '<br/>', '<br />'], [$nl_char, $nl_char, $nl_char], $text);
return strip_tags($text);
}
}

View File

@@ -263,6 +263,8 @@ final class MasterCron extends CliCommand
if ($jobcount > 0) {
if (Settings::Get('system.nssextrausers') == 1) {
Extrausers::generateFiles($this->cronLog);
// reload crond as shell users might use crontab and the user is only known to crond if reloaded
FileDir::safe_exec(escapeshellcmd(Settings::Get('system.crondreload')));
return;
}
@@ -275,6 +277,8 @@ final class MasterCron extends CliCommand
FileDir::safe_exec('nscd -i group 1> /dev/null', $false_val, [
'>'
]);
// reload crond as shell users might use crontab and the user is only known to crond if reloaded
FileDir::safe_exec(escapeshellcmd(Settings::Get('system.crondreload')));
}
}
}

View File

@@ -117,7 +117,7 @@ class ConfigDisplay
'<SQL_UNPRIVILEGED_PASSWORD>' => 'FROXLOR_MYSQL_PASSWORD',
'<SQL_DB>' => $sql['db'],
'<SQL_HOST>' => $sql['host'],
'<SQL_SOCKET>' => isset($sql['socket']) ? $sql['socket'] : null,
'<SQL_SOCKET>' => $sql['socket'] ?? null,
'<SERVERNAME>' => Settings::Get('system.hostname'),
'<SERVERIP>' => Settings::Get('system.ipaddress'),
'<NAMESERVERS>' => Settings::Get('system.nameservers'),
@@ -127,12 +127,15 @@ class ConfigDisplay
'<VIRTUAL_GID_MAPS>' => Settings::Get('system.vmail_gid'),
'<SSLPROTOCOLS>' => (Settings::Get('system.use_ssl') == '1') ? 'imaps pop3s' : '',
'<CUSTOMER_TMP>' => FileDir::makeCorrectDir($customer_tmpdir),
'<BASE_PATH>' => FileDir::makeCorrectDir(Froxlor::getInstallDir()),
'<BASE_PATH>' => Froxlor::getInstallDir(),
'<BIND_CONFIG_PATH>' => FileDir::makeCorrectDir(Settings::Get('system.bindconf_directory')),
'<WEBSERVER_RELOAD_CMD>' => Settings::Get('system.apachereload_command'),
'<CUSTOMER_LOGS>' => FileDir::makeCorrectDir(Settings::Get('system.logfiles_directory')),
'<FPM_IPCDIR>' => FileDir::makeCorrectDir(Settings::Get('phpfpm.fastcgi_ipcdir')),
'<WEBSERVER_GROUP>' => Settings::Get('system.httpgroup')
'<WEBSERVER_GROUP>' => Settings::Get('system.httpgroup'),
'<SSL_CERT_FILE>' => Settings::Get('system.ssl_cert_file'),
'<SSL_KEY_FILE>' => Settings::Get('system.ssl_key_file'),
'<ADMIN_MAIL>' => Settings::Get('panel.adminmail'),
];
$commands_pre = "";

View File

@@ -43,23 +43,29 @@ class DomainSSL
* domain-array as reference so we can set the corresponding array-indices
*
* @return null
* @throws \Exception
*/
public function setDomainSSLFilesArray(array &$domain = null)
{
// check if the domain itself has a certificate defined
$dom_certs_stmt = Database::prepare("
SELECT * FROM `" . TABLE_PANEL_DOMAIN_SSL_SETTINGS . "` WHERE `domainid` = :domid
SELECT s.*, d.domain
FROM `" . TABLE_PANEL_DOMAIN_SSL_SETTINGS . "` s
LEFT JOIN `" . TABLE_PANEL_DOMAINS . "` d ON d.id = s.domainid
WHERE s.`domainid` = :domid
");
$dom_certs = Database::pexecute_first($dom_certs_stmt, [
'domid' => $domain['id']
]);
$parent_certificate = false;
if (!is_array($dom_certs) || !isset($dom_certs['ssl_cert_file']) || $dom_certs['ssl_cert_file'] == '') {
// maybe its parent?
if (isset($domain['parentdomainid']) && $domain['parentdomainid'] != 0) {
$dom_certs = Database::pexecute_first($dom_certs_stmt, [
'domid' => $domain['parentdomainid']
]);
$parent_certificate = true;
}
}
@@ -73,8 +79,8 @@ class DomainSSL
}
// make correct files for the certificates
$ssl_files = [
'ssl_cert_file' => FileDir::makeCorrectFile($sslcertpath . '/' . $domain['domain'] . '.crt'),
'ssl_key_file' => FileDir::makeCorrectFile($sslcertpath . '/' . $domain['domain'] . '.key')
'ssl_cert_file' => FileDir::makeCorrectFile($sslcertpath . '/' . ($parent_certificate ? $dom_certs['domain'] : $domain['domain']) . '.crt'),
'ssl_key_file' => FileDir::makeCorrectFile($sslcertpath . '/' . ($parent_certificate ? $dom_certs['domain'] : $domain['domain']) . '.key')
];
if (!$this->validateCertificate($dom_certs)) {
@@ -93,19 +99,19 @@ class DomainSSL
$ssl_files['ssl_cert_chainfile'] = '';
// set them if they are != empty
if ($dom_certs['ssl_ca_file'] != '') {
$ssl_files['ssl_ca_file'] = FileDir::makeCorrectFile($sslcertpath . '/' . $domain['domain'] . '_CA.pem');
$ssl_files['ssl_ca_file'] = FileDir::makeCorrectFile($sslcertpath . '/' . ($parent_certificate ? $dom_certs['domain'] : $domain['domain']) . '_CA.pem');
}
if ($dom_certs['ssl_cert_chainfile'] != '') {
if (Settings::Get('system.webserver') == 'nginx') {
// put ca.crt in my.crt, as nginx does not support a separate chain file.
$dom_certs['ssl_cert_file'] = trim($dom_certs['ssl_cert_file']) . "\n" . trim($dom_certs['ssl_cert_chainfile']) . "\n";
} else {
$ssl_files['ssl_cert_chainfile'] = FileDir::makeCorrectFile($sslcertpath . '/' . $domain['domain'] . '_chain.pem');
$ssl_files['ssl_cert_chainfile'] = FileDir::makeCorrectFile($sslcertpath . '/' . ($parent_certificate ? $dom_certs['domain'] : $domain['domain']) . '_chain.pem');
}
}
// will only be generated to be used externally, froxlor does not need this
if ($dom_certs['ssl_fullchain_file'] != '') {
$ssl_files['ssl_fullchain_file'] = FileDir::makeCorrectFile($sslcertpath . '/' . $domain['domain'] . '_fullchain.pem');
$ssl_files['ssl_fullchain_file'] = FileDir::makeCorrectFile($sslcertpath . '/' . ($parent_certificate ? $dom_certs['domain'] : $domain['domain']) . '_fullchain.pem');
}
// create them on the filesystem
foreach ($ssl_files as $type => $filename) {
@@ -131,7 +137,7 @@ class DomainSSL
return;
}
private function validateCertificate($dom_certs = [])
private function validateCertificate($dom_certs = []): bool
{
return openssl_x509_check_private_key($dom_certs['ssl_cert_file'], $dom_certs['ssl_key_file']);
}

View File

@@ -47,7 +47,7 @@ class TrafficCron extends FroxlorCron
public static function run()
{
self::runFork([self::class, 'handle']);
self::runFork([self::class, 'handle'], [true]);
}
public static function handle()
@@ -163,14 +163,14 @@ class TrafficCron extends FroxlorCron
if (isset($domainlist[$row['customerid']]) && is_array($domainlist[$row['customerid']]) && count($domainlist[$row['customerid']]) != 0) {
// Examining which caption to use for default webalizer stats...
if ($row['standardsubdomain'] != '0') {
if ($row['standardsubdomain'] != '0' && isset($domainlist[$row['customerid']][$row['standardsubdomain']])) {
// ... of course we'd prefer to use the standardsubdomain ...
$caption = $domainlist[$row['customerid']][$row['standardsubdomain']];
} else {
// ... but if there is no standardsubdomain, we have to use the loginname ...
$caption = $row['loginname'];
// ... which results in non-usable links to files in the stats, so lets have a look if we find a domain which is not speciallogfiledomain
// ... which results in non-usable links to files in the stats, so let's have a look if we find a domain which is not speciallogfiledomain
foreach ($domainlist[$row['customerid']] as $domainid => $domain) {
if (!isset($speciallogfile_domainlist[$row['customerid']]) || !isset($speciallogfile_domainlist[$row['customerid']][$domainid])) {
$caption = $domain;
@@ -193,6 +193,8 @@ class TrafficCron extends FroxlorCron
} else {
$httptraffic += floatval(self::callWebalizerGetTraffic($row['loginname'] . '-' . $domain, $row['documentroot'] . '/webalizer/' . $domain . '/', $domain, $domainlist[$row['customerid']]));
}
// kind of a keep-alive-call as this unsets the link which leads to a new connection to the database
Database::needRoot();
}
}
}
@@ -210,6 +212,8 @@ class TrafficCron extends FroxlorCron
} else {
$httptraffic += floatval(self::callWebalizerGetTraffic($row['loginname'], $row['documentroot'] . '/webalizer/', $caption, $domainlist[$row['customerid']]));
}
// kind of a keep-alive-call as this unsets the link which leads to a new connection to the database
Database::needRoot();
// make the stuff readable for the customer, #258
Statistics::makeChownWithNewStats($row);
@@ -618,7 +622,7 @@ class TrafficCron extends FroxlorCron
$format = Settings::Get('system.logfiles_type') == '2' ? 'VCOMBINED' : 'COMBINED';
$monthyear = $monthyear_arr['month'] . '/' . $monthyear_arr['year'];
$return_value = false;
FileDir::safe_exec("grep '" . $monthyear . "' " . escapeshellarg($logfile) . " | goaccess " . $keep_params . " --db-path=" . escapeshellarg($outputdir) . " -o " . escapeshellarg($outputdir . '.tmp.json') . " -o " . escapeshellarg($outputdir . 'index.html') . " --html-report-title=" . escapeshellarg($caption) . " --log-format=" . $format . " - ", $return_value, ['|']);
FileDir::safe_exec("grep '" . $monthyear . "' " . escapeshellarg($logfile) . " | goaccess " . $keep_params . " --db-path=" . escapeshellarg($outputdir) . " -o " . escapeshellarg($outputdir . '.tmp.json') . " -o " . escapeshellarg($outputdir . 'index.html') . " --html-report-title=" . escapeshellarg($caption) . " --log-format=" . $format . " --no-parsing-spinner --no-progress - ", $return_value, ['|']);
if (file_exists($outputdir . '.tmp.json')) {
// need jq here because of potentially LARGE json files
@@ -787,6 +791,8 @@ class TrafficCron extends FroxlorCron
// 'real' domains and no subdomains which are aliases in the
// model-config-file.
$returnval += self::awstatsDoSingleDomain($singledomain, $outputdir, $current_stamp);
// kind of a keep-alive-call as this unsets the link which leads to a new connection to the database
Database::needRoot();
}
/**

View File

@@ -43,9 +43,6 @@ class IpAddr
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
if (!isset($system_ipaddress_array[$row['ip']]) && !in_array($row['ip'], $system_ipaddress_array)) {
if (filter_var($row['ip'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) {
$row['ip'] = '[' . $row['ip'] . ']';
}
$system_ipaddress_array[$row['ip']] = $row['ip'];
}
}

View File

@@ -31,7 +31,7 @@ final class Froxlor
{
// Main version variable
const VERSION = '2.1.2';
const VERSION = '2.1.4';
// Database version (YYYYMMDDC where C is a daily counter)
const DBVERSION = '202312120';

View File

@@ -151,6 +151,8 @@ class AutoUpdate
$zip->close();
// success - remove unused archive
@unlink($localArchive);
// reset cached version check
Settings::Set('system.updatecheck_data', '');
// wait a bit before we redirect to be sure
sleep(3);
return 0;

View File

@@ -99,7 +99,7 @@ class Install
}
// check for url manipulation or wrong step
if ((isset($_SESSION['installation']['stepCompleted']) && ($this->currentStep + 1) > $_SESSION['installation']['stepCompleted'])
if ((isset($_SESSION['installation']['stepCompleted']) && $this->currentStep > $_SESSION['installation']['stepCompleted'])
|| (!isset($_SESSION['installation']['stepCompleted']) && $this->currentStep > 0)
) {
$this->currentStep = isset($_SESSION['installation']['stepCompleted']) ? $_SESSION['installation']['stepCompleted'] + 1 : 1;
@@ -322,6 +322,8 @@ class Install
$email = $validatedData['admin_email'] ?? '';
$password = $validatedData['admin_pass'] ?? '';
$password_confirm = $validatedData['admin_pass_confirm'] ?? '';
$useadminmailassender = $validatedData['use_admin_email_as_sender'] ?? '1';
$senderemail = $validatedData['sender_email'] ?? '';
if (!preg_match('/^[^\r\n\t\f\0]*$/D', $name)) {
throw new Exception(lng('error.stringformaterror', ['admin_name']));
@@ -329,6 +331,8 @@ class Install
throw new Exception(lng('error.loginnameiswrong', [$loginname]));
} elseif (empty(trim($email)) || !Validate::validateEmail($email)) {
throw new Exception(lng('error.emailiswrong', [$email]));
} elseif ((int)$useadminmailassender == 0 && !empty(trim($senderemail)) && !Validate::validateEmail($senderemail)) {
throw new Exception(lng('error.emailiswrong', [$senderemail]));
} elseif (empty($password) || $password != $password_confirm) {
throw new Exception(lng('error.newpasswordconfirmerror'));
} elseif ($password == $loginname) {

View File

@@ -301,8 +301,8 @@ class Core
/* continue */
}
}
if (version_compare($db_root->getAttribute(PDO::ATTR_SERVER_VERSION), '10.0.0', '>=')) {
// mariadb compatibility
if (version_compare($db_root->getAttribute(PDO::ATTR_SERVER_VERSION), '8.0.11', '>=')) {
// mariadb & mysql8
// create user
$stmt = $db_root->prepare("CREATE USER '" . $username . "'@'" . $access_host . "' IDENTIFIED BY :password");
$stmt->execute([
@@ -314,19 +314,6 @@ class Core
"username" => $username,
"host" => $access_host
]);
} elseif (version_compare($db_root->getAttribute(PDO::ATTR_SERVER_VERSION), '8.0.11', '>=')) {
// mysql8 compatibility
// create user
$stmt = $db_root->prepare("CREATE USER '" . $username . "'@'" . $access_host . "' IDENTIFIED WITH mysql_native_password BY :password");
$stmt->execute([
"password" => $password
]);
// grant privileges
$stmt = $db_root->prepare("GRANT ALL ON `" . $database . "`.* TO :username@:host");
$stmt->execute([
"username" => $username,
"host" => $access_host
]);
} else {
// grant privileges
$stmt = $db_root->prepare("GRANT ALL PRIVILEGES ON `" . $database . "`.* TO :username@:host IDENTIFIED BY :password");
@@ -378,7 +365,14 @@ class Core
$mainip = !empty($this->validatedData['serveripv6']) ? $this->validatedData['serveripv6'] : $this->validatedData['serveripv4'];
$this->updateSetting($upd_stmt, 'admin@' . $this->validatedData['servername'], 'panel', 'adminmail');
if ($this->validatedData['use_admin_email_as_sender'] == '1') {
$adminmail_value = $this->validatedData['admin_email'];
} elseif ($this->validatedData['use_admin_email_as_sender'] == '0' && !empty($this->validatedData['sender_email'])) {
$adminmail_value = $this->validatedData['sender_email'];
} else {
$adminmail_value = 'admin@' . $this->validatedData['servername'];
}
$this->updateSetting($upd_stmt, $adminmail_value, 'panel', 'adminmail');
$this->updateSetting($upd_stmt, $mainip, 'system', 'ipaddress');
if ($this->validatedData['use_ssl']) {
$this->updateSetting($upd_stmt, 1, 'system', 'use_ssl');
@@ -576,7 +570,7 @@ class Core
'password' => password_hash($this->validatedData['admin_pass'], PASSWORD_DEFAULT),
'adminname' => $this->validatedData['admin_name'],
'email' => $this->validatedData['admin_email'],
'deflang' => 'en' // TODO: set lanuage
'deflang' => 'en' // TODO: set language
];
$ins_stmt = $db_user->prepare("
INSERT INTO `" . TABLE_PANEL_ADMINS . "` SET

View File

@@ -81,7 +81,7 @@ class Domain
return lng('domains.aliasdomain') . ' ' . $attributes['fields']['aliasdomain'];
}
public static function domainExternalLinkInfo(array $attributes)
public static function domainExternalLinkInfo(array $attributes): string
{
$result = '';
if ($attributes['fields']['parentdomainid'] != 0) {
@@ -89,7 +89,11 @@ class Domain
}
$result .= '<a href="http://' . $attributes['data'] . '" target="_blank">' . $attributes['data'] . '</a>';
// check for statistics if parentdomainid==0 to show stats-link for customers
if ((int)UI::getCurrentUser()['adminsession'] == 0 && $attributes['fields']['parentdomainid'] == 0 && $attributes['fields']['deactivated'] == 0) {
if ((int)UI::getCurrentUser()['adminsession'] == 0
&& $attributes['fields']['parentdomainid'] == 0
&& $attributes['fields']['deactivated'] == 0
&& preg_match('/^https?:\/\/(.*)/i', $attributes['fields']['documentroot']) == false
) {
$statsapp = Settings::Get('system.traffictool');
$result .= ' <a href="http://' . $attributes['data'] . '/' . $statsapp . '" rel="external" target="_blank" title="' . lng('domains.statstics') . '"><i class="fa-solid fa-chart-line text-secondary"></i></a>';
}

View File

@@ -217,7 +217,7 @@ class Form
{
$returnvalue = [];
if (is_array($fielddata) && isset($fielddata['type']) && $fielddata['type'] == 'select') {
if ((!isset($fielddata['select_var']) || !is_array($fielddata['select_var']) || empty($fielddata['select_var'])) && (isset($fielddata['option_options_method']))) {
if ((!is_array($fielddata['select_var']) || empty($fielddata['select_var'])) && (isset($fielddata['option_options_method']))) {
$returnvalue['select_var'] = call_user_func($fielddata['option_options_method']);
}
}
@@ -236,8 +236,8 @@ class Form
if (\Froxlor\Validate\Form::validateFieldDefinition($groupdetails)) {
// Prefetch form fields
foreach ($groupdetails['fields'] as $fieldname => $fielddetails) {
if (!$only_enabledisable || ($only_enabledisable && isset($fielddetails['overview_option']))) {
$groupdetails['fields'][$fieldname] = self::arrayMergePrefix($fielddetails, $fielddetails['type'], self::prefetchFormFieldData($fieldname, $fielddetails));
if (!$only_enabledisable || isset($fielddetails['overview_option'])) {
$groupdetails['fields'][$fieldname] = array_merge($fielddetails, self::prefetchFormFieldData($fieldname, $fielddetails));
$form['groups'][$groupname]['fields'][$fieldname] = $groupdetails['fields'][$fieldname];
}
}
@@ -347,7 +347,7 @@ class Form
if (\Froxlor\Validate\Form::validateFieldDefinition($groupdetails)) {
// Save fields
foreach ($groupdetails['fields'] as $fieldname => $fielddetails) {
if (!$only_enabledisable || ($only_enabledisable && isset($fielddetails['overview_option']))) {
if (!$only_enabledisable || (isset($fielddetails['overview_option']))) {
if (isset($changed_fields[$fieldname])) {
if (($saved_field = self::saveFormField($fieldname, $fielddetails, self::manipulateFormFieldData($fieldname, $fielddetails, $changed_fields[$fieldname]))) !== false) {
$saved_fields = array_merge($saved_fields, $saved_field);
@@ -364,24 +364,7 @@ class Form
// Save form
return self::saveForm($form, $saved_fields);
}
}
private static function arrayMergePrefix($array1, $key_prefix, $array2)
{
if (is_array($array1) && is_array($array2)) {
if ($key_prefix != '') {
foreach ($array2 as $key => $value) {
$array1[$key_prefix . '_' . $key] = $value;
unset($array2[$key]);
}
unset($array2);
return $array1;
} else {
return array_merge($array1, $array2);
}
} else {
return $array1;
}
return false;
}
public static function getFormFieldData($fieldname, $fielddata, &$input)

View File

@@ -176,7 +176,7 @@ class Validate
}
// special case where localhost ip is allowed (mysql-access-hosts for example)
if ($allow_localhost && $ip == '127.0.0.1') {
if ($allow_localhost && ($ip == '127.0.0.1' || $ip == '::1')) {
return $ip . $cidr;
}

View File

@@ -1556,7 +1556,7 @@ noc: root
security: root
# change this to a valid e-mail address you can access
root: root@<SERVERNAME>
root: <ADMIN_MAIL>
]]>
</content>
</file>

View File

@@ -1556,7 +1556,7 @@ noc: root
security: root
# change this to a valid e-mail address you can access
root: root@<SERVERNAME>
root: <ADMIN_MAIL>
]]>
</content>
</file>

View File

@@ -1585,7 +1585,7 @@ noc: root
security: root
# change this to a valid e-mail address you can access
root: root@<SERVERNAME>
root: <ADMIN_MAIL>
]]>
</content>
</file>

View File

@@ -1541,7 +1541,7 @@ noc: root
security: root
# change this to a valid e-mail address you can access
root: root@<SERVERNAME>
root: <ADMIN_MAIL>
]]>
</content>
</file>

View File

@@ -1585,7 +1585,7 @@ noc: root
security: root
# change this to a valid e-mail address you can access
root: root@<SERVERNAME>
root: <ADMIN_MAIL>
]]>
</content>
</file>

View File

@@ -59,7 +59,7 @@ return [
'label' => lng('login.password'),
'type' => 'password',
'autocomplete' => 'off',
'placeholder' => lng('admin.username_default_msg'),
'placeholder' => lng('admin.password_default_msg'),
'next_to' => [
'new_customer_password_suggestion' => [
'next_to_prefix' => lng('customer.generated_pwd') . ':',

View File

@@ -143,6 +143,18 @@ return [
'mandatory' => true,
'value' => old('admin_email', null, 'installation'),
],
'use_admin_email_as_sender' => [
'label' => lng('install.admin.use_admin_email_as_sender'),
'type' => 'checkbox',
'value' => '1',
'checked' => old('use_admin_email_as_sender', '1', 'installation'),
],
'sender_email' => [
'label' => lng('serversettings.adminmail.title'),
'placeholder' => lng('install.admin.use_autogenerated_email_as_sender'),
'type' => 'email',
'value' => old('sender_email', null, 'installation'),
],
]
],
'step3' => [

View File

@@ -112,9 +112,14 @@ function vite($basehref, array $filenames): string
$assetDirectory = '/templates/' . $matches[1] . '/build/';
$viteManifest = dirname(__DIR__) . $assetDirectory . '/manifest.json';
$manifest = json_decode(file_get_contents($viteManifest), true);
$links[] = $basehref . ltrim($assetDirectory, '/') . $manifest[$filename]['file'];
if (!empty($manifest[$filename]['file'])) {
$links[] = $basehref . ltrim($assetDirectory, '/') . $manifest[$filename]['file'];
} else {
// additional asset from config.json that was not prebuilt on release (e.g. custom.css)
$links[] = $filename;
}
} else {
$links = $filenames;
$links[] = $filename;
}
}

View File

@@ -123,7 +123,7 @@ if ($req_host != Settings::Get('system.hostname') &&
(!empty(Settings::Get('system.froxloraliases')) && !in_array($req_host, array_map('trim', explode(',', Settings::Get('system.froxloraliases')))))
)) {
// not the froxlor system-hostname, show info page for domains not configured in froxlor
$redirect_file = FileDir::getUnknownDomainTemplate($req_host);
$redirect_file = FileDir::getUnknownDomainTemplate($req_host ?? "non-detectable http-host");
header('Location: '.$redirect_file);
die();
}

View File

@@ -49,6 +49,7 @@ return [
'field' => 'domains',
'callback' => [PHPConf::class, 'domainList'],
'searchable' => false,
'sortable' => false,
],
'fpmdesc' => [
'label' => lng('admin.phpsettings.fpmdesc'),

View File

@@ -67,6 +67,7 @@ return [
'customer_add' => 'Kunden anlegen',
'customer_edit' => 'Kunden bearbeiten',
'username_default_msg' => 'Leer lassen für automatische Benutzername-Vergabe',
'password_default_msg' => 'Leer lassen für Passwortgenerierung',
'domains' => 'Domains',
'domain_add' => 'Domain anlegen',
'domain_edit' => 'Domain bearbeiten',
@@ -1315,6 +1316,7 @@ Vielen Dank, Ihr Administrator',
'certificate_reallydelete' => 'Wollen Sie diese Zertifikat wirklich löschen?',
'cache_reallydelete' => 'Wollen Sie den Cache wirklich leeren?',
'please_enter_otp' => 'Bitte 2FA Code eingeben',
'admin_mysqlserver_reallydelete' => 'Wollen Sie wirklich diesen MySQL-Server löschen?',
],
'serversettings' => [
'session_timeout' => [
@@ -2252,6 +2254,8 @@ Vielen Dank, Ihr Administrator',
'top' => 'Admin Konto',
'title' => 'Erstellen des Haupt-Administrators.',
'description' => 'Dieser Benutzer erhält alle Berechtigungen zur Anpassungen von Einstellungen und Erstellen/Bearbeiten/Löschen von Resourcen wie Kunden, Domains, etc.',
'use_admin_email_as_sender' => 'Verwende die oben angegebene E-Mail-Adresse als Absenderadresse. Wenn die Option deaktiviert ist, geben Sie unten bitte eine Absenderadresse an.',
'use_autogenerated_email_as_sender' => 'Leer lassen für Standard: admin@servername',
],
'system' => [
'top' => 'System Setup',

View File

@@ -68,6 +68,7 @@ return [
'customer_add' => 'Create customer',
'customer_edit' => 'Edit customer',
'username_default_msg' => 'Leave empty for autogenerated value',
'password_default_msg' => 'Autogenerated if empty',
'domains' => 'Domains',
'domain_add' => 'Create domain',
'domain_edit' => 'Edit domain',
@@ -1430,6 +1431,7 @@ Yours sincerely, your administrator',
'certificate_reallydelete' => 'Do you really want to delete this certificate?',
'cache_reallydelete' => 'Do you really want to clear the cache?',
'please_enter_otp' => 'Please enter 2FA code',
'admin_mysqlserver_reallydelete' => 'Do you really want to delete this MySQL-server?',
],
'redirect_desc' => [
'rc_default' => 'default',
@@ -2388,6 +2390,8 @@ Yours sincerely, your administrator',
'top' => 'Admin user',
'title' => 'Let\'s create the main administrator user.',
'description' => 'This user will be granted all privileges to adjust settings and add/update/delete resources like customers, domains, etc.',
'use_admin_email_as_sender' => 'Use the email address above as sender address. If unchecked, please specify a sender address below.',
'use_autogenerated_email_as_sender' => 'Leave empty for default: admin@servername',
],
'system' => [
'top' => 'System setup',

View File

@@ -6,6 +6,14 @@
background-color: $body-tertiary-bg;
}
.form-floating > .form-control::placeholder {
color: revert;
}
.form-floating > .form-control:not(:focus)::placeholder {
color: transparent;
}
@include color-mode(dark) {
.formfield {
border-bottom: $border-color-dark solid 1px;

View File

@@ -1,8 +1,8 @@
{
"global": {
"css": [
"assets/css/custom.css",
"assets/scss/app.scss"
"assets/scss/app.scss",
"assets/css/custom.css"
],
"js": [
"assets/js/app.js",

View File

@@ -24,7 +24,7 @@
aria-valuemin="0" aria-valuemax="{{ apcuinfo.mem_avail }}">
<div class="progress-bar bg-success" style="width: {{ apcuinfo.mem_used_percentage }}%"></div>
<small
class="justify-content-center d-flex position-absolute w-100 text-dark">{{ apcuinfo.mem_used_percentage }}
class="justify-content-center d-flex position-absolute w-100">{{ apcuinfo.mem_used_percentage }}
%</small>
</div>
</div>