Skip to content

fix(icinga): default Director base templates to the master zone#1332

Open
NavidSassan wants to merge 1 commit into
mainfrom
fix/director-templates-default-master-zone
Open

fix(icinga): default Director base templates to the master zone#1332
NavidSassan wants to merge 1 commit into
mainfrom
fix/director-templates-default-master-zone

Conversation

@NavidSassan

Copy link
Copy Markdown
Member

What

Default the shipped Icinga Director base templates to the master zone, so host and service configuration (and any credentials on those objects) stays on the master instead of being distributed to every agent.

  • tpl-service-generic and tpl-host-generic: zone"master". Every other host/service template inherits it through the imports, so these two are the single control point for the whole tree's zone.
  • tpl-service-cert-no-agent and tpl-service-url-no-agent: zonenull (they now inherit master like everything else, removing the previous hand-pinned inconsistency).
  • No build-basket change: per-plugin and -no-agent templates stay zone-less and inherit.

Why

With the base templates zone-less, Director placed them in the global zone and every host/service inherited global, so a credential set on a host or service object was copied to every agent's on-disk config. A silent credential leak to all agents is a worse failure mode than a loud, documented config rejection.

Trade-off

This reverses the zone drop from #721. Single-node and flat master → agent setups are unaffected and now keep config on the master. Distributed setups with satellite- or agent-authoritative hosts fail loudly, because the master zone is never synced downwards, so those nodes cannot import the master-zoned templates. Such sites unset the zone on the two base templates to move them back to the global zone, accepting the credential distribution that entails. This is documented in ICINGA.md.

Verification

Behaviour confirmed against the icinga2 and icingaweb2-module-director sources:

  • Zone is an inheritable config attribute (configobject.ti), so pinning the two base templates propagates master to the whole tree.
  • Config sync only pushes global and child zones downwards, never the master (parent) zone (apilistener-filesync.cpp), which is why satellite/agent-authoritative hosts cannot import master-zoned templates.
  • The two exact deploy errors are quoted verbatim in ICINGA.md so they are greppable: Import references unknown template: '...' (expression.cpp) and Command endpoint must be in zone '...' or in a direct child zone thereof (checkable.cpp).
  • Service Sets render as apply rules and always go to the global zone, so a credential on a Service Set is never protected; documented accordingly.

mkdocs build --strict passes.

Docs

  • ICINGA.md: Distributed Monitoring section rewritten (single control point, config-sync reality, both exact error messages, distributed remediation, Service Set secret caveat); troubleshooting note updated.
  • CONTRIBUTING.md: matching contributor guidance.
  • CHANGELOG.md: admin-facing entry.

Closes #721.

tpl-service-generic and tpl-host-generic pinned no zone, so Director
placed them in the global zone and every host and service inherited
global through the template imports. Host and service configuration,
including credentials on those objects, was therefore distributed to
every agent's on-disk config.

Pin the two base templates to "master" and let every other template
(per-plugin and -no-agent) inherit it, so the base templates are the
single control point for the whole tree's zone. This keeps host and
service configuration on the master and its HA peers. Single-node and
flat master -> agent setups are unaffected: the agent zone is a direct
child of master, so the command_endpoint rule holds and the check still
runs on the agent. Distributed setups with satellite- or
agent-authoritative hosts cannot import the master-zoned templates,
since config sync never pushes the master zone downwards; such sites
unset the zone on the two base templates to move them back to the global
zone, accepting the credential distribution that entails.

Also normalize the two hand-maintained no-agent templates
(tpl-service-cert-no-agent, tpl-service-url-no-agent) to no zone so they
inherit from the base templates like everything else, and document the
model in ICINGA.md and CONTRIBUTING.md, including that Service Set
(apply-rule) vars always render to the global zone and must not carry
secrets.

This reverses the zone drop from
[#721](#721),
trading silent credential distribution for a loud failure on distributed
setups.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error in Director created configuration: Command endpoint must be in zone 'example-masters' or in a direct child zone thereof

1 participant