diff --git a/install/scripts/config-services.php b/install/scripts/config-services.php index 1236fbf5..69d1b654 100755 --- a/install/scripts/config-services.php +++ b/install/scripts/config-services.php @@ -316,7 +316,7 @@ class Action case "file": if (array_key_exists('content', $action)) { CmdLineHandler::printwarn("Creating file '" . $action['name'] . "'"); - file_put_contents($action['name'], strtr($action['content'], $replace_arr)); + file_put_contents($action['name'], trim(strtr($action['content'], $replace_arr))); } elseif (array_key_exists('subcommands', $action)) { foreach ($action['subcommands'] as $fileaction) { if (array_key_exists('execute', $fileaction) && $fileaction['execute'] == "pre") { @@ -325,7 +325,7 @@ class Action exec(strtr($fileaction['content'], $replace_arr)); } elseif ($fileaction['type'] == 'file') { CmdLineHandler::printwarn("Creating file '" . $fileaction['name'] . "'"); - file_put_contents($fileaction['name'], strtr($fileaction['content'], $replace_arr)); + file_put_contents($fileaction['name'], trim(strtr($fileaction['content'], $replace_arr))); } } } diff --git a/lib/classes/settings/class.SImExporter.php b/lib/classes/settings/class.SImExporter.php index 428d8beb..10e8aa32 100644 --- a/lib/classes/settings/class.SImExporter.php +++ b/lib/classes/settings/class.SImExporter.php @@ -98,14 +98,28 @@ class SImExporter // when there were changes in the variable-name or similar unset($_data['panel.version']); unset($_data['panel.db_version']); - + // validate we got ssl enabled ips when ssl is enabled + // otherwise deactivate it + if ($_data['system.use_ssl'] == 1) { + $result_ssl_ipsandports_stmt = Database::prepare(" + SELECT COUNT(*) as count_ssl_ip FROM `" . TABLE_PANEL_IPSANDPORTS . "` WHERE `ssl`='1' + "); + $result = Database::pexecute_first($result_ssl_ipsandports_stmt); + if ($result['count_ssl_ip'] <= 0) { + // no ssl-ip -> deactivate + $_data['system.use_ssl'] = 0; + // deactivate other ssl-related settings + $_data['system.leenabled'] = 0; + $_data['system.le_froxlor_enabled'] = 0; + $_data['system.le_froxlor_redirect'] = 0; + } + } // store new data foreach ($_data as $index => $value) { Settings::Set($index, $value); } // save to DB Settings::Flush(); - // all good return true; } diff --git a/lib/configfiles/jessie.xml b/lib/configfiles/jessie.xml index 10ee0a2f..062cdb9b 100644 --- a/lib/configfiles/jessie.xml +++ b/lib/configfiles/jessie.xml @@ -48,6 +48,11 @@ //service[@type='http']/general/commands + + {{settings.system.use_ssl}} + + + {{settings.phpfpm.enabled}} @@ -4753,6 +4758,11 @@ aliases: files + + {{settings.system.webserver}} + + + diff --git a/lib/configfiles/precise.xml b/lib/configfiles/precise.xml index 806d86e6..7017ec3c 100644 --- a/lib/configfiles/precise.xml +++ b/lib/configfiles/precise.xml @@ -49,6 +49,11 @@ //service[@type='http']/general/commands + + {{settings.system.use_ssl}} + + + {{settings.phpfpm.enabled}} @@ -1752,6 +1757,11 @@ aliases: files + + {{settings.system.webserver}} + + + diff --git a/lib/configfiles/stretch.xml b/lib/configfiles/stretch.xml index 7d9eab6b..df0a1cd6 100644 --- a/lib/configfiles/stretch.xml +++ b/lib/configfiles/stretch.xml @@ -48,6 +48,11 @@ //service[@type='http']/general/commands + + {{settings.system.use_ssl}} + + + {{settings.phpfpm.enabled}} @@ -4647,6 +4652,11 @@ aliases: files + + {{settings.system.webserver}} + + + diff --git a/lib/configfiles/trusty.xml b/lib/configfiles/trusty.xml index 0dc4c61f..07788901 100644 --- a/lib/configfiles/trusty.xml +++ b/lib/configfiles/trusty.xml @@ -49,6 +49,11 @@ //service[@type='http']/general/commands + + {{settings.system.use_ssl}} + + + {{settings.phpfpm.enabled}} @@ -85,6 +90,11 @@ Alias "/.well-known/acme-challenge" "{{settings.system.letsencryptchallengepath} //service[@type='http']/general/commands + + {{settings.system.use_ssl}} + + + {{settings.phpfpm.enabled}} @@ -1761,6 +1771,11 @@ aliases: files + + {{settings.system.webserver}} + + + diff --git a/lib/configfiles/wheezy.xml b/lib/configfiles/wheezy.xml index 55ba59d4..17ed9ed9 100644 --- a/lib/configfiles/wheezy.xml +++ b/lib/configfiles/wheezy.xml @@ -49,6 +49,11 @@ //service[@type='http']/general/commands + + {{settings.system.use_ssl}} + + + {{settings.phpfpm.enabled}} @@ -85,6 +90,11 @@ Alias "/.well-known/acme-challenge" "{{settings.system.letsencryptchallengepath} //service[@type='http']/general/commands + + {{settings.system.use_ssl}} + + + {{settings.phpfpm.enabled}} @@ -5561,6 +5571,11 @@ aliases: files + + {{settings.system.webserver}} + + +