From bcb8eb9418642337f1eadcdec030c7f4a07a8a67 Mon Sep 17 00:00:00 2001
From: ftimme <ft@falkotimme.com>
Date: Sun, 25 Sep 2011 22:15:18 +0000
Subject: [PATCH] - Installer adds ispconfig user to Apache group on
 Fedora/CentOS so that nginx/PHP-FPM can access /etc/squirrelmail and serve
 SquirrelMail for the ISPConfig vhost. - Added session.save_path and
 upload_tmp_dir settings to the PHP-FPM pool definitions.

---
 install/dist/lib/fedora.lib.php               | 3 +++
 install/tpl/php_fpm_pool.conf.master          | 5 ++++-
 server/conf/php_fpm_pool.conf.master          | 2 ++
 server/plugins-available/nginx_plugin.inc.php | 1 +
 4 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/install/dist/lib/fedora.lib.php b/install/dist/lib/fedora.lib.php
index 0b6aab8060..22318df5d4 100644
--- a/install/dist/lib/fedora.lib.php
+++ b/install/dist/lib/fedora.lib.php
@@ -861,6 +861,9 @@ class installer_dist extends installer_base {
 		if($conf['nginx']['installed'] == true){
 			$command = 'usermod -a -G ispconfig '.$conf['nginx']['user'];
 			caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
+			// Allow the ISPConfig vhost access to /etc/squirrelmail
+			$command = 'usermod -a -G '.$conf['apache']['group'].' ispconfig';
+			caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
 		}
 		
 		//* Make the shell scripts executable
diff --git a/install/tpl/php_fpm_pool.conf.master b/install/tpl/php_fpm_pool.conf.master
index 1b27bb9938..5a2c6c8d92 100644
--- a/install/tpl/php_fpm_pool.conf.master
+++ b/install/tpl/php_fpm_pool.conf.master
@@ -13,4 +13,7 @@ pm.start_servers = 20
 pm.min_spare_servers = 5
 pm.max_spare_servers = 35
 
-chdir = /
\ No newline at end of file
+chdir = /
+
+php_admin_value[session.save_path] = /usr/local/ispconfig/server/temp
+php_admin_flag[magic_quotes_gpc] = off
\ No newline at end of file
diff --git a/server/conf/php_fpm_pool.conf.master b/server/conf/php_fpm_pool.conf.master
index 0bde26bcd8..0e741734f1 100644
--- a/server/conf/php_fpm_pool.conf.master
+++ b/server/conf/php_fpm_pool.conf.master
@@ -24,6 +24,8 @@ chdir = /
 
 <tmpl_if name='security_level' op='==' value='20'>
 <tmpl_var name='enable_php_open_basedir'>php_admin_value[open_basedir] = <tmpl_var name='php_open_basedir'>
+php_admin_value[session.save_path] = <tmpl_var name='document_root'>/tmp
+php_admin_value[upload_tmp_dir] = <tmpl_var name='document_root'>/tmp
 </tmpl_if>
 
 <tmpl_loop name="custom_php_ini_settings">
diff --git a/server/plugins-available/nginx_plugin.inc.php b/server/plugins-available/nginx_plugin.inc.php
index 07c0332d41..4c9c2abfae 100644
--- a/server/plugins-available/nginx_plugin.inc.php
+++ b/server/plugins-available/nginx_plugin.inc.php
@@ -1132,6 +1132,7 @@ 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']);
 		$tpl->setVar('fpm_group', $data['new']['system_group']);
+		$tpl->setVar('document_root', $data['new']['document_root']);
 		$tpl->setVar('security_level',$web_config['security_level']);
 		$php_open_basedir = ($data['new']['php_open_basedir'] == '')?escapeshellcmd($data['new']['document_root']):escapeshellcmd($data['new']['php_open_basedir']);
 		$tpl->setVar('php_open_basedir', $php_open_basedir);
-- 
GitLab