mirror of
https://github.com/amidaware/tacticalrmm.git
synced 2026-04-26 06:55:52 +03:00
[GH-ISSUE #2269] Policy Agent Exclusions Not Honored When Policy Applied to Site #3352
Labels
No labels
In Process
bug
bug
dev-triage
documentation
duplicate
enhancement
fixed
good first issue
help wanted
integration
invalid
pull-request
question
requires agent update
security
ui tweak
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/tacticalrmm#3352
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @guilhermemilekalfatransportes on GitHub (Jul 30, 2025).
Original GitHub issue: https://github.com/amidaware/tacticalrmm/issues/2269
Server Info (please complete the following information):
- OS: Ubuntu 24.04.2 LTS
- Browser: Microsoft Edge Version 138.0.3351.109 (Official build) (64-bit)
- RMM Version (as shown in top left of web UI): v1.2.0
Installation Method:
- [x] Standard
- [ ] Standard with
--insecureflag at install- [ ] Docker
Agent Info (please complete the following information):
Describe the bug
Policy-level agent exclusions are not honored when the policy is applied directly to a Site, causing the policy's tasks/checks to execute on agents that are explicitly marked as excluded within that policy.
To Reproduce
Expected behavior
When an agent is listed in the "Excluded Agents" for a policy, that agent should not receive or execute any tasks/checks from that policy, regardless of whether the policy is applied to "All Agents", individual agents, Clients, or Sites that the agent may belong to. The exclusion should take precedence over broader inclusions.
Screenshots
Additional context
Through code analysis, this behavior appears to be related to the logic in
automation/models.pywithin thePolicymodel, specifically therelated_agentsmethod.When a policy is related to a Site (via
self.workstation_sitesorself.server_sites), therelated_agentsmethod generates the list of target agents. TheAgent.objects.filtercalls within these branches (e.g., those usingsite_id__inorsite__client__in) do not explicitly exclude agents based onexcluded_agents_idswithin that specific query chain. Theexclude(id__in=excluded_agents_ids)logic seems primarily applied only when agents are directly associated with the policy (self.agents) or when evaluating "Default Server/Workstation Policies."This suggests that the current implementation treats Site-level policy application as a strong inclusion that bypasses agent-specific policy exclusions. This design makes granular exclusions difficult when policies are applied broadly to organizational units (Sites/Clients).
Workaround implemented:
To achieve the desired exclusion, we had to restructure the organizational hierarchy. We created a separate Site (e.g., "01 - CDR - Caçador/SC (Matriz - Gerência)") for the agents that needed to be excluded. The policy was then removed from the original broader Site and reapplied only to the original Site (now containing only the non-manager workstations). This effectively excludes agents by explicit inclusion/exclusion of Sites, rather than relying on policy-level agent exclusions.
@wh1te909 commented on GitHub (Aug 26, 2025):
thanks for the detailed report, we've just pushed a fix for this and it will be in the next release
@wh1te909 commented on GitHub (Oct 15, 2025):
released in v1.3.0