lnms script should not be owned or ran by root

This commit is contained in:
Tony Murray
2020-06-22 14:38:20 -05:00
parent fc55830c7a
commit 5eddbb7fe2
+8 -2
View File
@@ -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,