make selecting the used OS actually do something (load default-setting-adjustments required/needed; TBD)

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2022-02-15 15:43:18 +01:00
parent 96cdb34d71
commit f37d9d000c
6 changed files with 27 additions and 15 deletions

View File

@@ -388,7 +388,7 @@ INSERT INTO `panel_settings` (`settinggroup`, `varname`, `value`) VALUES
('dkim', 'dkim_prefix', '/etc/postfix/dkim/'),
('dkim', 'dkim_domains', 'domains'),
('dkim', 'dkim_dkimkeys', 'dkim-keys.conf'),
('dkim', 'dkimrestart_command', '/etc/init.d/dkim-filter restart'),
('dkim', 'dkimrestart_command', 'service dkim-filter restart'),
('dkim', 'privkeysuffix', '.priv'),
('admin', 'show_news_feed', '0'),
('admin', 'show_version_login', '0'),
@@ -526,7 +526,7 @@ opcache.validate_timestamps'),
('system', 'documentroot_prefix', '/var/customers/webs/'),
('system', 'logfiles_directory', '/var/customers/logs/'),
('system', 'ipaddress', 'SERVERIP'),
('system', 'apachereload_command', '/etc/init.d/apache2 reload'),
('system', 'apachereload_command', 'service apache2 reload'),
('system', 'last_traffic_run', '000000'),
('system', 'vmail_uid', '2000'),
('system', 'vmail_gid', '2000'),
@@ -534,7 +534,7 @@ opcache.validate_timestamps'),
('system', 'vmail_maildirname', 'Maildir'),
('system', 'bind_enable', '0'),
('system', 'bindconf_directory', '/etc/bind/'),
('system', 'bindreload_command', '/etc/init.d/bind9 reload'),
('system', 'bindreload_command', 'service bind9 reload'),
('system', 'hostname', 'SERVERNAME'),
('system', 'mysql_access_host', 'localhost'),
('system', 'lastcronrun', ''),
@@ -621,7 +621,7 @@ opcache.validate_timestamps'),
('system', 'mtaserver', 'postfix'),
('system', 'mailtraffic_enabled', '1'),
('system', 'cronconfig', '/etc/cron.d/froxlor'),
('system', 'crondreload', '/etc/init.d/cron reload'),
('system', 'crondreload', 'service cron reload'),
('system', 'croncmdline', '/usr/bin/nice -n 5 /usr/bin/php -q'),
('system', 'cron_allowautoupdate', '0'),
('system', 'dns_createhostnameentry', '0'),

View File

