Skip to content

Commit

Permalink
Remove debugfs mount
Browse files Browse the repository at this point in the history
  • Loading branch information
yanivagman committed Mar 10, 2021
1 parent c22f59c commit f1f3c72
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 41 deletions.
5 changes: 0 additions & 5 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
#!/bin/sh

TRACEE_EBPF_EXE=${TRACEE_EBPF_EXE:="/tracee/tracee-ebpf"}
TRACEE_MOUNT_EXE=${TRACEE_MOUNT_EXE:="mount"}
TRACEE_WEBHOOK_CONFIG=${TRACEE_WEBHOOK_CONFIG:="/tmp/tracee/integrations-config.yaml"}
TRACEE_WEBHOOK_EXE=${TRACEE_WEBHOOK_EXE:="/tracee/falcosidekick"}
TRACEE_RULES_EXE=${TRACEE_RULES_EXE:="/tracee/tracee-rules"}

if ! $TRACEE_MOUNT_EXE | grep -q 'debugfs on /sys/kernel/debug'; then
$TRACEE_MOUNT_EXE -t debugfs debugfs /sys/kernel/debug/
fi

if [ "$1" = "trace" ]; then
shift
$TRACEE_EBPF_EXE $@
Expand Down
14 changes: 0 additions & 14 deletions entrypoint_test.bats
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,12 @@ setup() {
export TRACEE_RULES_EXE="tracee-rules"
export TRACEE_WEBHOOK_EXE="falco-sidekick"
export TRACEE_WEBHOOK_CONFIG="$0" #some existing file
export TRACEE_MOUNT_EXE="mount"
}

teardown() {
rm $log
}

@test "mount debugfs" {
run ./entrypoint.sh
assert_success
assert_contains 'mounted'
}

@test "don't mount debugfs" {
export MOCK_MOUNT_EXISTS=true
run ./entrypoint.sh
assert_success
assert_absent 'mounted'
}

@test "trace" {
run ./entrypoint.sh trace --output json -t event=execve --capture dir:/something
assert_success
Expand Down
16 changes: 0 additions & 16 deletions test/mocks/mock
Original file line number Diff line number Diff line change
@@ -1,18 +1,5 @@
#!/usr/bin/env bash

mock_mount() {
if [ $# -eq 0 ]; then
if [ "$MOCK_MOUNT_EXISTS" ]; then
echo 'debugfs on /sys/kernel/debug type debugfs (rw,nosuid,nodev,noexec,relatime)'
fi
exit
fi
if [ $1 = '-t' ]; then
echo "mounted"
exit
fi
}

mock_tracee_ebpf() {
echo 'event1'
}
Expand All @@ -32,9 +19,6 @@ mock_tracee_rules() {
cmd=$(basename $0)
[ "$MOCK_LOG" ] && echo "$cmd $@" >> "$MOCK_LOG"
case "$cmd" in
'mount')
mock_mount $@
;;
'tracee-ebpf')
mock_tracee_ebpf $@
;;
Expand Down
4 changes: 2 additions & 2 deletions tracee-ebpf/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ RUN apk --no-cache update && apk --no-cache add libc6-compat elfutils-dev
# docker run --name tracee --rm --privileged --pid=host -v /lib/modules/:/lib/modules/:ro -v /usr/src:/usr/src:ro -v /tmp/tracee:/tmp/tracee aquasec/tracee
FROM $BASE
WORKDIR /tracee
COPY --from=build /tracee/dist/tracee-ebpf /tracee/entrypoint.sh ./
ENTRYPOINT ["./entrypoint.sh", "./tracee-ebpf"]
COPY --from=build /tracee/dist/tracee-ebpf ./
ENTRYPOINT ["./tracee-ebpf"]
4 changes: 0 additions & 4 deletions tracee-ebpf/entrypoint.sh

This file was deleted.

0 comments on commit f1f3c72

Please sign in to comment.