Skip to content

Commit 14c3bac

Browse files
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 <[email protected]>
1 parent 52a18af commit 14c3bac

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

frontend/public/json/librenms.json

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,13 @@
2828
}
2929
],
3030
"default_credentials": {
31-
"username": "admin",
32-
"password": "admin"
31+
"username": null,
32+
"password": null
3333
},
34-
"notes": []
34+
"notes": [
35+
{
36+
"text": "After installation, the admin user credentials are saved in the file ~/librenms.creds inside the container.",
37+
"type": "info"
38+
}
39+
]
3540
}

install/librenms-install.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,19 @@ mkdir -p /etc/bash_completion.d/
113113
cp /opt/librenms/misc/lnms-completion.bash /etc/bash_completion.d/
114114
cp /opt/librenms/snmpd.conf.example /etc/snmp/snmpd.conf
115115

116+
APP_PASSWORD=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13)
117+
APP_USER="admin"
118+
{
119+
echo "LibreNMS Credentials"
120+
echo "Username: ${APP_USER}"
121+
echo "Password: ${APP_PASSWORD}"
122+
} >>~/librenms.creds
123+
116124
$STD su - librenms -s /bin/bash -c "cd /opt/librenms && COMPOSER_ALLOW_SUPERUSER=1 composer install --no-dev"
117125
$STD su - librenms -s /bin/bash -c "cd /opt/librenms && php8.4 artisan migrate --force"
118126
$STD su - librenms -s /bin/bash -c "cd /opt/librenms && php8.4 artisan key:generate --force"
119127
$STD su - librenms -s /bin/bash -c "cd /opt/librenms && lnms db:seed --force"
120-
$STD su - librenms -s /bin/bash -c "cd /opt/librenms && lnms user:add -p admin -r admin admin"
128+
$STD su - librenms -s /bin/bash -c "cd /opt/librenms && lnms user:add -p ${APP_PASSWORD} ${APP_USER} --role=admin"
121129

122130
RANDOM_STRING=$(openssl rand -base64 16 | tr -dc 'a-zA-Z0-9')
123131
sed -i "s/RANDOMSTRINGHERE/$RANDOM_STRING/g" /etc/snmp/snmpd.conf

0 commit comments

Comments
 (0)