Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 41 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions crates/openshell-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1675,6 +1675,12 @@ enum SandboxCommands {
#[arg(long, value_parser = ["manual", "auto"], default_value = "manual")]
approval_mode: String,

/// Run the sandbox workload as true guest root inside a hardened VM
/// boundary sealed by boot-once BPF LSM. Requires a compute driver that
/// supports privileged mode.
#[arg(long, visible_alias = "priv")]
privileged: bool,

/// Output format.
#[arg(short = 'o', long = "output", value_enum, default_value_t = OutputFormat::Table, conflicts_with_all = ["editor", "no_keep", "forward"])]
output: OutputFormat,
Expand Down Expand Up @@ -3586,6 +3592,7 @@ async fn run_async() -> Result<()> {
env_from,
no_credential_warnings,
approval_mode,
privileged,
output,
command,
} => {
Expand Down Expand Up @@ -3674,6 +3681,7 @@ async fn run_async() -> Result<()> {
suppress_credential_warnings: no_credential_warnings,
restart_policy: &restart_policy,
provision_timeout_secs: timeout.map(std::num::NonZeroU32::get),
privileged,
},
&cli.workspace,
&tls,
Expand Down
5 changes: 5 additions & 0 deletions crates/openshell-cli/src/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,7 @@ async fn finalize_sandbox_create_session(
/// on the function signature, following the `provider_refresh_config(server, input, tls)`
/// precedent. This struct captures sandbox-specific options.
#[derive(Debug)]
#[allow(clippy::struct_excessive_bools)]
pub struct SandboxCreateConfig<'a> {
pub name: Option<&'a str>,
pub template: Option<&'a str>,
Expand Down Expand Up @@ -463,6 +464,7 @@ pub struct SandboxCreateConfig<'a> {
pub suppress_credential_warnings: bool,
pub restart_policy: &'a str,
pub provision_timeout_secs: Option<u32>,
pub privileged: bool,
}

impl Default for SandboxCreateConfig<'_> {
Expand Down Expand Up @@ -495,6 +497,7 @@ impl Default for SandboxCreateConfig<'_> {
suppress_credential_warnings: false,
restart_policy: "never",
provision_timeout_secs: None,
privileged: false,
}
}
}
Expand Down Expand Up @@ -535,6 +538,7 @@ pub async fn sandbox_create(
suppress_credential_warnings,
restart_policy,
provision_timeout_secs,
privileged,
} = config;

if editor.is_some() && !command.is_empty() {
Expand Down Expand Up @@ -699,6 +703,7 @@ pub async fn sandbox_create(
"always" => SandboxRestartPolicy::Always as i32,
value => return Err(miette::miette!("invalid restart policy '{value}'")),
},
privileged,
..SandboxSpec::default()
}),
name: name.unwrap_or_default().to_string(),
Expand Down
2 changes: 2 additions & 0 deletions crates/openshell-driver-docker/src/isolation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ impl DockerBoundarySpec {
workload_identity: self.workload_identity.clone(),
provisioning_evidence: provisioning_evidence.clone(),
child_env: self.child_env,
privileged: None,
},
runtime_descriptor: SandboxRuntimeDescriptor {
boundary_id: self.boundary_id,
Expand All @@ -131,6 +132,7 @@ impl DockerBoundarySpec {
host_gateway_ip: self.host_gateway_ip,
resource_claims,
provisioning_evidence,
privileged: None,
},
})
}
Expand Down
6 changes: 6 additions & 0 deletions crates/openshell-driver-docker/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1132,6 +1132,7 @@ impl DockerComputeDriver {
Vec::new()
},
)),
supports_privileged: false,
}
}

Expand All @@ -1156,6 +1157,11 @@ impl DockerComputeDriver {
.spec
.as_ref()
.ok_or_else(|| Status::invalid_argument("sandbox.spec is required"))?;
if spec.privileged {
return Err(Status::failed_precondition(
"privileged sandboxes are not supported by the docker compute driver",
));
}
let template = spec
.template
.as_ref()
Expand Down
6 changes: 6 additions & 0 deletions crates/openshell-driver-kubernetes/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,11 @@ pub struct KubernetesComputeConfig {
/// by the gateway administrator; sandbox creators cannot change it, and
/// it never inherits the workload class. Empty (default) = omit the field.
pub supervisor_runtime_class_name: String,
/// Kubernetes `runtimeClassName` used for `--privileged` (true guest root +
/// boot-once BPF LSM) sandbox pods, such as a hardened Kata Containers class.
/// Empty (default) disables privileged sandboxes on Kubernetes.
#[serde(default)]
pub privileged_runtime_class_name: String,
/// Pod annotation keys that sandbox templates may set. Each entry is an
/// exact key (`example.com/team`) or a prefix wildcard (`example.com/*`).
/// Empty (default) rejects every caller-supplied pod annotation.
Expand Down Expand Up @@ -552,6 +557,7 @@ impl Default for KubernetesComputeConfig {
workspace_storage_class: String::new(),
default_runtime_class_name: String::new(),
supervisor_runtime_class_name: String::new(),
privileged_runtime_class_name: String::new(),
allowed_pod_annotations: Vec::new(),
allowed_pod_labels: Vec::new(),
sa_token_ttl_secs: 3600,
Expand Down
Loading
Loading