diff --git a/frontend/public/json/librenms.json b/frontend/public/json/librenms.json index 09f294a24..02ae2e9c7 100644 --- a/frontend/public/json/librenms.json +++ b/frontend/public/json/librenms.json @@ -28,8 +28,13 @@ } ], "default_credentials": { - "username": "admin", - "password": "adminadmin!" + "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 e74a7213d..03ae3e179 100644 --- a/install/librenms-install.sh +++ b/install/librenms-install.sh @@ -113,11 +113,20 @@ 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" + +cat >~/librenms.creds <<'EOF' +LibreNMS Admin User Credentials +Username: ${APP_USER} +Password: ${APP_PASSWORD} +EOF + $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 adminadmin!" +$STD su - librenms -s /bin/bash -c "cd /opt/librenms && lnms user:add -p ${APP_USER} -r ${APP_USER} ${APP_PASSWORD}" RANDOM_STRING=$(openssl rand -base64 16 | tr -dc 'a-zA-Z0-9') sed -i "s/RANDOMSTRINGHERE/$RANDOM_STRING/g" /etc/snmp/snmpd.conf