set directory permissions to 0755 for mod_php user as they dont (want to) use libnss-mysql, fixes #1431

Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann (d00p)
2014-06-09 16:21:57 +02:00
parent 8b25ac1685
commit 1c1affa7bd

View File

@@ -134,8 +134,14 @@ while ($row = $result_tasks_stmt->fetch(PDO::FETCH_ASSOC)) {
$cronlog->logAction(CRON_ACTION, LOG_NOTICE, 'Running: chown -R ' . (int)$row['data']['uid'] . ':' . (int)$row['data']['gid'] . ' ' . escapeshellarg($userhomedir));
safe_exec('chown -R ' . (int)$row['data']['uid'] . ':' . (int)$row['data']['gid'] . ' ' . escapeshellarg($userhomedir));
// don't allow others to access the directory (webserver will be the group)
safe_exec('chmod 0750 ' . escapeshellarg($userhomedir));
// don't allow others to access the directory (webserver will be the group via libnss-mysql)
if (Settings::Get('system.mod_fcgid') == 1 || Settings::Get('phpfpm.enabled') == 1) {
// fcgid or fpm
safe_exec('chmod 0750 ' . escapeshellarg($userhomedir));
} else {
// mod_php -> no libnss-mysql -> no webserver-user in group
safe_exec('chmod 0755 ' . escapeshellarg($userhomedir));
}
$cronlog->logAction(CRON_ACTION, LOG_NOTICE, 'Running: chown -R ' . (int)Settings::Get('system.vmail_uid') . ':' . (int)Settings::Get('system.vmail_gid') . ' ' . escapeshellarg($usermaildir));
safe_exec('chown -R ' . (int)Settings::Get('system.vmail_uid') . ':' . (int)Settings::Get('system.vmail_gid') . ' ' . escapeshellarg($usermaildir));
}