-
Notifications
You must be signed in to change notification settings - Fork 7
Ensure initial admin password is set and visible during non-interactive installs #605
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -51,13 +51,22 @@ cd "$INSTALL_DIR" | |
| echo ">> Installing application dependencies..." | ||
| npm install | ||
|
|
||
| # Setup environment variables | ||
| # Create an initial admin password so it is always visible in non-interactive installs | ||
| if [ ! -f ".env" ]; then | ||
| echo ">> Setting up .env file..." | ||
| cp .env.example .env | ||
| echo ">> .env file created. Please configure it later if needed." | ||
| fi | ||
|
|
||
| if ! grep -q '^INITIAL_ADMIN_PASSWORD=' .env || [ -z "$(grep '^INITIAL_ADMIN_PASSWORD=' .env | cut -d'=' -f2-)" ]; then | ||
| INITIAL_ADMIN_PASSWORD_GENERATED=$(openssl rand -hex 8) | ||
| sed -i "s|^INITIAL_ADMIN_PASSWORD=.*|INITIAL_ADMIN_PASSWORD=${INITIAL_ADMIN_PASSWORD_GENERATED}|" .env | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Writing Useful? React with 👍 / 👎. |
||
| echo ">> Generated initial admin password and saved it to .env" | ||
| else | ||
| INITIAL_ADMIN_PASSWORD_GENERATED=$(grep '^INITIAL_ADMIN_PASSWORD=' .env | cut -d'=' -f2-) | ||
| echo ">> Reusing existing INITIAL_ADMIN_PASSWORD from .env" | ||
| fi | ||
|
|
||
| # Create a dedicated user for security | ||
| echo ">> Creating iptv-manager user..." | ||
| if id "iptv-manager" &>/dev/null; then | ||
|
|
@@ -107,6 +116,11 @@ echo ">> You can access the application at: http://$(hostname -I | awk '{print $ | |
| echo ">> To check the logs, run: sudo journalctl -u iptv-manager -f" | ||
| echo ">> To update in the future, run: sudo ./scripts/update.sh from the $INSTALL_DIR directory." | ||
| echo "" | ||
| echo ">> Initial WebUI admin credentials:" | ||
| echo " Username: admin" | ||
| echo " Password: ${INITIAL_ADMIN_PASSWORD_GENERATED}" | ||
| echo " (Stored in $INSTALL_DIR/.env as INITIAL_ADMIN_PASSWORD)" | ||
| echo "" | ||
| echo "Note: The default port is 3000. Ensure it is open in your firewall." | ||
| if command -v ufw > /dev/null; then | ||
| echo ">> If you are using UFW, you can open the port with: sudo ufw allow 3000/tcp" | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new password generation path now hard-depends on
openssl rand -hex 8, but this installer does not ensure theopensslbinary is present before calling it. Because the script runs withset -e, systems whereopensslis missing will abort the installation at this step, leaving users with a partial install instead of a recoverable fallback.Useful? React with 👍 / 👎.