Skip to content

List missing credentials at install and wait 1 s between start retries - #1797

Merged
Desvelao merged 1 commit into
5.0.0from
fix/1796-install-lists-missing-credentials
Nov 26, 2026
Merged

Desvelao merged 1 commit into
5.0.0from
fix/1796-install-lists-missing-credentials

Conversation

@rodrigofez

Copy link
Copy Markdown
Member

Description

On a dashboard host without the indexer and the manager, the install doesn't say that passwords or CAs are missing, and ends with "Start the dashboard". The first start then fails and systemd retries it 3 times in about 2 s.

Closes #1796

Proposed Changes

 main(--install)
-  resolve() → print URL + "Start the dashboard" → exit 0          // problems found, never printed
+  resolve() → report(): MISSING lines + where to copy each from
+            → URL + "Start the dashboard" only when nothing is missing → exit 0
 wazuh-dashboard.service
   Restart=always
+  RestartSec=1                                                  // was systemd's 100 ms default
  • --install prints the same lines as the start check, through a new report() shared with --prestart. The install still exits 0.
  • The manager's warning: MISSING lines now also print at install, not only at start.
  • Each MISSING line says where to copy the item from (/etc/wazuh-<peer>/export/credentials.env or ca.pem, on an indexer node or the manager master node).
  • When something is missing, the install's last line says the dashboard won't start yet, instead of "Start the dashboard".
  • The unit waits 1 s between start retries. It still stops after 3 tries in 60 s.

Merge risk: two-way door · blast radius: package install output and the start retry timing

Results and Evidence

Tested on today's 5.0.0 nightly .deb (Ubuntu 24.04, systemd 255): the package unpacked, this branch's resolve-credentials.js and unit copied in, then dpkg --configure ran the real postinst. The nightly's resolver and unit are identical to origin/5.0.0.

Dashboard host with nothing placed: install output

Before:

resolve-credentials: created the dashboard CA in /etc/wazuh-dashboard/ca
resolve-credentials: issued /etc/wazuh-dashboard/certs/dashboard.pem

Wazuh dashboard: https://172.30.98.30
Log in as admin, with WAZUH_INDEXER_ADMIN_PASSWORD from /etc/wazuh-indexer/export/credentials.env on the indexer host.
Start the dashboard and enable it at boot: systemctl enable --now wazuh-dashboard

After:

