ExportXMLWordPrintable

    • Prev.Sprint, S26-W44/45
    • 0.125

      In the autoregistration branch of add_discovered_host() (in zabbix_server/operations/operations.c), the update hosts statement is built from optional parts separated by delim.

      If monitored_by is the first changed field and the TLS settings also change, the next part is appended with a space instead of a comma.

      Trigger conditions (all required):
        - hosts.monitored_by differs from the new value.
        - hosts.proxyid and hosts.proxy_groupid both match the new values, so delim is still ' '.
        - hosts.tls_accept differs from the TLS mode of the autoregistration connection.

      For a consistent hosts row, the second condition can't occur together with the first, because every change between server, proxy and proxy group also changes proxyid or proxy_groupid. The bug therefore needs a row where monitored_by doesn't match those fields, for example monitored_by=1 with proxyid NULL.

      Impact:
        - Failed update: the statement fails with an SQL syntax error, and add_discovered_host() ignores the result zbx_db_execute().
        - Settings not applied: neither the monitored_by nor the TLS/PSK changes are saved, and this can repeat on every autoregistration while the row stays inconsistent.
        - Audit entries: they are still generated for these changes, even though the update failed.

      Steps to reproduce:
        1. Create an autoregistered host monitored by the server, with tls_accept=1 (no encryption).
        2. Make the row inconsistent: update hosts set monitored_by=1 where hostid=<hostid>; (proxyid stays NULL).
        3. Configure autoregistration with PSK and an action with the "Add host" operation.
        4. Autoregister the same host directly with the server using PSK.

      Actual result: the server log shows an SQL syntax error, and the host is not updated.

      Expected result: the host is updated with monitored_by=0 and the new TLS/PSK settings.

            Assignee:
            Mihails Prihodko
            Reporter:
            Michael Veksler
            Team B
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:

                Estimated:
                Original Estimate - 1h Original Estimate - 1h
                1h
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 3.5h
                3.5h