Plan OPNsense POSIX root scripts with explicit device policy, profile and approval
This commit is contained in:
@@ -16,6 +16,8 @@ use uuid::Uuid;
|
||||
struct Policy {
|
||||
schema_version: u8,
|
||||
linux: Vec<RootScope>,
|
||||
#[serde(default)]
|
||||
opnsense: Vec<RootScope>,
|
||||
windows: Vec<SystemScope>,
|
||||
#[serde(default)]
|
||||
release_anchors: Vec<ReleaseAnchor>,
|
||||
@@ -123,6 +125,8 @@ impl Policy {
|
||||
return false;
|
||||
}
|
||||
let permits_subject = |subject: &str| match job.execution_identity.as_str() {
|
||||
"root" if caps.iter().any(|c| c=="opnsense.base/1") => self.opnsense.iter()
|
||||
.any(|scope| scope.permits(subject,job,caps,None)),
|
||||
"root" => self
|
||||
.linux
|
||||
.iter()
|
||||
@@ -206,7 +210,7 @@ pub(crate) async fn permits(
|
||||
.map_err(|_| invalid())?;
|
||||
let policy: Policy = serde_json::from_slice(&bytes).map_err(|_| invalid())?;
|
||||
if policy.schema_version != 1
|
||||
|| policy.linux.len() + policy.windows.len() > 64
|
||||
|| policy.linux.len() + policy.windows.len() + policy.opnsense.len() > 64
|
||||
|| policy.release_anchors.len() > 64
|
||||
|| policy
|
||||
.release_anchors
|
||||
|
||||
Reference in New Issue
Block a user