resolve-credentials: created the dashboard CA in /etc/wazuh-dashboard/ca
resolve-credentials: issued /etc/wazuh-dashboard/certs/dashboard.pem
resolve-credentials: warning: MISSING WAZUH_MANAGER_WUI_PASSWORD (the manager's wazuh-internal-client account): the Server API connection is refused until it is present; once wazuh-manager is installed, the next start imports it
resolve-credentials:         copy it from /etc/wazuh-manager/export/credentials.env on the manager master node
resolve-credentials:         into /etc/wazuh-dashboard/local.env, or install wazuh-manager on this host first
resolve-credentials: warning: MISSING /etc/wazuh-dashboard/certs/manager-ca.pem: the Server API connection is refused until it is present; once wazuh-manager is installed, the next start imports it
resolve-credentials:         copy /etc/wazuh-manager/export/ca.pem from the manager master node there
resolve-credentials: MISSING WAZUH_INDEXER_KIBANASERVER_PASSWORD (the indexer's kibanaserver account)
resolve-credentials:         copy it from /etc/wazuh-indexer/export/credentials.env on an indexer node
resolve-credentials:         into /etc/wazuh-dashboard/local.env, or install wazuh-indexer on this host first
resolve-credentials: MISSING /etc/wazuh-dashboard/certs/indexer-ca.pem: no CA to verify the indexer with
resolve-credentials:         copy /etc/wazuh-indexer/export/ca.pem from an indexer node there

Wazuh dashboard: https://172.30.98.32
Log in as admin, with WAZUH_INDEXER_ADMIN_PASSWORD from /etc/wazuh-indexer/export/credentials.env on the indexer host.
The dashboard does not start until every MISSING, INVALID or UNSAFE entry above is resolved.
Then start it and enable it at boot: systemctl enable --now wazuh-dashboard

Same host: systemctl start wazuh-dashboard, retry timing (journalctl -o short-precise)

Event Before After
Try 1 fails 07.660 13.643
Try 2 starts 07.798 (+0.14 s) 14.802 (+1.16 s)
Try 3 starts 08.546 (+0.13 s) 16.547 (+1.18 s)
Start request repeated too quickly 09.286 (2.2 s in total) 18.287 (5.2 s in total)

Dashboard host set up by the docs (passwords and both CAs placed): unchanged

  • Install ends with Start the dashboard and enable it at boot, with no MISSING line, as before.
  • systemctl start: active, 0 restarts. /api/status is green. POST /api/check-api answers with "verify_ca":true.

Tests: install with nothing placed lists what is missing and where to copy it from and install with the indexer placed says to start, and warns about the manager, new. They fail on 5.0.0 (no report()) and pass here, with the other 36 resolver tests.

How to Test

  1. On a host without wazuh-indexer and wazuh-manager, install the wazuh-dashboard package from this PR without creating /etc/wazuh-dashboard/local.env or the certs/*-ca.pem files.
  2. Expected: the install lists the 2 MISSING items and the 2 manager warnings, each with a copy … from … line, and ends with The dashboard does not start until every MISSING, INVALID or UNSAFE entry above is resolved. The install exits 0.
  3. systemctl start wazuh-dashboard, then journalctl -u wazuh-dashboard -o short-precise | grep -E 'Starting|exited|repeated'.
  4. Expected: 3 tries about 1 s apart, then Start request repeated too quickly.
  5. On a second host, follow the dashboard step-by-step guide (passwords and both CAs placed before the install).
  6. Expected: the install ends with Start the dashboard and enable it at boot, and the dashboard starts on the first try.

Artifacts Affected

  • DEB and RPM packages: /usr/share/wazuh-dashboard/bin/resolve-credentials.js and wazuh-dashboard.service.

Configuration Changes

  • wazuh-dashboard.service: RestartSec=1 (was systemd's default, 100 ms).

Documentation Updates

  • dev-tools/build-packages/credentials/README.md: what --install prints.
  • Follow-up in wazuh-dashboard-plugins: docs/diag/diagnostic.md and docs/ref/getting-started/credentials.md quote the old set it in … local.env hint.

Tests Introduced

  • resolve-credentials.test.js: install with nothing placed (lines, sources, closing line, no "Start the dashboard"); install with the indexer placed (no problems, manager warnings, "Start the dashboard").

Review Checklist

  • Code changes reviewed
  • Relevant evidence provided
  • Tests cover the new functionality
  • Configuration changes documented
  • Developer documentation reflects the changes
  • Meets requirements and/or definition of done
  • No unresolved dependencies with other issues
  • PR is linked to the relevant issue(s)
  • Correct labels applied (e.g., no-changelog)

…t retries

The install now prints the same MISSING lines as the start check, with where to copy each password and CA from, and no longer says to start the service while one is missing. The unit waits 1 s between start retries instead of 100 ms.

Closes #1796

Signed-off-by: Rodrigo Lopez <rodrigo.lopez@wazuh.com>
@rodrigofez

Copy link
Copy Markdown
Member Author

@Ripdiegozz

Copy link
Copy Markdown

Checks run

Ubuntu 24.04 host with systemd, no indexer or manager. Before is the 5.0.0 nightly .deb of 2026-11-25 (same resolver and unit as the base); After is that .deb with this PR's resolve-credentials.js and unit.

Check Before After
🟢 Nothing placed: install lists what's missing and where to copy it from, no "Start"
🟢 Start retries 1 s apart
🟢 Indexer password and CA placed: still says "Start", adds the manager warnings
🟢 Install by the guide (passwords and both CAs placed, indexer and manager on other hosts): starts on the first try, Home shows the agents Not run
🟢 Resolver unit tests (38) New

Findings

  1. Closing line also counts the warnings (nit, not a blocker): the manager lines say warning: MISSING, and the closing line asks to resolve "every MISSING … entry above", so it reads as if the dashboard needs the manager items to start. It doesn't.

    Fix: in printFirstLogin, "The dashboard does not start until the MISSING, INVALID or UNSAFE entries above (not the warnings) are resolved."

@Desvelao
Desvelao merged commit 8f242c4 into 5.0.0 Nov 26, 2026
123 of 127 checks passed
@Desvelao
Desvelao deleted the fix/1796-install-lists-missing-credentials branch November 26, 2026 10:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dashboard install doesn't list missing passwords and CAs, and the start retries every 100 ms

3 participants