Route OPNsense library and custom jobs through the standard order composer
This commit is contained in:
@@ -493,6 +493,10 @@ impl Action {
|
||||
privileged_script_profile:Some(PrivilegedScriptProfile::FullMaintenanceV1), ..}
|
||||
if interpreter=="posix_sh") && self.validate()
|
||||
}
|
||||
pub fn opnsense_service_script(&self) -> bool {
|
||||
matches!(self, Self::RunScript {interpreter,windows_execution_profile:None,privileged_script_profile:None,..}
|
||||
if interpreter=="posix_sh") && self.validate()
|
||||
}
|
||||
|
||||
/// Shared plan/revalidation/start gate. Passive inventory never implies job support.
|
||||
pub fn available_for(&self, identity: &str, capabilities: &[String]) -> bool {
|
||||
@@ -506,7 +510,8 @@ impl Action {
|
||||
let has = |cap: &str| capabilities.iter().any(|c| c == cap);
|
||||
if has("opnsense.base/1") {
|
||||
return has("run_script") && has("rmm.sync.v1") && !has("windows.base/1") && !has("linux.base/1")
|
||||
&& ((identity=="agent_service" && has("opnsense.uname/1") && self.opnsense_kernel_probe())
|
||||
&& ((identity=="agent_service" && ((has("opnsense.uname/1") && self.opnsense_kernel_probe())
|
||||
|| (has("opnsense.posix/1") && self.opnsense_service_script())))
|
||||
|| (identity=="root" && has("opnsense.root.posix/1") && has(FULL_MAINTENANCE_CAPABILITY)
|
||||
&& has("helper.root.v1") && has("root:run_script") && self.opnsense_root_script()));
|
||||
}
|
||||
|
||||
@@ -441,7 +441,7 @@ pub(crate) async fn plan_resolved(
|
||||
let row = &rows[0];
|
||||
let caps = capabilities(row.get("capabilities"))?;
|
||||
let action = target_action(&input, &caps)?;
|
||||
if input.execution_identity=="agent_service" && caps.iter().any(|s| s=="opnsense.base/1") &&
|
||||
if input.execution_identity=="agent_service" && caps.iter().any(|s| s=="opnsense.base/1") && !caps.iter().any(|s| s=="opnsense.posix/1") &&
|
||||
(input.max_runtime_seconds != 10 || input.max_output_bytes != 1024) {
|
||||
return Err(fail("UNSUPPORTED_CAPABILITY"));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user