Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions daemon/rule/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ const (
OpProcessID = Operand("process.id")
OpProcessPath = Operand("process.path")
OpProcessParentPath = Operand("process.parent.path")
OpProcessParentCmd = Operand("process.parent.command")
OpProcessCmd = Operand("process.command")
OpProcessEnvPrefix = Operand("process.env.")
OpProcessEnvPrefixLen = 12
Expand Down Expand Up @@ -336,6 +337,23 @@ func (o *Operator) Match(con *conman.Connection, hasChecksums bool) bool {
return o.listMatch(con, hasChecksums)
} else if o.Operand == OpProcessPath {
return o.cb(con.Process.Path)
} else if o.Operand == OpProcessParentPath {
p := con.Process
for pp := p.Parent; pp != nil; pp = pp.Parent {
if o.cb(pp.Path) {
return true
}
}
return false
} else if o.Operand == OpProcessParentCmd {
p := con.Process
for pp := p.Parent; pp != nil; pp = pp.Parent {
pp.ReadCmdline()
if o.cb(strings.Join(pp.Args, " ")) {
return true
}
}
return false
} else if o.Operand == OpProcessCmd {
return o.cb(strings.Join(con.Process.Args, " "))
} else if o.Operand == OpDstHost {
Expand Down