runtime-sandbox-runc
暂无简介
- License 许可
- Apache-2.0
- 最近更新
- 2026-11-14
- Stars
- ★ 13
- Forks
- 2
03 SKILL.md 正文
/runtime-sandbox-runc
When to Use
- Agent needs hard process isolation (separate PID/net/mount namespaces)
- Enforcing CPU/memory caps on untrusted subprocesses
- Building OCI-compatible container runtimes or wrappers
- Auditing how containers escape kernel-level boundaries
Do NOT use for
- Simple shell isolation (use bubblewrap or sandbox-exec.sh instead)
- Language-level sandboxing (JS
vm, Pythonrestricted exec)
OCI Bundle Structure
/tmp/oci-bundle/
├── config.json # runtime spec
└── rootfs/ # pivoted root filesystem
├── bin/
├── lib/
└── ...
# Minimal config.json for a rootless sandbox
cat > /tmp/oci-bundle/config.json <<'EOF'
{
"ociVersion": "1.0.2",
"process": {
"terminal": false,
"user": { "uid": 1000, "gid": 1000 },
"args": ["/bin/sh", "-c", "echo sandbox-ok"],
"env": ["PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"],
"cwd": "/",
"capabilities": {
"bounding": [],
"effective": [],
"permitted": []
},
"noNewPrivileges": true
},
"root": { "path": "rootfs", "readonly": true },
"hostname": "sandbox",
"mounts": [
{ "destination": "/proc", "type": "proc", "source": "proc" },
{ "destination": "/tmp", "type": "tmpfs", "source": "tmpfs",
"options": ["nosuid","nodev","size=64m"] }
],
"linux": {
"namespaces": [
{ "type": "pid" },
{ "type": "network" },
{ "type": "mount" },
{ "type": "uts" },
{ "type": "ipc" },
{ "type": "user",
"uidMappings": [{"containerID":1000,"hostID":100000,"size":65536}],
"gidMappings": [{"containerID":1000,"hostID":100000,"size":65536}]
}
],
"resources": {
"memory": { "limit": 134217728 },
"cpu": { "shares": 512, "quota": 50000, "period": 100000 }
},
"maskedPaths": ["/proc/kcore","/proc/keys","/proc/latency_stats"],
"readonlyPaths": ["/proc/asound","/proc/bus","/proc/fs","/proc/irq","/proc/sys","/proc/sysrq-trigger"]
}
}
EOF
runc Lifecycle
# Create + start (two-phase allows pre-start hooks)
runc create --bundle /tmp/oci-bundle sandbox-1
runc start sandbox-1
# One-shot run
runc run --bundle /tmp/oci-bundle sandbox-$(date +%s)
# Inspect state
runc state sandbox-1 # → {"status":"running","pid":1234,...}
runc list # all containers
# Cleanup
runc kill sandbox-1 SIGTERM
runc delete sandbox-1
cgroup v2 Resource Caps (without runc)
# Create cgroup
mkdir /sys/fs/cgroup/agent-sandbox
echo "100M" > /sys/fs/cgroup/agent-sandbox/memory.max
echo "50000 100000" > /sys/fs/cgroup/agent-sandbox/cpu.max # 50% of 1 core
# Run process in cgroup
echo $$ > /sys/fs/cgroup/agent-sandbox/cgroup.procs
exec "$@" # replace shell with target process
Namespace Isolation (manual, no runc)
# Unshare pid + mount + network in a subshell
unshare --pid --fork --mount --net --uts \
--map-root-user \
/bin/sh -c '
mount -t proc proc /proc
hostname sandbox
exec "$@"
' -- "$TARGET_CMD"
Anti-Fake-Pass Checklist
❌ noNewPrivileges not set → SUID binaries can escalate inside container
❌ capabilities.bounding not empty → drop all caps for untrusted workloads
❌ /proc not masked → /proc/kcore leaks host memory addresses
❌ tmpfs without size limit → guest can exhaust host RAM
❌ UID mapping missing → rootless container runs as real root on host
❌ cgroup limits not set → no CPU/memory enforcement
❌ Network namespace missing → container can reach host services
❌ readonly rootfs not set → container can modify base image files
04 同仓库更多 Skills
openai--sentry--sentry
Use when the user asks to inspect Sentry issues or events, summarize recent production errors, or pull basic Sentry health data via the Sentry API; perform read-only queries with the bundled script and require `SENTRY_AUTH_TOKEN`.
ito-basket-compare
Compare Itô prediction-market baskets against a user's knowledge base, portfolio notes, financial context, watchlist, or research thesis. Use for read-only basket comparison and gap analysis without investment advice or live trading.
implementing-network-traffic-baselining
Build network traffic baselines from NetFlow/IPFIX data using Python pandas for statistical analysis, z-score anomaly detection, and hourly/daily traffic pattern profiling
detecting-evasion-techniques-in-endpoint-logs
Detects defense evasion techniques used by adversaries in endpoint logs including log tampering, timestomping, process injection, and security tool disabling. Use when investigating suspicious endpoint behavior, building detection rules for evasion tactics, or conducting threat hunting for stealthy adversary activity. Activates for requests involving evasion detection, defense evasion analysis, log tampering detection, or MITRE ATT&CK TA0005.
implementing-microsegmentation-with-guardicore
Implementing microsegmentation using Akamai Guardicore Segmentation to map application dependencies, create granular network policies, visualize east-west traffic flows, and enforce least-privilege communication between workloads across data centers and cloud.
ramdisk-tmpfs-patterns
暂无简介