git: d18954ef918c - main - net-mgmt/librenms: Update to 25.10.0
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 27 Oct 2025 13:29:04 UTC
The branch main has been updated by dvl:
URL: https://cgit.FreeBSD.org/ports/commit/?id=d18954ef918c03684302c065cd01380fe82cfae0
commit d18954ef918c03684302c065cd01380fe82cfae0
Author: Dan Langille <dvl@FreeBSD.org>
AuthorDate: 2025-10-15 20:18:03 +0000
Commit: Dan Langille <dvl@FreeBSD.org>
CommitDate: 2025-10-27 13:28:54 +0000
net-mgmt/librenms: Update to 25.10.0
re: https://github.com/librenms/librenms/releases/tag/25.10.0
The attached patch fixes an issue found on my install when validation
would fail because of get_current_user()
Patch is from https://github.com/librenms/librenms/pull/18372
---
net-mgmt/librenms/Makefile | 4 +-
net-mgmt/librenms/distinfo | 10 +--
net-mgmt/librenms/files/patch-18372 | 128 ++++++++++++++++++++++++++++++++++++
3 files changed, 135 insertions(+), 7 deletions(-)
diff --git a/net-mgmt/librenms/Makefile b/net-mgmt/librenms/Makefile
index 5f88bf9e07ab..d9081ca6f307 100644
--- a/net-mgmt/librenms/Makefile
+++ b/net-mgmt/librenms/Makefile
@@ -1,5 +1,5 @@
PORTNAME= librenms
-PORTVERSION= 25.9.1
+PORTVERSION= 25.10.0
PORTEPOCH= 1
CATEGORIES= net-mgmt
MASTER_SITES= LOCAL/dvl:vendor
@@ -133,7 +133,7 @@ _SCRIPT_FILES= daily.sh lnms
# _RELEASE_TIMESTAMP is used for a patch inside the vendor code
# it represents the release date via: git show --pretty='%H|%ct' -s 1.42.01
# It sits here so you remember to update it with each release
-_RELEASE_TIMESTAMP= 1758126180
+_RELEASE_TIMESTAMP= 1760517127
_ROOT_DIRS= LibreNMS app bootstrap config database doc html \
includes lang licenses mibs misc resources routes \
scripts tests
diff --git a/net-mgmt/librenms/distinfo b/net-mgmt/librenms/distinfo
index 981c11c49276..5e6c6879a7e8 100644
--- a/net-mgmt/librenms/distinfo
+++ b/net-mgmt/librenms/distinfo
@@ -1,5 +1,5 @@
-TIMESTAMP = 1758226502
-SHA256 (librenms-vendor-25.9.1.tar.gz) = a5c447f5f3f60056516f39915b8efc95624c4646585cb600d8da582ff7d9deea
-SIZE (librenms-vendor-25.9.1.tar.gz) = 27546661
-SHA256 (librenms-librenms-25.9.1_GH0.tar.gz) = c685b9d30ece1f5adc7d743e2ecea402562a35f081291363d3faca285049bd3a
-SIZE (librenms-librenms-25.9.1_GH0.tar.gz) = 71669135
+TIMESTAMP = 1760530638
+SHA256 (librenms-vendor-25.10.0.tar.gz) = 71ac45d3f718616b592e435d95858e3b31f226a812d0db8574009c2b09850026
+SIZE (librenms-vendor-25.10.0.tar.gz) = 27583825
+SHA256 (librenms-librenms-25.10.0_GH0.tar.gz) = 90c4d516a8b376bf0c41558a24941200c73a887ea2aeff4369f73e9e5f24184e
+SIZE (librenms-librenms-25.10.0_GH0.tar.gz) = 72309944
diff --git a/net-mgmt/librenms/files/patch-18372 b/net-mgmt/librenms/files/patch-18372
new file mode 100644
index 000000000000..4062191d420c
--- /dev/null
+++ b/net-mgmt/librenms/files/patch-18372
@@ -0,0 +1,128 @@
+From 4f5320469a927e9dcf7c46948026824a91b4838c Mon Sep 17 00:00:00 2001
+From: Tony Murray <murraytony@gmail.com>
+Date: Wed, 15 Oct 2025 12:31:34 -0500
+Subject: [PATCH] More accurate running user check Previously we did not have
+ access to config, so we had to infer the librenms user from the owner of the
+ executable. Because we are running later in the boot now, we can just use
+ config. Improve feedback text a bit.
+
+---
+ app/Checks.php | 44 -------------------
+ .../RunningAsIncorrectUserException.php | 10 +++++
+ app/Listeners/CommandStartingListener.php | 20 ++++++++-
+ 3 files changed, 29 insertions(+), 45 deletions(-)
+ create mode 100644 app/Exceptions/RunningAsIncorrectUserException.php
+
+diff --git a/app/Checks.php b/app/Checks.php
+index 5aa22f67cdbd..6f5caba39404 100644
+--- app/Checks.php
++++ app/Checks.php
+@@ -84,48 +84,4 @@ public static function postAuth()
+ }
+ }
+ }
+-
+- /**
+- * Check the script is running as the right user (works before config is available)
+- */
+- 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,
+- true
+- );
+- }
+- }
+-
+- private static function printMessage($title, $content, $exit = false)
+- {
+- $content = (array) $content;
+-
+- if (PHP_SAPI == 'cli') {
+- $format = "%s\n\n%s\n\n";
+- $message = implode(PHP_EOL, $content);
+- } else {
+- $format = "<h3 style='color: firebrick;'>%s</h3><p>%s</p>";
+- $message = '';
+- foreach ($content as $line) {
+- $message .= "<p style='margin:0.5em'>$line</p>\n";
+- }
+- }
+-
+- printf($format, $title, $message);
+-
+- if ($exit) {
+- exit(1);
+- }
+- }
+ }
+diff --git a/app/Exceptions/RunningAsIncorrectUserException.php b/app/Exceptions/RunningAsIncorrectUserException.php
+new file mode 100644
+index 000000000000..6d1aca825d72
+--- /dev/null
++++ app/Exceptions/RunningAsIncorrectUserException.php
+@@ -0,0 +1,10 @@
++<?php
++
++namespace App\Exceptions;
++
++use Symfony\Component\Console\Exception\ExceptionInterface;
++
++class RunningAsIncorrectUserException extends \Exception implements ExceptionInterface
++{
++ //
++}
+diff --git a/app/Listeners/CommandStartingListener.php b/app/Listeners/CommandStartingListener.php
+index bb435fa52ab2..8432b25d4bab 100644
+--- app/Listeners/CommandStartingListener.php
++++ app/Listeners/CommandStartingListener.php
+@@ -26,6 +26,7 @@
+
+ namespace App\Listeners;
+
++use App\Exceptions\RunningAsIncorrectUserException;
+ use Illuminate\Console\Events\CommandStarting;
+
+ class CommandStartingListener
+@@ -34,6 +35,9 @@ class CommandStartingListener
+ 'list:bash-completion',
+ ];
+
++ /**
++ * @throws RunningAsIncorrectUserException
++ */
+ public function handle(CommandStarting $event): void
+ {
+ // Check that we don't run this as the wrong user and break the install
+@@ -41,6 +45,20 @@ public function handle(CommandStarting $event): void
+ return;
+ }
+
+- \App\Checks::runningUser();
++ if (! function_exists('posix_getpwuid') || ! function_exists('posix_geteuid')) {
++ return;
++ }
++
++ $current_user = posix_getpwuid(posix_geteuid())['name'];
++ $executable = basename($_SERVER['argv'][0] ?? $_SERVER['SCRIPT_FILENAME'] ?? 'this');
++
++ if ($current_user == 'root') {
++ throw new RunningAsIncorrectUserException("Error: $executable must not run as root.");
++ }
++
++ $librenms_user = config('librenms.user');
++ if ($librenms_user !== $current_user) {
++ throw new RunningAsIncorrectUserException("Error: $executable must be run as the user $librenms_user.");
++ }
+ }
+ }