Bind Windows script contexts to the installed signed helper

This commit is contained in:
2026-11-18 11:58:55 +01:00
parent ab20cb0778
commit c692316abe
10 changed files with 345 additions and 14 deletions
+22 -3
View File
@@ -1409,6 +1409,11 @@ impl Agent {
Ok(())
}
fn supported_job(&self, job: &rmm_domain::jobs::JobPayload) -> bool {
if self.config.localservice_time_policy.is_some()
&& !matches!(job.action, rmm_domain::jobs::Action::RunScript { .. })
{
return false;
}
if self.config.localservice_time_policy.is_some() && job.execution_identity != "agent_service"
&& !(job.execution_identity == "system"
&& (self.config.windows_update_helper && job.action.windows_update_or_identity_probe()
@@ -1564,7 +1569,7 @@ impl Agent {
&& native::require_local_service().is_ok()
{
caps.push("rmm.sync.v1".into());
if !self.config.windows_echo_probe_only {
if !self.config.windows_echo_probe_only && self.config.localservice_time_policy.is_none() {
caps.push("refresh_inventory".into());
}
if rmm_agent_windows::actions::powershell().is_ok() {
@@ -1579,8 +1584,22 @@ impl Agent {
if !self.config.windows_echo_probe_only
&& let Some(helper) = &self.helper
{
caps.extend(helper.qualified_capabilities());
if helper.update_observer_configured()
let enrolled = self.config.localservice_time_policy.is_some();
if enrolled {
if self.config.managed_script_helper || self.config.windows_update_helper {
caps.extend(helper.qualified_capabilities().into_iter().filter(|cap| {
matches!(cap.as_str(), "helper.system.v1" | "system:run_script"
| rmm_domain::jobs::FULL_MAINTENANCE_CAPABILITY
| rmm_domain::jobs::WINDOWS_UPDATE_LONG_CAPABILITY)
|| cap.starts_with("helper.binary.sha256:")
|| cap.starts_with("helper.policy.sha256:")
|| cap.starts_with("script.helper.release:")
}));
}
} else {
caps.extend(helper.qualified_capabilities());
}
if !enrolled && helper.update_observer_configured()
&& self.update_observer.cached().is_some_and(|r|r.observation.predecessor.as_ref().is_some_and(|p|p.helper_sha256==helper.helper_binary_hash())) {
for cap in self.update_observer.capabilities(){if !caps.contains(&cap){caps.push(cap);}}
}