From 5eddbb7fe27f0cb89237d42ae29b6c4605646494 Mon Sep 17 00:00:00 2001 From: Tony Murray Date: Mon, 22 Jun 2020 14:38:20 -0500 Subject: [PATCH] lnms script should not be owned or ran by root --- app/Checks.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/Checks.php b/app/Checks.php index d1af6fa5a7..7ebf79cc7c 100644 --- a/app/Checks.php +++ b/app/Checks.php @@ -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,