mirror of
https://github.com/safedep/pmg.git
synced 2026-08-03 07:24:09 +02:00
* feat: add sandbox DX commands * fix: Linter errors * fix: Sandbox deny log parsing * fix: Sandbox docs * refactor: Maintain SSOT across pkg dependencies * fix: Linter errors
44 lines
1.1 KiB
Go
44 lines
1.1 KiB
Go
//go:build linux
|
|
// +build linux
|
|
|
|
package platform
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/safedep/pmg/sandbox"
|
|
)
|
|
|
|
type linuxCanaryProbe struct {
|
|
name string
|
|
driver sandbox.DriverName
|
|
factory canarySandboxFactory
|
|
cmdFactory canaryCommandFactory
|
|
}
|
|
|
|
// NewBwrapCanaryProbe runs the per-driver Bubblewrap smoke test.
|
|
func NewBwrapCanaryProbe() sandbox.Probe {
|
|
return &linuxCanaryProbe{
|
|
name: sandbox.ProbeBwrapCanary,
|
|
driver: sandbox.DriverBubblewrap,
|
|
factory: func() (sandbox.Sandbox, error) { return NewBubblewrapSandbox() },
|
|
cmdFactory: defaultCanaryCommand,
|
|
}
|
|
}
|
|
|
|
// NewLandlockCanaryProbe runs the per-driver Landlock smoke test.
|
|
func NewLandlockCanaryProbe() sandbox.Probe {
|
|
return &linuxCanaryProbe{
|
|
name: sandbox.ProbeLandlockCanary,
|
|
driver: sandbox.DriverLandlock,
|
|
factory: func() (sandbox.Sandbox, error) { return NewLandlockSandbox() },
|
|
cmdFactory: defaultCanaryCommand,
|
|
}
|
|
}
|
|
|
|
func (p *linuxCanaryProbe) Name() string { return p.name }
|
|
|
|
func (p *linuxCanaryProbe) Run(ctx context.Context) sandbox.ProbeResult {
|
|
return runCanary(ctx, p.name, p.driver, p.factory, p.cmdFactory)
|
|
}
|