Enable per-order privileged scripts on managed devices

This commit is contained in:
2026-11-18 00:02:17 +01:00
parent 2aa460e337
commit ea87d8141c
20 changed files with 864 additions and 157 deletions
+9 -3
View File
@@ -40,6 +40,8 @@ struct Config {
localservice_time_policy: Option<PathBuf>,
#[serde(default)]
windows_update_helper: bool,
#[serde(default)]
managed_script_helper: bool,
// Explicit protected opt-in only; this flag never qualifies a clock or pins.
#[serde(default)]
enable_jobs: bool,
@@ -99,7 +101,8 @@ impl Config {
fn read(path: &Path) -> Result<Self> {
let raw = protected_read(path, 32768)?;
let config: Self = serde_json::from_slice(&raw)?;
if config.windows_update_helper {
ensure!(!(config.windows_update_helper && config.managed_script_helper), "AMBIGUOUS_ENROLLED_HELPER");
if config.windows_update_helper || config.managed_script_helper {
ensure!(config.localservice_time_policy.is_some() && cfg!(feature = "system-helper"), "ENROLLED_WINDOWS_UPDATE_HELPER_REQUIRED");
}
if let Some(policy) = &config.localservice_time_policy {
@@ -817,7 +820,8 @@ impl Agent {
&identity.certificate_pem,
&identity.private_key_pem,
)?;
let helper = if self.config.localservice_time_policy.is_some() && !self.config.windows_update_helper {
let helper = if self.config.localservice_time_policy.is_some()
&& !self.config.windows_update_helper && !self.config.managed_script_helper {
None
} else { rmm_agent_windows::helper_runtime::Client::discover(
&self.identity.agent_id,
@@ -1406,7 +1410,9 @@ impl Agent {
}
fn supported_job(&self, job: &rmm_domain::jobs::JobPayload) -> bool {
if self.config.localservice_time_policy.is_some() && job.execution_identity != "agent_service"
&& !(self.config.windows_update_helper && job.execution_identity == "system" && job.action.windows_update_or_identity_probe()) {
&& !(job.execution_identity == "system"
&& (self.config.windows_update_helper && job.action.windows_update_or_identity_probe()
|| self.config.managed_script_helper && job.action.full_maintenance())) {
return false;
}
if self.config.windows_echo_probe_only