fix(icinga): default Director base templates to the master zone#1332
Open
NavidSassan wants to merge 1 commit into
Open
fix(icinga): default Director base templates to the master zone#1332NavidSassan wants to merge 1 commit into
NavidSassan wants to merge 1 commit into
Conversation
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.
8 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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-genericandtpl-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-agentandtpl-service-url-no-agent:zone→null(they now inherit master like everything else, removing the previous hand-pinned inconsistency).build-basketchange: per-plugin and-no-agenttemplates 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:
configobject.ti), so pinning the two base templates propagates master to the whole tree.apilistener-filesync.cpp), which is why satellite/agent-authoritative hosts cannot import master-zoned templates.ICINGA.mdso they are greppable:Import references unknown template: '...'(expression.cpp) andCommand endpoint must be in zone '...' or in a direct child zone thereof(checkable.cpp).mkdocs build --strictpasses.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.