mirror of
https://github.com/safedep/pmg.git
synced 2026-08-03 07:24:09 +02:00
fix: Landlock probe environment and autofallback to BW
This commit is contained in:
@@ -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
|
||||
}
|
||||
@@ -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 }
|
||||
Reference in New Issue
Block a user