You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Metrics: require authentication for local Prometheus, Alertmanager and Grafana #8390
The metrics application runs three services on the leader node: Prometheus (collects the metrics), Alertmanager (handles the alerts) and Grafana (shows the dashboards). They listen only on the node itself, but they trust any program that connects from there. Any other application installed on the same node could read the metrics or change the alerts. The purpose of this change is to make each service check who is calling, without changing how administrators use them.
Proposed solution
Prometheus and Alertmanager ask for a password. The metrics application creates a random password once, keeps it in a file readable only by the application itself, and uses it in all its own components. The cluster alert list, run by the core as the system administrator on the same node, reads the same file.
Grafana relies on a signed token issued by the core for logged-in users. There is nothing to set up on install, update or leader change.
The Prometheus web interface is no longer published through the web proxy, and the related "Prometheus path" setting is removed from the Metrics settings page. For troubleshooting, administrators can reach it through an SSH tunnel, as described in the module README.
Logging in to Grafana from the cluster administration page works as before.
Upgrade notes:
The core must be updated before the metrics application: the new metrics release requires it.
Alert rules added by hand to Loki no longer reach Alertmanager, because they cannot send the password.
Alternative solutions
Leaving Prometheus without a password, as it only allows reading: discarded, because the metrics can still reveal information about the whole cluster.
Letting the core ask the metrics application for the alerts through a task: discarded as more complex than needed, since the core runs as administrator on the same node and can read the password directly.
Additional context
The administrator manual explains where to read the password and how to reach Prometheus.
Open the Metrics settings page: there is no "Prometheus path" field.
Set a Grafana path and save, then open Grafana from the link on the same page: it opens without asking for a password and the dashboards show data.
Open the Nodes page: CPU, memory and disk data are shown.
On the leader node run runagent -m metrics1 test-alert: the test alert shows up in the cluster alerts page.
Test case 2: update from the previous version
Start from a cluster with Grafana and Prometheus paths set, then update core and Metrics.
Open the Metrics settings page: the Grafana path is still set and there is no "Prometheus path" field.
Open Grafana from the link: it opens without asking for a password and the dashboards show data.
Open the old Prometheus address in the browser: it no longer works.
Repeat steps 3 and 4 of test case 1: same result.
Test case 3: services ask for a password
On the leader node run curl -s -o /dev/null -w '%{http_code}\n' http://127.0.0.1:9091/-/healthy: it prints 401.
Run the same command with port 9093: it prints 401.
Tested core:3.26.0-dev.6 + metrics:1.7.2-dev.2 on a fresh cluster (TC1) and on a cluster updated from core 3.25.1 + metrics 1.7.1 with both paths set (TC2).
No "Prometheus path" field; the Grafana path is kept after the update
Grafana shows data; Nodes page OK
The old /prometheus address returns 404 after the update; its route is removed
9091 and 9093 return 401 without credentials and 200 with the ones in basic_auth.json (mode 0600, owned by metrics1)
Direct requests to Grafana on 127.0.0.1:3000 return 401, without a token or with a forged one
Alerts reach list-alerts, also with the new core and the old metrics
Notes on the test plan:
Grafana still asks for the cluster-admin credentials, through the Traefik forward-auth as before. The test plan should say so instead of "opens without asking for a password".
runagent -m metrics1 test-alert never appears in the cluster alerts page, also on 3.25.1: cluster.alerts drops alerts without a module_id or target_type label. An alert with module_id shows up. To test step 4, the test alert needs a module_id label.
Nit: after the update get-configuration still returns prometheus_path, left in the module/metrics1/settings Redis hash. Harmless: sending it back to configure-module is accepted and does not restore the route.
Activity
DavidePrincipi commentedon Dec 1, 2026
Refs NethServer/agents#44
gsanchietti commentedon Dec 2, 2026
Testing versions:
ghcr.io/nethserver/core:3.26.0-dev.6,ghcr.io/nethserver/metrics:1.7.2-dev.2Fresh install (create the cluster after the core install, then update Metrics):
Update an existing cluster (core first, then Metrics):
Test case 1: fresh install
runagent -m metrics1 test-alert: the test alert shows up in the cluster alerts page.Test case 2: update from the previous version
Test case 3: services ask for a password
curl -s -o /dev/null -w '%{http_code}\n' http://127.0.0.1:9091/-/healthy: it prints401.9093: it prints401.DavidePrincipi commentedon Dec 2, 2026
VERIFIED
Tested
core:3.26.0-dev.6+metrics:1.7.2-dev.2on a fresh cluster (TC1) and on a cluster updated from core 3.25.1 + metrics 1.7.1 with both paths set (TC2)./prometheusaddress returns 404 after the update; its route is removed9091and9093return401without credentials and200with the ones inbasic_auth.json(mode 0600, owned bymetrics1)127.0.0.1:3000return401, without a token or with a forged onelist-alerts, also with the new core and the old metricsNotes on the test plan:
runagent -m metrics1 test-alertnever appears in the cluster alerts page, also on 3.25.1:cluster.alertsdrops alerts without amodule_idortarget_typelabel. An alert withmodule_idshows up. To test step 4, the test alert needs amodule_idlabel.Nit: after the update
get-configurationstill returnsprometheus_path, left in themodule/metrics1/settingsRedis hash. Harmless: sending it back toconfigure-moduleis accepted and does not restore the route.