diff --git a/.gitignore b/.gitignore index 34bd736d4c2efc5ec014691589e3c68eed5decee..376b718ec7dae5a5cd25a66e4f8110bd9be7f624 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ build output +pkg/bpf/bytecode/* *bpf.o tags diff --git a/Makefile b/Makefile index f17dfdef8efff05a111605ed5e4bbb9746a30af5..430b8680cd514205bf9b989ed0effa833d411e67 100644 --- a/Makefile +++ b/Makefile @@ -21,7 +21,7 @@ libbpf-static: $(LIBBPF_SRC) $(wildcard $(LIBBPF_SRC)/*.[ch]) OBJDIR=$(LIBBPF_OBJDIR) \ DESTDIR=$(LIBBPF_DESTDIR) \ INCLUDEDIR= LIBDIR= UAPIDIR= install - STATIC='-extldflags -static' + $(eval STATIC=-extldflags -static) .PHONY: libbpf libbpf: $(LIBBPF_SRC) $(wildcard $(LIBBPF_SRC)/*.[ch]) @@ -50,15 +50,15 @@ bpf-restricted-mount: $(BPF_BUILDDIR)/restricted-mount.bpf.o .PHONY: bpf-restricted-process bpf-restricted-process: $(BPF_BUILDDIR)/restricted-process.bpf.o +.PHONY: build +build: vmlinux bpf-restricted-network bpf-restricted-file bpf-restricted-mount bpf-restricted-process + mkdir -p build + $(CGOFLAG) go build -tags netgo -ldflags "-w -s $(STATIC)" -o build/safeguard cmd/safeguard/safeguard.go + .PHONY: vmlinux vmlinux: $(shell bpftool btf dump file /sys/kernel/btf/vmlinux format c > $(OUTPUT)/vmlinux.h) -.PHONY: build -build: bpf-restricted-network bpf-restricted-file bpf-restricted-mount bpf-restricted-process vmlinux - mkdir -p build - echo $(CGOFLAG) go build -tags netgo -ldflags "-w -s $(STATIC)" -o build/safeguard cmd/safeguard/safeguard.go - $(CGOFLAG) go build -tags netgo -ldflags "-w -s $(STATIC)" -o build/safeguard cmd/safeguard/safeguard.go clean: rm -rf pkg/bpf/bytecode/*.o diff --git a/pkg/bpf/bytecode/restricted-file.bpf.o b/pkg/bpf/bytecode/restricted-file.bpf.o deleted file mode 100644 index 83d13ab2f2fbbebf940f5e0c5bc0fdc470bfd909..0000000000000000000000000000000000000000 Binary files a/pkg/bpf/bytecode/restricted-file.bpf.o and /dev/null differ diff --git a/pkg/bpf/bytecode/restricted-mount.bpf.o b/pkg/bpf/bytecode/restricted-mount.bpf.o deleted file mode 100644 index b517c67f151fd3246be398833351802b4e5d8c9d..0000000000000000000000000000000000000000 Binary files a/pkg/bpf/bytecode/restricted-mount.bpf.o and /dev/null differ diff --git a/pkg/bpf/bytecode/restricted-process.bpf.o b/pkg/bpf/bytecode/restricted-process.bpf.o deleted file mode 100644 index 2794aac910251a125cb646eb8512712819aa9297..0000000000000000000000000000000000000000 Binary files a/pkg/bpf/bytecode/restricted-process.bpf.o and /dev/null differ