fix: Landlock probe environment and autofallback to BW

This commit is contained in:
abhisek
2026-05-11 21:29:11 +05:30
parent 00fd6d2a9c
commit 81c161dba3
9 changed files with 265 additions and 12 deletions
+24
View File
@@ -0,0 +1,24 @@
//go:build linux
package landlock
import (
"github.com/safedep/pmg/sandbox/platform"
"github.com/spf13/cobra"
)
// NewLandlockProbeCommand returns the hidden Cobra command used to detect
// whether the Landlock shim can install seccomp without NO_NEW_PRIVS.
func NewLandlockProbeCommand() *cobra.Command {
cmd := &cobra.Command{
Use: "__landlock_probe",
Hidden: true,
SilenceUsage: true,
PersistentPreRun: func(cmd *cobra.Command, args []string) {
},
RunE: func(cmd *cobra.Command, args []string) error {
return platform.RunLandlockProbe()
},
}
return cmd
}
+8
View File
@@ -0,0 +1,8 @@
//go:build !linux
package landlock
import "github.com/spf13/cobra"
// NewLandlockProbeCommand returns nil on non-Linux platforms.
func NewLandlockProbeCommand() *cobra.Command { return nil }