pub struct SecurityConfig {
pub seccomp: SeccompMode,
pub no_new_privileges: bool,
pub cap_add: Vec<String>,
pub cap_drop: Vec<String>,
pub privileged: bool,
}Expand description
Parsed security configuration for guest process enforcement.
Fields§
§seccomp: SeccompModeSeccomp filter mode.
no_new_privileges: boolSet PR_SET_NO_NEW_PRIVS before exec.
cap_add: Vec<String>Linux capabilities to add.
cap_drop: Vec<String>Linux capabilities to drop.
privileged: boolPrivileged mode (disables all restrictions).
Implementations§
Source§impl SecurityConfig
impl SecurityConfig
Sourcepub fn validate(&self) -> Result<(), String>
pub fn validate(&self) -> Result<(), String>
Validate that the security configuration can be enforced at runtime.
Returns an error if custom seccomp profiles are specified, since they are not yet supported and would silently fall through to no filtering.
Sourcepub fn from_options(
security_opt: &[String],
cap_add: &[String],
cap_drop: &[String],
privileged: bool,
) -> Self
pub fn from_options( security_opt: &[String], cap_add: &[String], cap_drop: &[String], privileged: bool, ) -> Self
Parse guest-enforceable security config from CLI-style options.
Backend compatibility is validated by crate::resolve_execution
before the MicroVM specification is built. This parser only translates
options that guest-init can enforce.
Accepts the same format as Docker:
seccomp=default— apply the built-in profileseccomp=unconfined— disable seccompseccomp=<path>— custom profileno-new-privilegesorno-new-privileges=true— enable (default)no-new-privileges=false— disable
Sourcepub fn to_env_vars(&self) -> Vec<(String, String)>
pub fn to_env_vars(&self) -> Vec<(String, String)>
Encode as environment variables for passing to guest-init.
Returns a list of (key, value) pairs with A3S_SEC_* prefix.
Sourcepub fn from_env_vars() -> Self
pub fn from_env_vars() -> Self
Parse from guest-init environment variables.
Trait Implementations§
Source§impl Clone for SecurityConfig
impl Clone for SecurityConfig
Source§fn clone(&self) -> SecurityConfig
fn clone(&self) -> SecurityConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more