@@ -153,6 +153,7 @@ class FroxlorInstall
$this->_guessWebserver();
$this->_guessDistribution();
$this->_getPostField('use_ssl', 1);
$this->_getPostField('mysql_host', '127.0.0.1');
$this->_getPostField('mysql_database', 'froxlor');
$this->_getPostField('mysql_forcecreate', '0');
@@ -585,6 +586,9 @@ class FroxlorInstall
$this->_updateSetting($upd_stmt, 'admin@' . $this->_data['servername'], 'panel', 'adminmail');
$this->_updateSetting($upd_stmt, $this->_data['serverip'], 'system', 'ipaddress');
if ($this->_data['use_ssl']) {
$this->_updateSetting($upd_stmt, 1, 'system', 'use_ssl');
}
$this->_updateSetting($upd_stmt, $this->_data['servername'], 'system', 'hostname');
$this->_updateSetting($upd_stmt, $this->_languages[$this->_activelng], 'panel', 'standardlanguage');
$this->_updateSetting($upd_stmt, $this->_data['mysql_access_host'], 'system', 'mysql_access_host');
@@ -600,14 +604,14 @@ class FroxlorInstall
$this->_updateSetting($upd_stmt, '/etc/lighttpd/conf-enabled/', 'system', 'apacheconf_vhost');
$this->_updateSetting($upd_stmt, '/etc/lighttpd/froxlor-diroptions/', 'system', 'apacheconf_diroptions');
$this->_updateSetting($upd_stmt, '/etc/lighttpd/froxlor-htpasswd/', 'system', 'apacheconf_htpasswddir');
$this->_updateSetting($upd_stmt, '/etc/init.d/lighttpd reload', 'system', 'apachereload_command');
$this->_updateSetting($upd_stmt, 'service lighttpd reload', 'system', 'apachereload_command');
$this->_updateSetting($upd_stmt, '/etc/lighttpd/lighttpd.pem', 'system', 'ssl_cert_file');
$this->_updateSetting($upd_stmt, '/var/run/lighttpd/', 'phpfpm', 'fastcgi_ipcdir');
} elseif ($this->_data['webserver'] == "nginx") {
$this->_updateSetting($upd_stmt, '/etc/nginx/sites-enabled/', 'system', 'apacheconf_vhost');
$this->_updateSetting($upd_stmt, '/etc/nginx/sites-enabled/', 'system', 'apacheconf_diroptions');
$this->_updateSetting($upd_stmt, '/etc/nginx/froxlor-htpasswd/', 'system', 'apacheconf_htpasswddir');
$this->_updateSetting($upd_stmt, '/etc/init.d/nginx reload', 'system', 'apachereload_command');
$this->_updateSetting($upd_stmt, 'service nginx reload', 'system', 'apachereload_command');
$this->_updateSetting($upd_stmt, '/etc/nginx/nginx.pem', 'system', 'ssl_cert_file');
$this->_updateSetting($upd_stmt, '/var/run/', 'phpfpm', 'fastcgi_ipcdir');
$this->_updateSetting($upd_stmt, 'error', 'system', 'errorlog_level');
@@ -618,8 +622,10 @@ class FroxlorInstall
if ($this->_data['distribution'] == str_replace(".xml", "", strtolower(basename($_distribution)))) {
$dist = new \Froxlor\Config\ConfigParser($_distribution);
$defaults = $dist->getDefaults();
foreach ($defaults->property as $property) {
$this->_updateSetting($upd_stmt, $property->value, $property->settinggroup, $property->varname);
if (!empty($defaults)) {
foreach ($defaults as $property) {
$this->_updateSetting($upd_stmt, $property->attributes()->value, $property->attributes()->settinggroup, $property->attributes()->varname);
}
}
}
}

View File

@@ -194,9 +194,9 @@ class ConfigParser
}
// Get all defaults
$defaults = $this->xml->xpath('//defaults');
$defaults = $this->xml->xpath('//defaults/default');
foreach ($defaults as $default) {
$this->defaults = $default;
$this->defaults[] = $default;
}
// Switch flag to indicate we parsed our data

View File

@@ -72,11 +72,9 @@ class UI
if (function_exists("date_default_timezone_set") && function_exists("date_default_timezone_get")) {
@date_default_timezone_set(@date_default_timezone_get());
}
self::sendSslHeaders();
}
private static function sendSslHeaders()
public static function sendSslHeaders()
{
/**
* If Froxlor was called via HTTPS -> enforce it for the next time by settings HSTS header according to settings

View File

@@ -2,6 +2,11 @@
<froxlor>
<distribution name="Debian" codename="Bullseye"
version="11.x" defaulteditor="/bin/nano">
<!-- OS defaults to be loaded on installation -->
<defaults>
<default settinggroup="system" varname="nssextrausers" value="1"></default>
<default settinggroup="system" varname="use_mod_proxy" value="1"></default>
</defaults>
<services>
<!-- HTTP -->
<service type="http" title="{{lng.admin.configfiles.http}}">

View File

@@ -48,6 +48,9 @@ use voku\helper\AntiXSS;
use Froxlor\PhpHelper;
use Froxlor\UI\Panel\UI;
// include MySQL-tabledefinitions
require \Froxlor\Froxlor::getInstallDir() . '/lib/tables.inc.php';
UI::sendHeaders();
UI::initTwig();
@@ -118,8 +121,8 @@ if (!isset($sql) || !is_array($sql)) {
'phpExceptionHandler'
]);
// include MySQL-tabledefinitions
require \Froxlor\Froxlor::getInstallDir() . '/lib/tables.inc.php';
// send ssl-related headers (later than the others because we need a working database-connection and installation)
UI::sendSslHeaders();
// create a new idna converter
$idna_convert = new \Froxlor\Idna\IdnaWrapper();