Skip to content

Commit

Permalink
fix(auditbeat/fim/kprobes): check correctly with "fsnotify_nameremove"
Browse files Browse the repository at this point in the history
fix(auditbeat/fim/kprobes): allow appropriate syscalls for seccomp/apparmor policies

fix(tests/system): remove check on absent key of the event
  • Loading branch information
pkoutsovasilis authored and dliappis committed May 2, 2024
1 parent 6eb9344 commit 907f94a
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func loadFsNotifyNameRemoveSymbol(s *probeManager) error {
if err != nil {
if errors.Is(err, ErrSymbolNotFound) {
s.buildChecks = append(s.buildChecks, func(spec *tkbtf.Spec) bool {
return !spec.ContainsSymbol(symbolInfo.symbolName)
return !spec.ContainsSymbol("fsnotify_nameremove")
})
return nil
}
Expand Down
31 changes: 31 additions & 0 deletions auditbeat/module/file_integrity/kprobes/seccomp_linux.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
// or more contributor license agreements. Licensed under the Elastic License;
// you may not use this file except in compliance with the Elastic License.

package kprobes

import (
"runtime"

"github.com/elastic/beats/v7/libbeat/common/seccomp"
)

func init() {
switch runtime.GOARCH {
case "amd64", "386", "arm64":
// The module/file_integrity with kprobes BE uses additional syscalls
if err := seccomp.ModifyDefaultPolicy(seccomp.AddSyscall,
"eventfd2", // required by auditbeat/tracing
"mount", // required by auditbeat/tracing
"perf_event_open", // required by auditbeat/tracing
"ppoll", // required by auditbeat/tracing
"umount2", // required by auditbeat/tracing
"truncate", // required during kprobes verification
"utime", // required during kprobes verification
"utimensat", // required during kprobes verification
"setxattr", // required during kprobes verification
); err != nil {
panic(err)
}
}
}
1 change: 0 additions & 1 deletion auditbeat/tests/system/test_file_integrity.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ def _assert_process_data(self, event, backend):
if backend != "ebpf":
return
assert event["process.entity_id"] != ""
assert event["process.executable"] == "pytest"
assert event["process.pid"] == os.getpid()
assert int(event["process.user.id"]) == os.geteuid()
assert event["process.user.name"] == pwd.getpwuid(os.geteuid()).pw_name
Expand Down

0 comments on commit 907f94a

Please sign in to comment.