Enhance Linux sandbox security features with Landlock, seccomp, and eBPF monitoring

This commit is contained in:
JY Tan
2025-12-25 17:33:55 -08:00
parent a8158a39b3
commit 08ed28f88f
20 changed files with 2820 additions and 64 deletions

View File

@@ -0,0 +1,45 @@
//go:build !linux
// Package sandbox provides sandboxing functionality for macOS and Linux.
package sandbox
// LinuxFeatures describes available Linux sandboxing features.
// This is a stub for non-Linux platforms.
type LinuxFeatures struct {
HasBwrap bool
HasSocat bool
HasSeccomp bool
SeccompLogLevel int
HasLandlock bool
LandlockABI int
HasEBPF bool
HasCapBPF bool
HasCapRoot bool
KernelMajor int
KernelMinor int
}
// DetectLinuxFeatures returns empty features on non-Linux platforms.
func DetectLinuxFeatures() *LinuxFeatures {
return &LinuxFeatures{}
}
// Summary returns an empty string on non-Linux platforms.
func (f *LinuxFeatures) Summary() string {
return "not linux"
}
// CanMonitorViolations returns false on non-Linux platforms.
func (f *LinuxFeatures) CanMonitorViolations() bool {
return false
}
// CanUseLandlock returns false on non-Linux platforms.
func (f *LinuxFeatures) CanUseLandlock() bool {
return false
}
// MinimumViable returns false on non-Linux platforms.
func (f *LinuxFeatures) MinimumViable() bool {
return false
}