Documentation
¶
Overview ¶
Package lsmguard refuses execs in the kernel with a BPF LSM program on bprm_check_security, for hosts whose kernel runs the bpf LSM (lsm=...,bpf) and where the sensor runs with CAP_BPF and CAP_SYS_ADMIN.
The program matches a file by identity (inode and device), not by path, so a renamed or hard-linked copy of a blocked binary is refused too. The sensor fills its map from the exact program paths its block-mode rules name, resolved on the host filesystem. Off unless --bpf-lsm is set.
Limits, stated plainly: the identity of a file on an overlay filesystem or a btrfs subvolume can differ between stat and the kernel's view, so a path there may not match; a replaced file is a new inode and is only covered after the next sync. Not yet run on a live kernel: the object is verified to load as a spec, not by the kernel's verifier.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Spec ¶
func Spec() (*ebpf.CollectionSpec, error)
Spec reads the embedded program without loading it, so it can be checked without privileges.
Types ¶
type Guard ¶
type Guard struct {
// contains filtered or unexported fields
}
Guard is the loaded and attached program.
func Load ¶
Load loads and attaches the program. It needs the bpf LSM enabled in the kernel and CAP_BPF with CAP_SYS_ADMIN (or root).
func (*Guard) Close ¶
func (g *Guard) Close()
Close detaches the program; execs are no longer checked.
func (*Guard) SetEnforce ¶
SetEnforce turns refusing on or off. Off, a match is reported and allowed.