Update credentials and add generation

This commit is contained in:
Michel Roegl-Brunner
2025-11-18 08:36:53 +01:00
parent 3057502c61
commit 495e341143
2 changed files with 18 additions and 4 deletions

View File

@@ -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"
}
]
}

View File

@@ -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