Documentation ¶
Index ¶
- Constants
- func CheckSupport() error
- func Compile(path string, enforce bool) ([]unix.SockFilter, error)
- func CompileBlacklist(path string, enforce bool) ([]unix.SockFilter, error)
- func Install(bpf []unix.SockFilter) error
- func InstallBlacklist(bpf []unix.SockFilter) error
- func Load(bpf []unix.SockFilter) error
- func LockedLoad(bpf []unix.SockFilter) error
- func Prepare(path string, s SeccompSettings) ([]unix.SockFilter, error)
- func PrepareSource(source parser.Source, s SeccompSettings) ([]unix.SockFilter, error)
- type SeccompSettings
Constants ¶
const InlineMarker = "{inline}"
InlineMarker is the marker a string should start with in order to specify it should be parsed as an inline string, not a path.
Variables ¶
This section is empty.
Functions ¶
func CheckSupport ¶
func CheckSupport() error
CheckSupport checks for the required seccomp support in the kernel.
func Compile ¶
func Compile(path string, enforce bool) ([]unix.SockFilter, error)
Compile provides the compatibility interface for gosecco - it has the same signature as Compile from the go-seccomp package and should provide the same behavior. However, the modern interface is through the Prepare function
func CompileBlacklist ¶
func CompileBlacklist(path string, enforce bool) ([]unix.SockFilter, error)
CompileBlacklist provides the compatibility interface for gosecco, for blacklist mode It has the same signature as CompileBlacklist from Subgraphs go-seccomp and should provide the same behavior. However, the modern interface is through the Prepare function
func Install ¶
func Install(bpf []unix.SockFilter) error
Install will install the given policy filters into the kernel
func InstallBlacklist ¶
func InstallBlacklist(bpf []unix.SockFilter) error
InstallBlacklist makes the necessary system calls to install the Seccomp-BPF filter for the current process (all threads). Install can be called multiple times to install additional filters.
func Load ¶
func Load(bpf []unix.SockFilter) error
Load makes the seccomp system call to install the bpf filter for all threads (with tsync). Most users of this library should use Install instead of Load, since Install ensures that prctl(set_no_new_privs, 1) has been called
func LockedLoad ¶
func LockedLoad(bpf []unix.SockFilter) error
LockedLoad will run Load with the arguments given while locking the current OS thread. The existing Load can't do that, since LockOSThread is not nestable at the moment
func Prepare ¶
func Prepare(path string, s SeccompSettings) ([]unix.SockFilter, error)
Prepare will take the given path and settings, parse and compile the given data, combined with the settings - and returns the bytecode If path starts with the special marker InlineMarker, the rest of the string will be interpreted as an inline definition, not a path. Prepare is now deprecated, and PrepareSource should be used instead
func PrepareSource ¶
func PrepareSource(source parser.Source, s SeccompSettings) ([]unix.SockFilter, error)
PrepareSource will take the given source and settings, parse and compile the given data, combined with the settings - and returns the bytecode
Types ¶
type SeccompSettings ¶
type SeccompSettings struct { // ExtraDefinitions contains paths to files with extra definitions to parse // These files should only contain variables/macros - rules will not be picked // up. // If the path starts with the special marker InlineMarker, the rest of the string will // be interpreted as an inline definition, not a path. // ExtraDefinitions is softly deprecated - you should probably use parser.CombineSources instead ExtraDefinitions []string // DefaultPositiveAction is the action to take when a syscall is matched, and the expression returns a positive result - and the rule // doesn't have any specified custom actions. It can be specified as one of "trap", "kill", "allow" or "trace". It can also be a number // - this will be treated as an errno. You can also use the pre- defined classical names for errors instead of the number - such as // EACCES. DefaultPositiveAction string // DefaultNegativeAction is the action to take when a syscall is matched, the expression returns a negative result and the rule doesn't // have any custom actions defined. The action can be specified using the same syntax as described for DefaultPositiveAction. DefaultNegativeAction string // DefaultPolicyAction is the action to take when the syscall is not matched. The action can be specified using the same syntax as // described for DefaultPositiveAction. DefaultPolicyAction string // ActionOnX32 is the action to take if the syscall is a 32-bit ABI compatibility syscall. If no action is specified, this case will not // be considered. The actions are specified using the same syntax as described for DefaultPositiveAction. ActionOnX32 string // ActionOnAuditFailure is the action to take if the policy is running on the wrong architecture compared to what it was compiled // for. If not specified, it will default to "kill". The actions are specified using the same syntax as described for // DefaultPositiveAction. ActionOnAuditFailure string }
SeccompSettings contains the extra settings necessary to tweak the behavior of the compilation process