mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
lnms script should not be owned or ran by root
This commit is contained in:
+8
-2
@@ -31,8 +31,6 @@ use Auth;
|
||||
use Cache;
|
||||
use Carbon\Carbon;
|
||||
use LibreNMS\Config;
|
||||
use LibreNMS\Exceptions\FilePermissionsException;
|
||||
use Symfony\Component\HttpFoundation\Response as SymfonyResponse;
|
||||
use Toastr;
|
||||
|
||||
class Checks
|
||||
@@ -122,6 +120,14 @@ class Checks
|
||||
public static function runningUser()
|
||||
{
|
||||
if (function_exists('posix_getpwuid') && posix_getpwuid(posix_geteuid())['name'] !== get_current_user()) {
|
||||
if (get_current_user() == 'root') {
|
||||
self::printMessage(
|
||||
'Error: lnms file is owned by root, it should be owned and ran by a non-privileged user.',
|
||||
null,
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
self::printMessage(
|
||||
'Error: You must run lnms as the user ' . get_current_user(),
|
||||
null,
|
||||
|
||||
Reference in New Issue
Block a user