pub const DEFAULT_AGENT_IMAGE: &str = "ghcr.io/n0xmare/clawbox-agent:latest";
pub const DEFAULT_MEMORY_MB: u64 = 512;
pub const DEFAULT_CPU_SHARES: u32 = 1024;
pub const DEFAULT_TIMEOUT_MS: u64 = 120_000;
pub const DEFAULT_ALLOWED_IMAGE_PREFIXES: &[&str] =
&["ghcr.io/n0xmare/", "alpine:", "ubuntu:", "debian:"];
#[derive(Debug, Clone)]
#[non_exhaustive]
#[must_use]
pub struct ContainerSecurityConfig {
pub user: String,
pub readonly_rootfs: bool,
pub drop_all_caps: bool,
pub no_new_privileges: bool,
pub tmpfs_mounts: Vec<String>,
pub allowed_image_prefixes: Vec<String>,
}
impl ContainerSecurityConfig {
pub fn new() -> Self {
Self::default()
}
}
impl Default for ContainerSecurityConfig {
fn default() -> Self {
Self {
user: "1000:1000".into(),
readonly_rootfs: true,
drop_all_caps: true,
no_new_privileges: true,
tmpfs_mounts: vec!["/tmp:rw,noexec,size=256m".into()],
allowed_image_prefixes: DEFAULT_ALLOWED_IMAGE_PREFIXES
.iter()
.map(|s| s.to_string())
.collect(),
}
}
}