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:
@@ -833,7 +833,21 @@ if ($page == 'customers'
|
|||||||
'guid' => $guid,
|
'guid' => $guid,
|
||||||
'members' => $loginname.','.Settings::Get('system.httpuser')
|
'members' => $loginname.','.Settings::Get('system.httpuser')
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// also, add froxlor-local user to ftp-group (if exists!) to
|
||||||
|
// allow access to customer-directories from within the panel, which
|
||||||
|
// is necessary when pathedit = Dropdown
|
||||||
|
if ((int)Settings::Get('system.mod_fcgid_ownvhost') == 1 || (int)Settings::Get('phpfpm.enabled_ownvhost') == 1) {
|
||||||
|
if ((int)Settings::Get('system.mod_fcgid') == 1) {
|
||||||
|
$local_user = Settings::Get('system.mod_fcgid_httpuser');
|
||||||
|
} else {
|
||||||
|
$local_user = Settings::Get('phpfpm.vhost_httpuser');
|
||||||
|
}
|
||||||
|
$ins_data['members'] .= ','.$local_user;
|
||||||
|
}
|
||||||
|
|
||||||
Database::pexecute($ins_stmt, $ins_data);
|
Database::pexecute($ins_stmt, $ins_data);
|
||||||
|
|
||||||
// FTP-Quotatallies
|
// FTP-Quotatallies
|
||||||
$ins_stmt = Database::prepare("
|
$ins_stmt = Database::prepare("
|
||||||
INSERT INTO `" . TABLE_FTP_QUOTATALLIES . "` SET `name` = :name, `quota_type` = 'user', `bytes_in_used` = '0',
|
INSERT INTO `" . TABLE_FTP_QUOTATALLIES . "` SET `name` = :name, `quota_type` = 'user', `bytes_in_used` = '0',
|
||||||
|
|||||||
@@ -86,6 +86,22 @@ while ($row = $result_tasks_stmt->fetch(PDO::FETCH_ASSOC)) {
|
|||||||
} else {
|
} else {
|
||||||
echo "Please check you Webserver settings\n";
|
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')));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user