From 14c3bac0468dd280aab2b9e5f7b44e65aaedd432 Mon Sep 17 00:00:00 2001 From: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com> Date: Tue, 18 Nov 2025 11:17:52 +0100 Subject: [PATCH] librenms: Fix password to short (#9236) * librenms-install.sh aktualisieren * librenms.json aktualisieren * Update credentials and add generation * Update credentials and add generation * Refactor LibreNMS credentials output format Updated the script to change how LibreNMS credentials are written to the creds file, adding a header for clarity. * remove empty line * remove space --------- Co-authored-by: CanbiZ <47820557+MickLesk@users.noreply.github.com> --- frontend/public/json/librenms.json | 11 ++++++++--- install/librenms-install.sh | 10 +++++++++- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/frontend/public/json/librenms.json b/frontend/public/json/librenms.json index 502cb04a1..02ae2e9c7 100644 --- a/frontend/public/json/librenms.json +++ b/frontend/public/json/librenms.json @@ -28,8 +28,13 @@ } ], "default_credentials": { - "username": "admin", - "password": "admin" + "username": null, + "password": null }, - "notes": [] + "notes": [ + { + "text": "After installation, the admin user credentials are saved in the file ~/librenms.creds inside the container.", + "type": "info" + } + ] } diff --git a/install/librenms-install.sh b/install/librenms-install.sh index cf08acdce..41ee76ea3 100644 --- a/install/librenms-install.sh +++ b/install/librenms-install.sh @@ -113,11 +113,19 @@ mkdir -p /etc/bash_completion.d/ cp /opt/librenms/misc/lnms-completion.bash /etc/bash_completion.d/ cp /opt/librenms/snmpd.conf.example /etc/snmp/snmpd.conf +APP_PASSWORD=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13) +APP_USER="admin" +{ + echo "LibreNMS Credentials" + echo "Username: ${APP_USER}" + echo "Password: ${APP_PASSWORD}" +} >>~/librenms.creds + $STD su - librenms -s /bin/bash -c "cd /opt/librenms && COMPOSER_ALLOW_SUPERUSER=1 composer install --no-dev" $STD su - librenms -s /bin/bash -c "cd /opt/librenms && php8.4 artisan migrate --force" $STD su - librenms -s /bin/bash -c "cd /opt/librenms && php8.4 artisan key:generate --force" $STD su - librenms -s /bin/bash -c "cd /opt/librenms && lnms db:seed --force" -$STD su - librenms -s /bin/bash -c "cd /opt/librenms && lnms user:add -p admin -r admin admin" +$STD su - librenms -s /bin/bash -c "cd /opt/librenms && lnms user:add -p ${APP_PASSWORD} ${APP_USER} --role=admin" RANDOM_STRING=$(openssl rand -base64 16 | tr -dc 'a-zA-Z0-9') sed -i "s/RANDOMSTRINGHERE/$RANDOM_STRING/g" /etc/snmp/snmpd.conf