Documentation
¶
Index ¶
- Constants
- Variables
- type BtrfsLayerData
- type FileAccessCtrl
- type FileAccessProbeData
- type FileNotificationCtr
- func (fsn *FileNotificationCtr) AddContainer(id, cPath, role string, pid int) (bool, map[string]*fileInfo)
- func (fsn *FileNotificationCtr) Close()
- func (fsn *FileNotificationCtr) GetUpperFileInfo(id, file string) (*fileInfo, bool)
- func (fsn *FileNotificationCtr) IsNotExistingImageFile(id, file string) (*fileInfo, bool)
- func (fsn *FileNotificationCtr) RemoveContainer(id, cPath string) bool
- type Probe
- func (p *Probe) BuildProcessFamilyGroups(id string, rootPid int, bSandboxPod, bPrivileged bool, healthCheck []string)
- func (p *Probe) CheckDNSTunneling(ids []string, clientPort share.CLUSProtoPort, locIp, remIp net.IP, ...) bool
- func (p *Probe) Close()
- func (p *Probe) GetContainerAppPorts(id string) (utils.Set, map[share.CLUSProtoPort]*share.CLUSApp)
- func (p *Probe) GetContainerMap() []*share.CLUSProbeContainer
- func (p *Probe) GetContainerProcHistory(id string) []*share.CLUSProcess
- func (p *Probe) GetContainerProcs(id string) []*share.CLUSProcess
- func (p *Probe) GetHostModeSessions(ids utils.Set) []*share.CLUSSession
- func (p *Probe) GetProbeSummary() *share.CLUSProbeSummary
- func (p *Probe) GetProcessInfo(pid int) (*procInternal, bool)
- func (p *Probe) GetProcessMap() []*share.CLUSProbeProcess
- func (p *Probe) HandleAnchorModeChange(bAdd bool, id, cPath string, rootPid int)
- func (p *Probe) HandleAnchorNvProtectChange(bAdd bool, id, cPath, role string, rootPid int)
- func (p *Probe) HandleProcessPolicyChange(id string, pid int, pg *share.CLUSProcessProfile, ...)
- func (p *Probe) IsAllowedShieldProcess(id, mode, svcGroup string, proc *procInternal, ...) bool
- func (p *Probe) IsConnectionMonitored() bool
- func (p *Probe) NotifyPolicyChange(containerSet utils.Set)
- func (p *Probe) PatchContainerProcess(pid int, bEval bool) bool
- func (p *Probe) ProcessFsnEvent(id string, files []string, finfo fileInfo)
- func (p *Probe) ProcessLookup(pid int) *fsmon.ProcInfo
- func (p *Probe) PutBeginningProcEventsBackToWork(id string) int
- func (p *Probe) RemoveProcessControl(id string)
- func (p *Probe) ReportDockerCp(id, containerName string, toContainer bool)
- func (p *Probe) SendAggregateFsMonReport(pmsg *fsmon.MonitorMessage) bool
- func (p *Probe) SendAggregateProbeReport(pmsg *ProbeMessage, bExtOp bool) bool
- func (p *Probe) SetFileMonitor(fm *fsmon.FileWatch)
- func (p *Probe) SetMonitorTrace(bEnable bool, logLevel string)
- func (p *Probe) SetNvProtect(bDisable bool)
- func (p *Probe) StartMonitorConnection()
- func (p *Probe) StartMonitorHostInterface(hid string, pid int)
- func (p *Probe) StartMonitorInterface(id string, pid int, timeout time.Duration)
- func (p *Probe) StopMonitorInterface(id string)
- func (p *Probe) UpdateFromAllowRule(id, path string)
- type ProbeConfig
- type ProbeEscalation
- type ProbeMessage
- type ProbeProcess
Constants ¶
View Source
const ( RTMGRP_LINK uint32 = 0x1 RTMGRP_IPV4_IFADDR uint32 = 0x10 RTMGRP_IPV6_IFADDR uint32 = 0x100 )
View Source
const ( PROBE_PROCESS_CHANGE = iota PROBE_CONTAINER_START PROBE_CONTAINER_STOP PROBE_CONTAINER_NEW_IP PROBE_REPORT_ESCALATION PROBE_REPORT_SUSPICIOUS PROBE_REPORT_TUNNEL PROBE_REPORT_FILE_MODIFIED PROBE_REPORT_PROCESS_VIOLATION PROBE_REPORT_PROCESS_DENIED PROBE_HOST_NEW_IP // obsolete )
View Source
const INET_DIAG_INFO = 2
Variables ¶
View Source
var ProbeMsgName = []string{ PROBE_PROCESS_CHANGE: "process_change", PROBE_CONTAINER_START: "container_start", PROBE_CONTAINER_STOP: "container_stop", PROBE_CONTAINER_NEW_IP: "container_new_ip", PROBE_REPORT_ESCALATION: "escalation", PROBE_REPORT_SUSPICIOUS: "suspicious_process", PROBE_REPORT_TUNNEL: "tunnel_connection", PROBE_REPORT_FILE_MODIFIED: "file_modified", PROBE_REPORT_PROCESS_VIOLATION: "process_profile_violation", PROBE_REPORT_PROCESS_DENIED: "process_profile_denied", PROBE_HOST_NEW_IP: "host_new_ip", }
View Source
var ProcFilters = []bpf.Instruction{ bpf.LoadAbsolute{Off: posProcEventWhat, Size: 4}, bpf.JumpIf{Val: utils.Htonl(netlink.PROC_EVENT_FORK), SkipFalse: 7}, bpf.LoadAbsolute{Off: posForkChildPid, Size: 4}, bpf.StoreScratch{Src: bpf.RegA, N: 0}, bpf.LoadScratch{Dst: bpf.RegX, N: 0}, bpf.LoadAbsolute{Off: posForkChildTgid, Size: 4}, bpf.JumpIfX{SkipFalse: 1}, bpf.RetConstant{Val: 0xffffffff}, bpf.RetConstant{Val: 0x0}, bpf.JumpIf{Val: utils.Htonl(netlink.PROC_EVENT_EXIT), SkipFalse: 7}, bpf.LoadAbsolute{Off: posExitProcessPid, Size: 4}, bpf.StoreScratch{Src: bpf.RegA, N: 0}, bpf.LoadScratch{Dst: bpf.RegX, N: 0}, bpf.LoadAbsolute{Off: posExitProcessTgid, Size: 4}, bpf.JumpIfX{SkipFalse: 1}, bpf.RetConstant{Val: 0xffffffff}, bpf.RetConstant{Val: 0x0}, bpf.RetConstant{Val: 0xfffffff}, }
berkeley packet filter (BPF) Filter out unused fork/exit thread's packets
Functions ¶
This section is empty.
Types ¶
type BtrfsLayerData ¶
type BtrfsLayerData struct {
ID string `json:"id"`
Parent string `json:"parent"`
Names []string `json:"names"`
Created time.Time `json:"created"`
}
/////////////////////
type FileAccessCtrl ¶
type FileAccessCtrl struct {
// contains filtered or unexported fields
}
global control data
func (*FileAccessCtrl) AddContainerControlByPolicyOrder ¶
func (fa *FileAccessCtrl) AddContainerControlByPolicyOrder(id, setting, svcGroup string, rootpid int, ppe_list []*share.CLUSProcessProfileEntry) bool
///
func (*FileAccessCtrl) GetProbeData ¶
func (fa *FileAccessCtrl) GetProbeData() *FileAccessProbeData
///
func (*FileAccessCtrl) RemoveContainerControl ¶
func (fa *FileAccessCtrl) RemoveContainerControl(id string) bool
type FileAccessProbeData ¶
type FileAccessProbeData struct {
// contains filtered or unexported fields
}
type FileNotificationCtr ¶
type FileNotificationCtr struct {
// contains filtered or unexported fields
}
global control data
func NewFsnCenter ¶
func NewFsnCenter(p *Probe, rtStorageDriver string) (*FileNotificationCtr, bool)
//////////
func (*FileNotificationCtr) AddContainer ¶
func (fsn *FileNotificationCtr) AddContainer(id, cPath, role string, pid int) (bool, map[string]*fileInfo)
func (*FileNotificationCtr) Close ¶
func (fsn *FileNotificationCtr) Close()
func (*FileNotificationCtr) GetUpperFileInfo ¶
func (fsn *FileNotificationCtr) GetUpperFileInfo(id, file string) (*fileInfo, bool)
must be valid as a new file
func (*FileNotificationCtr) IsNotExistingImageFile ¶
func (fsn *FileNotificationCtr) IsNotExistingImageFile(id, file string) (*fileInfo, bool)
func (*FileNotificationCtr) RemoveContainer ¶
func (fsn *FileNotificationCtr) RemoveContainer(id, cPath string) bool
type Probe ¶
type Probe struct {
FaEndChan chan bool
IsNvProtectAlerted bool
// contains filtered or unexported fields
}
func (*Probe) BuildProcessFamilyGroups ¶
func (*Probe) CheckDNSTunneling ¶
func (*Probe) GetContainerAppPorts ¶
get a container's listen ports and application map
func (*Probe) GetContainerMap ¶
func (p *Probe) GetContainerMap() []*share.CLUSProbeContainer
func (*Probe) GetContainerProcHistory ¶
func (p *Probe) GetContainerProcHistory(id string) []*share.CLUSProcess
func (*Probe) GetContainerProcs ¶
func (p *Probe) GetContainerProcs(id string) []*share.CLUSProcess
func (*Probe) GetHostModeSessions ¶
func (p *Probe) GetHostModeSessions(ids utils.Set) []*share.CLUSSession
func (*Probe) GetProbeSummary ¶
func (p *Probe) GetProbeSummary() *share.CLUSProbeSummary
func (*Probe) GetProcessInfo ¶
func (*Probe) GetProcessMap ¶
func (p *Probe) GetProcessMap() []*share.CLUSProbeProcess
func (*Probe) HandleAnchorModeChange ¶
func (*Probe) HandleAnchorNvProtectChange ¶
func (*Probe) HandleProcessPolicyChange ¶
func (p *Probe) HandleProcessPolicyChange(id string, pid int, pg *share.CLUSProcessProfile, bAddContainer, bBlocking bool)
////
func (*Probe) IsAllowedShieldProcess ¶
func (*Probe) IsConnectionMonitored ¶
func (*Probe) NotifyPolicyChange ¶
func (*Probe) PatchContainerProcess ¶
PatchContainerProcess() Fixed the missing process table, caused by the netlink recv errors, no process record is available. Current patch is only for important init-process of a container
func (*Probe) ProcessFsnEvent ¶
func (*Probe) PutBeginningProcEventsBackToWork ¶
Patch for newly created conatiners, not for host
func (*Probe) ReportDockerCp ¶
func (*Probe) SendAggregateFsMonReport ¶
func (p *Probe) SendAggregateFsMonReport(pmsg *fsmon.MonitorMessage) bool
///
func (*Probe) SendAggregateProbeReport ¶
func (p *Probe) SendAggregateProbeReport(pmsg *ProbeMessage, bExtOp bool) bool
func (*Probe) SetFileMonitor ¶
func (*Probe) SetMonitorTrace ¶
func (*Probe) SetNvProtect ¶
func (*Probe) StartMonitorConnection ¶
func (p *Probe) StartMonitorConnection()
func (*Probe) StartMonitorHostInterface ¶
obsolete
func (*Probe) StartMonitorInterface ¶
func (*Probe) StopMonitorInterface ¶
func (*Probe) UpdateFromAllowRule ¶
type ProbeConfig ¶
type ProbeConfig struct {
ProfileEnable bool
Pid int
PidMode string
DpTaskCallback dp.DPTaskCallback
NotifyTaskChan chan *ProbeMessage
NotifyFsTaskChan chan *fsmon.MonitorMessage
PolicyLookupFunc func(conn *dp.Connection) (uint32, uint8, bool)
ProcPolicyLookupFunc func(id, riskType, pname, ppath string, pid, pgid, shellCmd int, proc *share.CLUSProcessProfileEntry) (string, string, string, string, bool, error)
IsK8sGroupWithProbe func(svcGroup string) bool
ReportLearnProc func(svcGroup string, proc *share.CLUSProcessProfileEntry)
IsNeuvectorContainer func(id string) (string, bool)
ContainerInContainer bool
GetContainerPid func(id string) int
GetAllContainerList func() utils.Set
RerunKubeBench func(string, string)
GetEstimateProcGroup func(id, name, path string) (string, string)
GetServiceGroupName func(id string) (string, bool, bool)
CapKubeBench bool
FAEndChan chan bool
EnableTrace bool
DeferContStartRpt bool
KubePlatform bool
KubeFlavor string
WalkHelper *workerlet.Tasker
}
type ProbeEscalation ¶
type ProbeMessage ¶
type ProbeMessage struct {
Type int
Count int
StartAt time.Time
Connections []*dp.Connection
ContainerIDs utils.Set
Escalation *ProbeEscalation
Process *ProbeProcess
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.