An agent whose site only lets it connect out (NetOrk/netork#2683) had nowhere to say so: zabbix_agent_config always wrote Server and left StartAgents at the agent's default, and the firewall step opened listen_port to allowed_sources. netOrk's native install and container replace therefore set up a passive listener on sites marked active-only.
zabbix_agent_config writes StartAgents=0 for it and comments Server out. Zabbix's agent documentation says Server is mandatory only while StartAgents is not 0, and that StartAgents=0 disables passive checks so the agent listens on no TCP port. This matches the agent image's ZBX_PASSIVE_ALLOW=false.
check_zabbix_agent_settings: for active_only, server_active is required and server may be empty. Addresses that are given are still checked. active_only must be a bool.
configure_zabbix_agent's firewall step opens nothing for active_only and does not call the driver's _allow_zabbix_agent_sources. The step list stays the same, so callers' step names keep working.
An agent that is not active only gets a StartAgents=0 line commented out, because otherwise an agent that was active only before would never listen again. Any other count stays as it is.
All three drivers that implement ZabbixAgentMixin at their current netOrk pins (napalm-linux, napalm-openwrt, napalm-proxmox) write their configuration through zabbix_agent_config and are reached only through the template's firewall step, so none of them needs a change.
Tests
tests/test_zabbix_agent.py: a new TestActiveOnly class (config lines, idempotence, switching back to passive, a listener count of its own, settings checks), plus TestZabbixAgentMixin::test_an_active_only_agent_opens_no_port. pytest tests/test_zabbix_agent.py tests/test_fix_templates.py passes (139 tests). ruff and mypy are clean.
CHANGELOG has an entry under Unreleased and README.md is updated. There is no version bump.
An agent whose site only lets it connect out (NetOrk/netork#2683) had nowhere to say so: `zabbix_agent_config` always wrote `Server` and left `StartAgents` at the agent's default, and the firewall step opened `listen_port` to `allowed_sources`. netOrk's native install and container replace therefore set up a passive listener on sites marked active-only.
## What changes
- `ZabbixAgentSettingsDict.active_only` (optional, default False).
- `zabbix_agent_config` writes `StartAgents=0` for it and comments `Server` out. Zabbix's agent documentation says `Server` is mandatory only while `StartAgents` is not 0, and that `StartAgents=0` disables passive checks so the agent listens on no TCP port. This matches the agent image's `ZBX_PASSIVE_ALLOW=false`.
- `check_zabbix_agent_settings`: for `active_only`, `server_active` is required and `server` may be empty. Addresses that are given are still checked. `active_only` must be a bool.
- `configure_zabbix_agent`'s firewall step opens nothing for `active_only` and does not call the driver's `_allow_zabbix_agent_sources`. The step list stays the same, so callers' step names keep working.
- An agent that is not active only gets a `StartAgents=0` line commented out, because otherwise an agent that was active only before would never listen again. Any other count stays as it is.
All three drivers that implement `ZabbixAgentMixin` at their current netOrk pins (napalm-linux, napalm-openwrt, napalm-proxmox) write their configuration through `zabbix_agent_config` and are reached only through the template's firewall step, so none of them needs a change.
## Tests
`tests/test_zabbix_agent.py`: a new `TestActiveOnly` class (config lines, idempotence, switching back to passive, a listener count of its own, settings checks), plus `TestZabbixAgentMixin::test_an_active_only_agent_opens_no_port`. `pytest tests/test_zabbix_agent.py tests/test_fix_templates.py` passes (139 tests). ruff and mypy are clean.
CHANGELOG has an entry under Unreleased and README.md is updated. There is no version bump.
NetOrk/netork#2683
ZabbixAgentSettingsDict.active_only: zabbix_agent_config writes
StartAgents=0 and comments Server out (mandatory only while StartAgents
is not 0); ServerActive is required instead. configure_zabbix_agent's
firewall step opens nothing for it. An agent that is not active only gets
a StartAgents=0 line commented out.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
An agent whose site only lets it connect out (NetOrk/netork#2683) had nowhere to say so:
zabbix_agent_configalways wroteServerand leftStartAgentsat the agent's default, and the firewall step openedlisten_porttoallowed_sources. netOrk's native install and container replace therefore set up a passive listener on sites marked active-only.What changes
ZabbixAgentSettingsDict.active_only(optional, default False).zabbix_agent_configwritesStartAgents=0for it and commentsServerout. Zabbix's agent documentation saysServeris mandatory only whileStartAgentsis not 0, and thatStartAgents=0disables passive checks so the agent listens on no TCP port. This matches the agent image'sZBX_PASSIVE_ALLOW=false.check_zabbix_agent_settings: foractive_only,server_activeis required andservermay be empty. Addresses that are given are still checked.active_onlymust be a bool.configure_zabbix_agent's firewall step opens nothing foractive_onlyand does not call the driver's_allow_zabbix_agent_sources. The step list stays the same, so callers' step names keep working.StartAgents=0line commented out, because otherwise an agent that was active only before would never listen again. Any other count stays as it is.All three drivers that implement
ZabbixAgentMixinat their current netOrk pins (napalm-linux, napalm-openwrt, napalm-proxmox) write their configuration throughzabbix_agent_configand are reached only through the template's firewall step, so none of them needs a change.Tests
tests/test_zabbix_agent.py: a newTestActiveOnlyclass (config lines, idempotence, switching back to passive, a listener count of its own, settings checks), plusTestZabbixAgentMixin::test_an_active_only_agent_opens_no_port.pytest tests/test_zabbix_agent.py tests/test_fix_templates.pypasses (139 tests). ruff and mypy are clean.CHANGELOG has an entry under Unreleased and README.md is updated. There is no version bump.
NetOrk/netork#2683
Merged as part of the release PR #130 (4.42.0, merge commit
fb927e7, tag v4.42.0).Pull request closed