various permission fixes when using fcgid / fpm and customerdocroots having 0770 and sockets are 0660

Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann (d00p)
2014-12-22 09:51:55 +01:00
parent 3c12e825f5
commit 366e0f6061
2 changed files with 30 additions and 0 deletions

View File

@@ -86,6 +86,22 @@ while ($row = $result_tasks_stmt->fetch(PDO::FETCH_ASSOC)) {
} else {
echo "Please check you Webserver settings\n";
}
// if we use php-fpm and have a local user for froxlor, we need to
// add the webserver-user to the local-group in order to allow the webserver
// to access the fpm-socket
if (Settings::Get('phpfpm.enabled') == 1 && function_exists("posix_getgrnam")) {
// get group info about the local-user's group (e.g. froxlorlocal)
$groupinfo = posix_getgrnam(Settings::Get('phpfpm.vhost_httpgroup'));
// check group members
if (isset($groupinfo['members'])
&& !in_array(Settings::Get('system.httpuser'), $groupinfo['members'])
) {
// webserver has no access, add it
safe_exec('usermod -aG ' . escapeshellarg(Settings::Get('phpfpm.vhost_httpgroup')." ".Settings::Get('system.httpuser')));
}
}
}
/**