From cee502568427354c4b0c86acaf54e56561a046a7 Mon Sep 17 00:00:00 2001 From: Paul Rey Date: Tue, 19 Mar 2024 14:45:10 +0100 Subject: [PATCH 1/3] Add kernelversion and kernelrelease options to falco driver loader entrypoint Signed-off-by: Paul Rey --- docker/driver-loader/docker-entrypoint.sh | 35 ++++++++++++++--------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/docker/driver-loader/docker-entrypoint.sh b/docker/driver-loader/docker-entrypoint.sh index 4c29bd08b2a..c38cd1f3ccd 100755 --- a/docker/driver-loader/docker-entrypoint.sh +++ b/docker/driver-loader/docker-entrypoint.sh @@ -28,12 +28,14 @@ print_usage() { echo " ebpf eBPF probe" echo "" echo "Options:" - echo " --help show this help message" - echo " --clean try to remove an already present driver installation" - echo " --compile try to compile the driver locally (default true)" - echo " --download try to download a prebuilt driver (default true)" - echo " --http-insecure enable insecure downloads" - echo " --print-env skip execution and print env variables for other tools to consume" + echo " --help show this help message" + echo " --clean try to remove an already present driver installation" + echo " --compile try to compile the driver locally (default true)" + echo " --download try to download a prebuilt driver (default true)" + echo " --kernel-release set the kernel release" + echo " --kernel-version set the kernel version" + echo " --http-insecure enable insecure downloads" + echo " --print-env skip execution and print env variables for other tools to consume" echo "" echo "Environment variables:" echo " FALCOCTL_DRIVER_REPOS specify different URL(s) where to look for prebuilt Falco drivers (comma separated)" @@ -55,6 +57,8 @@ ENABLE_DOWNLOAD="false" HTTP_INSECURE="false" has_driver= has_opts= +extra_args= + while test $# -gt 0; do case "$1" in kmod|ebpf) @@ -85,12 +89,20 @@ while test $# -gt 0; do ;; --http-insecure) HTTP_INSECURE="true" - ;; + ;; --source-only) - >&2 echo "Support dropped in Falco 0.37.0." + >&2 echo "Support dropped in Falco 0.37.0." print_usage exit 1 ;; + --kernel-release) + extra_args+="--kernelrelease=$2 " + shift + ;; + --kernel-version) + extra_args+="--kernelversion=$2 " + shift + ;; --print-env) /usr/bin/falcoctl driver printenv exit 0 @@ -109,9 +121,6 @@ while test $# -gt 0; do shift done -if [ -z "$has_opts" ]; then - ENABLE_COMPILE="true" - ENABLE_DOWNLOAD="true" -fi +echo "Extra args: $extra_args" -/usr/bin/falcoctl driver install --compile=$ENABLE_COMPILE --download=$ENABLE_DOWNLOAD --http-insecure=$HTTP_INSECURE --http-headers="$FALCOCTL_DRIVER_HTTP_HEADERS" +/usr/bin/falcoctl driver install --compile=$ENABLE_COMPILE --download=$ENABLE_DOWNLOAD --http-insecure=$HTTP_INSECURE --http-headers="$FALCOCTL_DRIVER_HTTP_HEADERS" $extra_args From e4b620d6e3e70e3238334592dee76dcb012e0da2 Mon Sep 17 00:00:00 2001 From: Paul Rey Date: Wed, 20 Mar 2024 17:41:38 +0100 Subject: [PATCH 2/3] Update driver-loader docker-entrypoint Remove debug log Set default option ENABLE_COMPILE and ENABLE_DOWNLOAD Signed-off-by: Paul Rey --- docker/driver-loader/docker-entrypoint.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docker/driver-loader/docker-entrypoint.sh b/docker/driver-loader/docker-entrypoint.sh index c38cd1f3ccd..e3815388aea 100755 --- a/docker/driver-loader/docker-entrypoint.sh +++ b/docker/driver-loader/docker-entrypoint.sh @@ -121,6 +121,9 @@ while test $# -gt 0; do shift done -echo "Extra args: $extra_args" +if [ -z "$has_opts" ]; then + ENABLE_COMPILE="true" + ENABLE_DOWNLOAD="true" +fi /usr/bin/falcoctl driver install --compile=$ENABLE_COMPILE --download=$ENABLE_DOWNLOAD --http-insecure=$HTTP_INSECURE --http-headers="$FALCOCTL_DRIVER_HTTP_HEADERS" $extra_args From be74dc725b36c030acc23e48de6c52a953cedc69 Mon Sep 17 00:00:00 2001 From: Paul Rey Date: Thu, 21 Mar 2024 10:48:05 +0100 Subject: [PATCH 3/3] Remove --source-only option in driver loader docker-entrypoint.sh The option is supported anymore in falcoctl Signed-off-by: Paul Rey --- docker/driver-loader/docker-entrypoint.sh | 5 ----- 1 file changed, 5 deletions(-) diff --git a/docker/driver-loader/docker-entrypoint.sh b/docker/driver-loader/docker-entrypoint.sh index e3815388aea..b04866e0d5a 100755 --- a/docker/driver-loader/docker-entrypoint.sh +++ b/docker/driver-loader/docker-entrypoint.sh @@ -90,11 +90,6 @@ while test $# -gt 0; do --http-insecure) HTTP_INSECURE="true" ;; - --source-only) - >&2 echo "Support dropped in Falco 0.37.0." - print_usage - exit 1 - ;; --kernel-release) extra_args+="--kernelrelease=$2 " shift