|
12 | 12 |
|
13 | 13 | 2. Building **dependencies**
|
14 | 14 |
|
15 |
| - 1. **clang** && **llvm** (12, 13 or 14) |
16 |
| - 1. **golang** (1.22.3 toolchain) |
17 |
| - 1. **libelf** and **libelf-dev** |
| 15 | + 1. `clang` && `llvm` (14) |
| 16 | + 2. `golang` (1.22.3 toolchain) |
| 17 | + 3. `libelf` and `libelf-dev` |
18 | 18 | (or elfutils-libelf and elfutils-libelf-devel)
|
19 |
| - 1. **zlib1g** and **zlib1g-dev** |
| 19 | + 4. `zlib1g` and `zlib1g-dev` |
20 | 20 | (or zlib and zlib-devel)
|
21 |
| - 1. **libzstd-dev** for static build (libelf linkage) |
22 |
| - 1. **clang-format-12** (specific version) for `fix-fmt` |
| 21 | + 5. `libzstd-dev` for static build (libelf linkage) |
| 22 | + 6. `clang-format-12` (specific version) for `fix-fmt` |
23 | 23 |
|
24 | 24 | > You might take a look at the following files to understand how to have a
|
25 | 25 | > building environment:
|
26 | 26 | >
|
27 | 27 | > 1. [.github/actions/build-dependencies/action.yaml](https://github.com/aquasecurity/tracee/blob/main/.github/actions/build-dependencies/action.yaml)
|
28 |
| - > 1. [packaging/Dockerfile.ubuntu-packaging](https://github.com/aquasecurity/tracee/blob/main/packaging/Dockerfile.ubuntu-packaging) |
29 |
| - > 1. [packaging/Dockerfile.fedora-packaging](https://github.com/aquasecurity/tracee/blob/main/packaging/Dockerfile.fedora-packaging) |
| 28 | + > 1. [builder/Dockerfile.ubuntu-tracee-make](https://github.com/aquasecurity/tracee/blob/main/builder/Dockerfile.ubuntu-tracee-make) |
| 29 | + > 1. [builder/Dockerfile.alpine-tracee-make](https://github.com/aquasecurity/tracee/blob/main/builder/Dockerfile.alpine-tracee-make) |
30 | 30 | >
|
31 | 31 | > Those are very good examples for you to replicate a working environment.
|
32 | 32 |
|
33 | 33 | 3. **Clone** [tracee repository](https://github.com/aquasecurity/tracee/)
|
34 | 34 |
|
35 |
| - ```console |
36 |
| - git clone [email protected]:aquasecurity/tracee |
37 |
| - ``` |
38 |
| - |
39 |
| - ```text |
40 |
| - Cloning into 'tracee'... |
41 |
| - remote: Enumerating objects: 13251, done. |
42 |
| - remote: Counting objects: 100% (555/555), done. |
43 |
| - remote: Compressing objects: 100% (240/240), done. |
44 |
| - remote: Total 13251 (delta 343), reused 369 (delta 280), pack-reused 12696 |
45 |
| - Receiving objects: 100% (13251/13251), 11.75 MiB | 8.62 MiB/s, done. |
46 |
| - Resolving deltas: 100% (8105/8105), done. |
| 35 | + ```bash |
| 36 | + git clone [https://github.com/aquasecurity/tracee/](https://github.com/aquasecurity/tracee/) |
47 | 37 | ```
|
48 | 38 |
|
49 | 39 | 4. All makefiles have a **help** target to give you needed instructions
|
50 | 40 |
|
51 |
| - ```console |
| 41 | + ```bash |
52 | 42 | make help
|
53 | 43 | ```
|
54 | 44 |
|
|
68 | 58 | $ make e2e-net-signatures # build ./dist/e2e-net-signatures
|
69 | 59 | $ make e2e-inst-signatures # build ./dist/e2e-inst-signatures
|
70 | 60 | $ make tracee # build ./dist/tracee
|
| 61 | + $ make tracee-operator # build ./dist/tracee-operator |
71 | 62 |
|
72 | 63 | # clean
|
73 | 64 |
|
|
78 | 69 | $ make clean-tracee-bench # wipe ./dist/tracee-bench
|
79 | 70 | $ make clean-signatures # wipe ./dist/signatures
|
80 | 71 | $ make clean-tracee # wipe ./dist/tracee
|
| 72 | + $ make clean-tracee-operator # wipe ./dist/tracee-operator |
81 | 73 |
|
82 | 74 | # test
|
83 | 75 |
|
|
90 | 82 | $ STATIC=1 make ... # build static binaries
|
91 | 83 | $ BTFHUB=1 STATIC=1 make ... # build static binaries, embed BTF
|
92 | 84 | $ DEBUG=1 make ... # build binaries with debug symbols
|
| 85 | + $ METRICS=1 make ... # build enabling BPF metrics |
| 86 | +
|
93 | 87 | ```
|
94 | 88 |
|
95 | 89 | 5. Build **all** targets at once
|
96 | 90 |
|
97 |
| - ```console |
| 91 | + ```bash |
98 | 92 | make all
|
99 | 93 | ```
|
100 | 94 |
|
101 |
| - ```text |
102 |
| - Submodule 'libbpf' (https://github.com/libbpf/libbpf.git) registered for path '3rdparty/libbpf' |
103 |
| - Cloning into '/home/rafaeldtinoco/tracee/3rdparty/libbpf'... |
104 |
| - mkdir -p dist/signatures |
105 |
| - GOOS=linux CC=clang GOARCH=amd64 CGO_CFLAGS= CGO_LDFLAGS= go build \ |
106 |
| - --buildmode=plugin \ |
107 |
| - -o dist/signatures/builtin.so \ |
108 |
| - signatures/golang/export.go signatures/golang/kubernetes_api_connection.go signatures/golang/stdio_over_socket.go |
109 |
| - ``` |
110 |
| - |
111 | 95 | 6. Build a **static binary** by setting `STATIC=1`
|
112 | 96 |
|
113 |
| - ```console |
| 97 | + ```bash |
114 | 98 | STATIC=1 make all
|
115 | 99 | ```
|
116 | 100 |
|
117 |
| - ```text |
118 |
| - CC="clang" \ |
119 |
| - CFLAGS=""-fPIC"" \ |
120 |
| - LD_FLAGS="" \ |
121 |
| - make \ |
122 |
| - -C ./3rdparty/libbpf/src \ |
123 |
| - BUILD_STATIC_ONLY=1 \ |
124 |
| - DESTDIR=/home/rafaeldtinoco/tracee/dist/libbpf \ |
125 |
| - OBJDIR=/home/rafaeldtinoco/tracee/dist/libbpf/obj \ |
126 |
| - INCLUDEDIR= LIBDIR= UAPIDIR= prefix= libdir= \ |
127 |
| - install install_uapi_headers |
128 |
| - ... |
129 |
| - ``` |
130 |
| - |
131 | 101 | 7. Build a **static binary** with [BTFHUB Support](https://github.com/aquasecurity/btfhub)
|
132 | 102 |
|
133 |
| - ```console |
| 103 | + ```bash |
134 | 104 | BTFHUB=1 STATIC=1 make all
|
135 | 105 | ```
|
136 | 106 |
|
137 |
| - ```text |
138 |
| - Cloning into '/home/rafaeldtinoco/tracee/3rdparty/btfhub'... |
139 |
| - remote: Enumerating objects: 205, done. |
140 |
| - remote: Counting objects: 100% (16/16), done. |
141 |
| - remote: Compressing objects: 100% (12/12), done. |
142 |
| - remote: Total 205 (delta 4), reused 10 (delta 3), pack-reused 189 |
143 |
| - Receiving objects: 100% (205/205), 10.59 MiB | 7.56 MiB/s, done. |
144 |
| - Resolving deltas: 100% (73/73), done. |
145 |
| - Cloning into '/home/rafaeldtinoco/tracee/3rdparty/btfhub-archive'... |
146 |
| - remote: Enumerating objects: 1993, done. |
147 |
| - remote: Counting objects: 100% (28/28), done. |
148 |
| - remote: Compressing objects: 100% (23/23), done. |
149 |
| - Receiving objects: 15% (301/1993), 154.97 MiB | 15.72 MiB/s |
150 |
| - ``` |
151 |
| - |
152 | 107 | !!! Note
|
153 | 108 | BTFHUB support will embed several very small files (BTF files) into your
|
154 | 109 | final binary. Those files will allow **tracee** binary to be executed
|
|
163 | 118 | >plugin.Open("/tracee/dist/signatures/builtin.so"): Dynamic loading not supported
|
164 | 119 | >```
|
165 | 120 |
|
166 |
| -8. Build a **debugable binary** with DWARF generation by setting `DEBUG=1` |
| 121 | +8. Build a **debuggable binary** with DWARF debug symbols by setting `DEBUG=1` |
167 | 122 |
|
168 |
| - ```console |
| 123 | + ```bash |
169 | 124 | DEBUG=1 make
|
170 | 125 | ```
|
171 |
| - |
172 |
| - ```text |
173 |
| - GOOS=linux CC=clang GOARCH=amd64 CGO_CFLAGS="-I/home/gg/code/tracee/dist/libbpf" CGO_LDFLAGS="-lelf -lz /home/gg/code/tracee/dist/libbpf/libbpf.a" go build \ |
174 |
| - -tags core,ebpf \ |
175 |
| - -ldflags=" \ |
176 |
| - -extldflags \"\" \ |
177 |
| - -X main.version=\"v0.8.0-107-g121efeb\" \ |
178 |
| - " \ |
179 |
| - -v -o dist/tracee \ |
180 |
| - ./cmd/tracee |
| 126 | + |
| 127 | +9. Build enabling BPF metrics by setting `METRICS=1` |
| 128 | + |
| 129 | + BPF metrics are only available if the BPF object is built with `METRICS` debug flag defined. |
| 130 | + |
| 131 | + ```bash |
| 132 | + METRICS=1 make |
181 | 133 | ```
|
0 commit comments