From a080b1cd7c8049944b76d53cb53edc796f15c29f Mon Sep 17 00:00:00 2001 From: Michael Seevogel Date: Wed, 29 Mar 2023 21:10:10 +0200 Subject: [PATCH 1/2] simplify redhat os detection for the Nginx EL workaround --- server/lib/classes/system.inc.php | 10 ++++++++ server/plugins-available/nginx_plugin.inc.php | 24 +++++++------------ 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/server/lib/classes/system.inc.php b/server/lib/classes/system.inc.php index 7e4e7ae447..15098b80c0 100644 --- a/server/lib/classes/system.inc.php +++ b/server/lib/classes/system.inc.php @@ -2327,6 +2327,16 @@ class system{ return true; } + public function is_redhat_os() { + global $app; + + if(file_exists('/etc/redhat-release') && (filesize('/etc/redhat-release') > 0)) { + return true; + } else { + return false; + } + } + public function is_allowed_path($path) { global $app; diff --git a/server/plugins-available/nginx_plugin.inc.php b/server/plugins-available/nginx_plugin.inc.php index 1a4b3336da..818399970c 100644 --- a/server/plugins-available/nginx_plugin.inc.php +++ b/server/plugins-available/nginx_plugin.inc.php @@ -2852,7 +2852,6 @@ class nginx_plugin { private function php_fpm_pool_update ($data, $web_config, $pool_dir, $pool_name, $socket_dir, $web_folder = null) { global $app, $conf; $pool_dir = trim($pool_dir); - $rh_releasefiles = array('/etc/centos-release', '/etc/redhat-release'); // HHVM => PHP-FPM-Fallback $default_php_fpm = true; @@ -2923,21 +2922,14 @@ class nginx_plugin { $tpl->setVar('fpm_port', $web_config['php_fpm_start_port'] + $data['new']['domain_id'] - 1); $tpl->setVar('fpm_user', $data['new']['system_user']); - //Red Hat workaround for group ownership of socket files - foreach($rh_releasefiles as $rh_file) { - if(file_exists($rh_file) && (filesize($rh_file) > 0)) { - $tmp = file_get_contents($rh_file); - if(preg_match('/[678]+\.[0-9]+/m', $tmp)) { - $tpl->setVar('fpm_group', $data['new']['system_group']); - $tpl->setVar('fpm_listen_group', $data['new']['system_group']); - } - unset($tmp); - } elseif(!file_exists($rh_file)) { - //OS seems to be not Red Hat'ish - $tpl->setVar('fpm_group', $data['new']['system_group']); - $tpl->setVar('fpm_listen_group', $web_config['group']); - } - break; + // RH workaround here + if($app->system->is_redhat_os() == 1) { + $tpl->setVar('fpm_group', $data['new']['system_group']); + $tpl->setVar('fpm_listen_group', $data['new']['system_group']); + } else { + //OS seems to be not Red Hat'ish + $tpl->setVar('fpm_group', $data['new']['system_group']); + $tpl->setVar('fpm_listen_group', $web_config['group']); } $tpl->setVar('fpm_listen_user', $data['new']['system_user']); -- GitLab From 9b603507d20bcc77fd1f7d4e4e0abac88e0ced48 Mon Sep 17 00:00:00 2001 From: Till Brehm Date: Fri, 14 Apr 2023 06:14:24 +0000 Subject: [PATCH 2/2] Update nginx_plugin.inc.php --- server/plugins-available/nginx_plugin.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/plugins-available/nginx_plugin.inc.php b/server/plugins-available/nginx_plugin.inc.php index 818399970c..78144e7bfb 100644 --- a/server/plugins-available/nginx_plugin.inc.php +++ b/server/plugins-available/nginx_plugin.inc.php @@ -2923,7 +2923,7 @@ class nginx_plugin { $tpl->setVar('fpm_user', $data['new']['system_user']); // RH workaround here - if($app->system->is_redhat_os() == 1) { + if($app->system->is_redhat_os() == true) { $tpl->setVar('fpm_group', $data['new']['system_group']); $tpl->setVar('fpm_listen_group', $data['new']['system_group']); } else { -- GitLab