diff --git a/README.md b/README.md index affecf3e..51b9d3d8 100644 --- a/README.md +++ b/README.md @@ -53,14 +53,21 @@ https://files.froxlor.org/releases/froxlor-latest.tar.gz [MD5](https://files.fro [HowTo](https://github.com/Froxlor/Froxlor/wiki/Install-froxlor-on-debian) -/etc/apt/sources.list.d/froxlor.list -> deb http://debian.froxlor.org {stretch|buster} main +``` +apt-get -y install apt-transport-https lsb-release ca-certificates +wget -O - https://deb.froxlor.org/froxlor.gpg | apt-key add - +echo "deb https://deb.froxlor.org/debian $(lsb_release -sc) main" > /etc/apt/sources.list.d/froxlor.list +``` -### Gentoo repository +### Ubuntu repository -[HowTo](https://github.com/Froxlor/Froxlor/wiki/Install-froxlor-on-gentoo) +[HowTo](https://github.com/Froxlor/Froxlor/wiki/Install-froxlor-on-ubuntu) -https://files.froxlor.org/gentoo/repositories.xml +``` +apt-get -y install apt-transport-https lsb-release ca-certificates +wget -O - https://deb.froxlor.org/froxlor.gpg | apt-key add - +echo "deb https://deb.froxlor.org/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/froxlor.list +``` ## Contributing diff --git a/composer.json b/composer.json index 731e9bf4..b6445f0a 100644 --- a/composer.json +++ b/composer.json @@ -46,7 +46,7 @@ "phpmailer/phpmailer": "~6.0", "monolog/monolog": "^1.24", "robthree/twofactorauth": "^1.6", - "algo26-matthias/idna-convert": "^2.1" + "froxlor/idna-convert-legacy": "^2.1" }, "require-dev": { "phpunit/phpunit": "8.4.1", diff --git a/composer.lock b/composer.lock index 57aeced7..12069d86 100644 --- a/composer.lock +++ b/composer.lock @@ -4,20 +4,20 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "5699c65bbdcd2a61a9ced0ac7be84d64", + "content-hash": "a7ba15333ffb4a758ea65039b589545b", "packages": [ { - "name": "algo26-matthias/idna-convert", - "version": "v2.1.0", + "name": "froxlor/idna-convert-legacy", + "version": "v2.1.2", "source": { "type": "git", - "url": "https://github.com/algo26-matthias/idna-convert.git", - "reference": "2717d05713454991936bc581d068c6cea0d84e3b" + "url": "https://github.com/Froxlor/idna-convert-legacy.git", + "reference": "09c1db623ba19e1ed8f2f9dabc15eeda9dc713b7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/algo26-matthias/idna-convert/zipball/2717d05713454991936bc581d068c6cea0d84e3b", - "reference": "2717d05713454991936bc581d068c6cea0d84e3b", + "url": "https://api.github.com/repos/Froxlor/idna-convert-legacy/zipball/09c1db623ba19e1ed8f2f9dabc15eeda9dc713b7", + "reference": "09c1db623ba19e1ed8f2f9dabc15eeda9dc713b7", "shasum": "" }, "require": { @@ -43,6 +43,11 @@ "name": "Matthias Sommerfeld", "email": "matthias.sommerfeld@algo26.de", "role": "Developer" + }, + { + "name": "Michael Kaufmann (d00p)", + "email": "d00p@froxlor.org", + "role": "Developer" } ], "description": "A library for encoding and decoding internationalized domain names", @@ -52,7 +57,7 @@ "idna", "php" ], - "time": "2019-03-04T17:07:46+00:00" + "time": "2019-12-31T12:16:30+00:00" }, { "name": "monolog/monolog", diff --git a/install/froxlor.sql b/install/froxlor.sql index c692c62c..98a0cf48 100644 --- a/install/froxlor.sql +++ b/install/froxlor.sql @@ -703,7 +703,7 @@ opcache.interned_strings_buffer'), ('panel', 'password_special_char', '!?<>§$%+#=@'), ('panel', 'customer_hide_options', ''), ('panel', 'is_configured', '0'), - ('panel', 'version', '0.10.10'), + ('panel', 'version', '0.10.11'), ('panel', 'db_version', '201912313'); diff --git a/install/updates/froxlor/0.10/update_0.10.inc.php b/install/updates/froxlor/0.10/update_0.10.inc.php index 723565b5..5f666225 100644 --- a/install/updates/froxlor/0.10/update_0.10.inc.php +++ b/install/updates/froxlor/0.10/update_0.10.inc.php @@ -538,6 +538,23 @@ if (\Froxlor\Froxlor::isDatabaseVersion('201912310')) { \Froxlor\Froxlor::updateToDbVersion('201912311'); } +if (\Froxlor\Froxlor::isFroxlorVersion('0.10.10')) { + showUpdateStep("Updating from 0.10.10 to 0.10.11", false); + \Froxlor\Froxlor::updateToVersion('0.10.11'); +} + +if (\Froxlor\Froxlor::isDatabaseVersion('201912311')) { + showUpdateStep("Migrate logfiles_format setting"); + $current_format = Settings::Set('system.logfiles_format'); + if (!empty($current_format)) { + Settings::Set('system.logfiles_format', '"' . Settings::Get('system.logfiles_format') . '"'); + lastStepStatus(0); + } else { + lastStepStatus(0, 'not needed'); + } + \Froxlor\Froxlor::updateToDbVersion('201912312'); +} + if (\Froxlor\Froxlor::isDatabaseVersion('201912312')) { showUpdateStep("Adding option change awstats LogFormat"); Settings::AddNew("system.awstats_logformat", '1'); diff --git a/lib/Froxlor/Api/Commands/Emails.php b/lib/Froxlor/Api/Commands/Emails.php index 80270e55..af1cd0a2 100644 --- a/lib/Froxlor/Api/Commands/Emails.php +++ b/lib/Froxlor/Api/Commands/Emails.php @@ -106,10 +106,12 @@ class Emails extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEnt ); $email_check = Database::pexecute_first($stmt, $params, true, true); - if (strtolower($email_check['email_full']) == strtolower($email_full)) { - \Froxlor\UI\Response::standard_error('emailexistalready', $email_full, true); - } elseif ($email_check['email'] == $email) { - \Froxlor\UI\Response::standard_error('youhavealreadyacatchallforthisdomain', '', true); + if ($email_check) { + if (strtolower($email_check['email_full']) == strtolower($email_full)) { + \Froxlor\UI\Response::standard_error('emailexistalready', $email_full, true); + } elseif ($email_check['email'] == $email) { + \Froxlor\UI\Response::standard_error('youhavealreadyacatchallforthisdomain', '', true); + } } $stmt = Database::prepare(" @@ -233,6 +235,19 @@ class Emails extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEnt $iscatchall = '1'; $email_parts = explode('@', $result['email_full']); $email = '@' . $email_parts[1]; + // catchall check + $stmt = Database::prepare(" + SELECT `email_full` FROM `" . TABLE_MAIL_VIRTUAL . "` + WHERE `email` = :email AND `customerid` = :cid AND `iscatchall` = '1' + "); + $params = array( + "email" => $email, + "cid" => $customer['customerid'] + ); + $email_check = Database::pexecute_first($stmt, $params, true, true); + if ($email_check) { + \Froxlor\UI\Response::standard_error('youhavealreadyacatchallforthisdomain', '', true); + } } else { $iscatchall = '0'; $email = $result['email_full']; @@ -273,7 +288,7 @@ class Emails extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEnt * optional specify offset for resultset * @param array $sql_orderby * optional array with index = fieldname and value = ASC|DESC to order the resultset by one or more fields - * + * * @access admin, customer * @throws \Exception * @return string json-encoded array count|list diff --git a/lib/Froxlor/Cron/Http/Apache.php b/lib/Froxlor/Cron/Http/Apache.php index 70b8c4a7..80fc8cc9 100644 --- a/lib/Froxlor/Cron/Http/Apache.php +++ b/lib/Froxlor/Cron/Http/Apache.php @@ -760,7 +760,7 @@ class Apache extends HttpConfigBase $logtype = 'combined'; if (Settings::Get('system.logfiles_format') != '') { $logtype = 'frx_custom'; - $logfiles_text .= ' LogFormat "' . Settings::Get('system.logfiles_format') . '" ' . $logtype . "\n"; + $logfiles_text .= ' LogFormat ' . Settings::Get('system.logfiles_format') . ' ' . $logtype . "\n"; } if (Settings::Get('system.logfiles_type') == '2' && Settings::Get('system.logfiles_format') == '') { $logtype = 'vhost_combined'; diff --git a/lib/Froxlor/Cron/Http/Nginx.php b/lib/Froxlor/Cron/Http/Nginx.php index 678e6812..b2358dd1 100644 --- a/lib/Froxlor/Cron/Http/Nginx.php +++ b/lib/Froxlor/Cron/Http/Nginx.php @@ -71,7 +71,7 @@ class Nginx extends HttpConfigBase } $logtype = 'frx_custom'; - $this->nginx_data[$vhosts_filename] = 'log_format ' . $logtype . ' "' . Settings::Get('system.logfiles_format') . '";' . "\n"; + $this->nginx_data[$vhosts_filename] = 'log_format ' . $logtype . ' ' . Settings::Get('system.logfiles_format') . ';' . "\n"; } } diff --git a/lib/Froxlor/Froxlor.php b/lib/Froxlor/Froxlor.php index d52ba464..4514a8b7 100644 --- a/lib/Froxlor/Froxlor.php +++ b/lib/Froxlor/Froxlor.php @@ -7,7 +7,7 @@ final class Froxlor { // Main version variable - const VERSION = '0.10.10'; + const VERSION = '0.10.11'; // Database version (YYYYMMDDC where C is a daily counter) const DBVERSION = '201912313'; diff --git a/lib/Froxlor/FroxlorLogger.php b/lib/Froxlor/FroxlorLogger.php index e8cbc84d..f44e4e15 100644 --- a/lib/Froxlor/FroxlorLogger.php +++ b/lib/Froxlor/FroxlorLogger.php @@ -87,10 +87,13 @@ class FroxlorLogger self::$ml->pushHandler(new SyslogHandler('froxlor', LOG_USER, Logger::DEBUG)); break; case 'file': - if (empty(Settings::Get('logger.logfile')) || ! is_writeable(Settings::Get('logger.logfile'))) { + $logger_logfile = Settings::Get('logger.logfile'); + // is_writable needs an existing file to check if it's actually writable + @touch($logger_logfile); + if (empty($logger_logfile) || ! is_writable($logger_logfile)) { Settings::Set('logger.logfile', '/tmp/froxlor.log'); } - self::$ml->pushHandler(new StreamHandler(Settings::Get('logger.logfile'), Logger::DEBUG)); + self::$ml->pushHandler(new StreamHandler($logger_logfile, Logger::DEBUG)); break; case 'mysql': self::$ml->pushHandler(new MysqlHandler(Logger::DEBUG)); diff --git a/lib/Froxlor/PhpHelper.php b/lib/Froxlor/PhpHelper.php index 2f4c4289..90b30478 100644 --- a/lib/Froxlor/PhpHelper.php +++ b/lib/Froxlor/PhpHelper.php @@ -374,7 +374,7 @@ class PhpHelper $returnval = array(); if (is_array($source)) { $source = array_map('trim', $source); - $source = array_filter($source, function ($value) { + $returnval = array_filter($source, function ($value) { return $value !== ''; }); } else { diff --git a/lib/Froxlor/Settings/Store.php b/lib/Froxlor/Settings/Store.php index 1f4f2a4a..9a578c96 100644 --- a/lib/Froxlor/Settings/Store.php +++ b/lib/Froxlor/Settings/Store.php @@ -242,8 +242,8 @@ class Store $mysql_access_host_array = array_map('trim', explode(',', Settings::Get('system.mysql_access_host'))); $mysql_access_host_array[] = $newfieldvalue; $mysql_access_host_array = array_unique(\Froxlor\PhpHelper::arrayTrim($mysql_access_host_array)); - $mysql_access_host = implode(',', $mysql_access_host_array); \Froxlor\Database\DbManager::correctMysqlUsers($mysql_access_host_array); + $mysql_access_host = implode(',', $mysql_access_host_array); Settings::Set('system.mysql_access_host', $mysql_access_host); } @@ -293,9 +293,11 @@ class Store 'cleanMySQLAccessHost' ), $mysql_access_host_array); - $mysql_access_host_array = array_unique($mysql_access_host_array); + $mysql_access_host_array = array_unique(\Froxlor\PhpHelper::arrayTrim($mysql_access_host_array)); $newfieldvalue = implode(',', $mysql_access_host_array); \Froxlor\Database\DbManager::correctMysqlUsers($mysql_access_host_array); + $mysql_access_host = implode(',', $mysql_access_host_array); + Settings::Set('system.mysql_access_host', $mysql_access_host); } return $returnvalue; diff --git a/lng/english.lng.php b/lng/english.lng.php index d9fe562d..1101ce30 100644 --- a/lng/english.lng.php +++ b/lng/english.lng.php @@ -339,7 +339,7 @@ $lng['serversettings']['logfiles_directory']['description'] = 'Where should all $lng['serversettings']['logfiles_script']['title'] = 'Custom script to pipe log-files to'; $lng['serversettings']['logfiles_script']['description'] = 'You can specify a script here and use the placeholders {LOGFILE}, {DOMAIN} and {CUSTOMER} if needed. In case you want to use it you will need to activate the Pipe webserver logfiles option too. No prefixed pipe-character is needed.'; $lng['serversettings']['logfiles_format']['title'] = 'Access-log format'; -$lng['serversettings']['logfiles_format']['description'] = 'Enter a custom log-format here according to your webservers specifications, leave empty for default'; +$lng['serversettings']['logfiles_format']['description'] = 'Enter a custom log-format here according to your webservers specifications, leave empty for default. Depending on your format the string must be quoted.
If used with nginx, it will look like log_format frx_custom {CONFIGURED_VALUE}.
If used with Apache, it will look like LogFormat {CONFIGURED_VALUE} frx_custom.
Attention: The code won\'t be checked for any errors. If it contains errors, webserver might not start again!'; $lng['serversettings']['logfiles_type']['title'] = 'Access-log type'; $lng['serversettings']['logfiles_type']['description'] = 'Choose between combined or vhost_combined here.'; $lng['serversettings']['logfiles_piped']['title'] = 'Pipe webserver logfiles to specified script (see above)'; diff --git a/lng/german.lng.php b/lng/german.lng.php index ab86c23a..ada5e836 100644 --- a/lng/german.lng.php +++ b/lng/german.lng.php @@ -335,7 +335,7 @@ $lng['serversettings']['logfiles_directory']['description'] = 'Wo sollen die Log $lng['serversettings']['logfiles_script']['title'] = 'Eigenes Script zu dem Log-Files übergeben werden'; $lng['serversettings']['logfiles_script']['description'] = 'Hier kann ein Script an das die Loginhalte übergeben werden hinterlegt und die Platzhalter {LOGFILE}, {DOMAIN} und {CUSTOMER} genutzt werden, sofern nötig. Falls ein Script angegeben wird, muss die Option Webserver Logdateien umleiten gesetzt werden'; $lng['serversettings']['logfiles_format']['title'] = 'Access-Log Format'; -$lng['serversettings']['logfiles_format']['description'] = 'Hier kann ein angepasstes Log-format entsprechend der Webserver-Dokumentation angegeben werden, leer lassen für Standard'; +$lng['serversettings']['logfiles_format']['description'] = 'Hier kann ein angepasstes Log-format entsprechend der Webserver-Dokumentation angegeben werden, leer lassen für Standard. Abhängig vom LogFormat muss die Angabe unter Anführungszeichen stehen.
Wenn verwendet mit nginx, so kann es wie folgt aussehen: log_format frx_custom {EINGESTELLTES_FORMAT}.
Wenn verwendet mit Apache, so kann es wie folgt aussehen: LogFormat {EINGESTELLTES_FORMAT} frx_custom.
ACHTUNG: Der Code wird nicht auf Fehler geprüft. Etwaige Fehler werden auch übernommen und der Webserver könnte nicht mehr starten!'; $lng['serversettings']['logfiles_type']['title'] = 'Access-Log Typ'; $lng['serversettings']['logfiles_type']['description'] = 'Wähle zwischen combined oder vhost_combined.'; $lng['serversettings']['logfiles_piped']['title'] = 'Webserver Logdateien zu eigenem Script umleiten (siehe oben)'; diff --git a/tests/Mysqls/MysqlsTest.php b/tests/Mysqls/MysqlsTest.php index 160efcb9..8d521452 100644 --- a/tests/Mysqls/MysqlsTest.php +++ b/tests/Mysqls/MysqlsTest.php @@ -1,10 +1,12 @@ 'serversettings.ipaddress', + 'settinggroup' => 'system', + 'varname' => 'ipaddress' + ); + Store::storeSettingIpAddress('system_system_ipaddress', $fielddata, '82.149.225.47'); + + $mysql_access_hosts = Settings::Get('system.mysql_access_host'); + $this->assertTrue(strpos($mysql_access_hosts, '82.149.225.47') !== false); + } + + /** + * + * @depends testStoreSettingIpAddress + */ public function testGetAllSqlUsers() { \Froxlor\Database\Database::needRoot(true);