Skip to content

v1.37

Choose a tag to compare

@hermanekt hermanekt released this 02 Oct 15:52
· 27 commits to main since this release
4eb4f0c

Legacy password login for Zabbix 5.0 and 5.2 - behind an explicit switch, version-locked, and loudly marked as what it is. Plus three fixes from the tracker: per-user tokens no longer need to name their server, the capacity report finds disk usage on current templates, and the "restart needed" detector no longer trusts file timestamps.

Added

  • legacy_auth for Zabbix 5.0 / 5.2 (#77, PR #78 by @rspadim, reworked). Those two releases have no API tokens - they were introduced in 5.4 - so until now they could not be connected at all. A [zabbix.X] entry may now carry legacy_auth = true with username/password, and the server signs in with user.login. The contributed PR made password login a silent fallback whenever api_token was missing and relaxed the library's version check for every credential login; this release keeps the mechanism and changes the rules around it:

    • Explicit only. username/password without legacy_auth = true is a configuration error, never a fallback. legacy_auth together with api_token is refused - one credential per entry, nothing inferred.
    • Version lock. On connect the server reads apiinfo.version and refuses legacy login against Zabbix 5.4 or newer. The same check runs in the admin portal's "Test connection" and "Test & Add". The switch cannot be used to avoid tokens on a release that has them.
    • Loud. Every start logs a WARNING per legacy entry naming the Zabbix version. The admin portal shows a red warning on the server card and inside the Add / Edit form, and greys out the API token field with a note while legacy auth is on.
    • Password hygiene. Never echoed back into a form re-render, never sent to the browser on edit ("leave empty to keep"), never logged, ${ENV_VAR} supported. The zabbix-utils version gate (refuses < 6.0) is relaxed only for legacy entries.
    • The user.login session expires; the existing reconnect-on-not authorised logic re-authenticates, so no long-lived session is deliberately kept alive.

    This is best effort for a Zabbix release that is out of upstream support, and holding a user password instead of a revocable token is a security risk you choose. README, config.example.toml, SECURITY.md and the portal all say so. The compatibility table now lists 5.4 (tokens exist, untested) separately from 5.0 / 5.2 (legacy, best effort).

Fixed

  • A token restricted to one server now uses that server by default (#74, reported by @metehan25). The recommended way to give each person their own Zabbix identity is one [zabbix.<user>] entry per person and a [tokens.<user>] with allowed_servers = ["<user>"]. That only worked for whoever was listed first: a call that did not say which server it meant fell back to the global default - the first server in the config - and everyone else got Token 'bob' is not authorized for server 'alice' for an ordinary question. When the caller's token allows exactly one configured server, that server is now the default for the call. A wildcard, a multi-server token, an unknown name, or no token at all (stdio) keep the global default, and the authorization check still runs afterwards, so a caller can only ever land on a server it could have named explicitly. Naming a server the token does not allow is refused exactly as before.
  • Capacity report (host) showed an empty Disk Usage table on hosts monitored by current templates (#84). "Linux by Zabbix agent" and "Windows by Zabbix agent" (6.0+) collect filesystem usage as dependent items keyed vfs.fs.dependent.size[/,pused] / vfs.fs.dependent.size[C:,pused]; the report only searched for vfs.fs.size[...], and item.get's search is a substring match, so neither spelling finds the other. The report now tries the dependent keys first and the plain ones after, so old templates and hand-made items keep working.
  • "Restart needed" could be missed for an edit made within the same second as the baseline (#80). The detector compared config.toml's mtime with the one recorded at startup and only re-read the file when it had changed. On filesystems with coarse timestamps - and on any filesystem when the file is rewritten quickly, as the installer and sed do - the mtime can stay equal while the content differs, so the banner stayed off. The detector now compares the file's content with the startup snapshot on every check and ignores timestamps altogether; the comparison is a dump of the parsed document, so a reformat that changes nothing still does not raise it.
  • Tooltips anchored to the right edge of a card header (the badges on a server card) or to the top bar ran off the page: the popover was always centred under its element and opened upwards. A small script in base.html now measures on hover / focus and anchors the popover to the element's right or left edge, or opens it below, so every data-tooltip in the portal stays on screen; the markup is untouched.
  • The pattern attribute on the server-name inputs ([a-zA-Z][a-zA-Z0-9_-]*) is an invalid regular expression under the Unicode-sets flag current browsers compile it with, so checkValidity() threw and native validation of the Add / Edit Server forms was silently skipped. The hyphen is now escaped.

Verified

  • Found by the pre-release security review and fixed before anything shipped: the portal's "Test & Add" had started passing the library's version gate for token auth too, which turned a valid token test against Zabbix 8.0 red (the probe is a throwaway client and skips that gate again; the legacy lock is our own check); the saved-server "Test connection" sent an ${ENV_VAR} password to Zabbix literally instead of resolving it as the loader does; the startup warning now also says when the legacy password travels over plain http://; and the "non-boolean legacy_auth" error no longer echoes the raw value. The README's multi-server example still showed a password pair without the switch - exactly the shape the loader now refuses - and was corrected.
  • 478 unit + e2e tests, all passing. 44 new: the loader rules (flag/token/credentials matrix, env expansion, non-boolean flag), the client (5.0 logs in and warns; 5.4 / 6.0 / 7.4 / 8.0 refused before any login; token path keeps the operator's version-gate setting), the portal handlers driven as themselves (what the form writes is what the loader accepts; a validation error never carries the password back), and the three connection probes (version lock before any login, ${ENV_VAR} resolved before probing, a token test against 8.0 stays green) - the last two verified to fail on the pre-fix code. For the three tracker fixes: the token-scoped default (single server, wildcard, several servers, unknown name, no token, no global default), the capacity report driven with an item.get fake that matches by substring the way Zabbix does (Linux and Windows dependent keys found, / not confused with /boot or /var, plain key still works, all four spellings tried before giving up - 3 of 5 fail on the pre-fix code), and a same-second config edit with os.utime pinning the mtime (fails on the pre-fix code).
  • Live against a real Zabbix 5.0.47 (Docker, zabbix/zabbix-server-pgsql:alpine-5.0-latest): added through the admin portal with legacy auth, "Test & Add" green, config written with legacy_auth = true and no api_token, server restarted, host_get through MCP returned data, startup WARNING logged. The same entry pointed at a Zabbix 7.4.8 was refused by the runtime client and by the portal's "Test & Add" with the version message, and nothing was written.
  • Live, #74: an instance with two servers and two single-server tokens plus one two-server token; over MCP, the second user's host_get without server was refused with not authorized for server 'alice' on the pre-fix build and returned their own hosts after - while naming the other server explicitly stays refused and the two-server token still lands on the global default. Live, #84: the host capacity report against Zabbix 7.4 (vfs.fs.dependent.size[/,pused], /boot alongside) produced Disk Usage rows=0 before and one row at 17.9% after, CPU and memory unchanged.
  • CRUD smoke against live Zabbix 7.4; installer matrix 18/18.