Enable per-order privileged scripts on managed devices
This commit is contained in:
@@ -107,10 +107,13 @@ impl Settings {
|
||||
})
|
||||
}
|
||||
pub(crate) fn windows_update_only(&self) -> bool {
|
||||
self.schema_version >= 3 && self.enable_effects && self.windows_update_max_runtime_seconds.is_some()
|
||||
(3..=4).contains(&self.schema_version) && self.enable_effects && self.windows_update_max_runtime_seconds.is_some()
|
||||
&& self.allowed_script_profiles.is_none() && self.allowed_services.is_empty()
|
||||
&& self.allowed_msi_recipe_sha256.is_none() && !self.allow_reboot && self.max_runtime_seconds <= 30
|
||||
}
|
||||
pub(crate) fn managed_scripts(&self) -> bool {
|
||||
self.schema_version == 5
|
||||
}
|
||||
fn permits_script(&self, job: &JobPayload) -> bool {
|
||||
self.schema_version >= 3
|
||||
&& job.execution_identity == "system"
|
||||
@@ -133,7 +136,12 @@ impl Settings {
|
||||
}
|
||||
pub fn validate(&self) -> Result<()> {
|
||||
ensure!(
|
||||
matches!(self.schema_version, 1..=4)
|
||||
matches!(self.schema_version, 1..=5)
|
||||
&& (!self.managed_scripts()
|
||||
|| (self.enable_effects && self.allowed_services.is_empty()
|
||||
&& self.allowed_msi_recipe_sha256.is_none() && !self.allow_reboot
|
||||
&& self.allowed_script_profiles.as_deref()
|
||||
== Some(&[rmm_domain::jobs::PrivilegedScriptProfile::FullMaintenanceV1])))
|
||||
&& (self.schema_version >= 2 || self.allowed_msi_recipe_sha256.is_none())
|
||||
&& (self.schema_version >= 3 || self.allowed_script_profiles.is_none())
|
||||
&& self
|
||||
@@ -891,7 +899,7 @@ impl SystemHelper {
|
||||
let pin = settings.pin()?;
|
||||
ipc::publish_self_query_rights(&settings.agent.service_sid, &settings.helper.service_sid)?;
|
||||
let (guard, db) = LedgerGuard::acquire(&settings.helper.service_sid, &settings.binding)?;
|
||||
let clock = if settings.windows_update_only() {
|
||||
let clock = if settings.windows_update_only() || settings.managed_scripts() {
|
||||
RuntimeClock::enrolled_windows_update_helper(settings.binding.clone(), settings.helper.clone())
|
||||
} else { RuntimeClock::new(rmm_time_attestation::Role::SystemHelper) }.for_generation(0);
|
||||
let boot = WindowsBoot::capture()?;
|
||||
|
||||
Reference in New Issue
Block a user