fix(docker): fixed docker entrypoints for driver loading.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
This commit is contained in:
Federico Di Pierro 2024-04-15 18:34:25 +02:00 committed by poiana
parent ac61543276
commit fc7a451aed
3 changed files with 20 additions and 11 deletions

View File

@ -59,14 +59,17 @@ has_driver=
has_opts= has_opts=
while test $# -gt 0; do while test $# -gt 0; do
case "$1" in case "$1" in
kmod|ebpf) auto|kmod|ebpf|modern_ebpf)
if [ -n "$has_driver" ]; then if [ -n "$has_driver" ]; then
>&2 echo "Only one driver per invocation" >&2 echo "Only one driver per invocation"
print_usage print_usage
exit 1 exit 1
else else
if [ "$1" != "auto" ]; then if [ "$opt" != "auto" ]; then
/usr/bin/falcoctl driver config --type $1 /usr/bin/falcoctl driver config --type $opt
else
# Needed because we need to configure Falco to start with correct driver
/usr/bin/falcoctl driver config --type modern_ebpf --type ebpf --type kmod
fi fi
has_driver="true" has_driver="true"
fi fi

View File

@ -69,8 +69,11 @@ while test $# -gt 0; do
print_usage print_usage
exit 1 exit 1
else else
if [ "$1" != "auto" ]; then if [ "$opt" != "auto" ]; then
/usr/bin/falcoctl driver config --type $1 /usr/bin/falcoctl driver config --type $opt
else
# Needed because we need to configure Falco to start with correct driver
/usr/bin/falcoctl driver config --type modern_ebpf --type ebpf --type kmod
fi fi
has_driver="true" has_driver="true"
fi fi

View File

@ -23,7 +23,7 @@ print_usage() {
echo "Usage:" echo "Usage:"
echo " docker run -i -t --privileged -v /root/.falco:/root/.falco -v /proc:/host/proc:ro -v /boot:/host/boot:ro -v /lib/modules:/host/lib/modules:ro -v /usr:/host/usr:ro -v /etc:/host/etc:ro -e 'FALCO_DRIVER_LOADER_OPTIONS=[driver] [options]' falcosecurity/falco:latest" echo " docker run -i -t --privileged -v /root/.falco:/root/.falco -v /proc:/host/proc:ro -v /boot:/host/boot:ro -v /lib/modules:/host/lib/modules:ro -v /usr:/host/usr:ro -v /etc:/host/etc:ro -e 'FALCO_DRIVER_LOADER_OPTIONS=[driver] [options]' falcosecurity/falco:latest"
echo "" echo ""
echo "Available drivers:" echo "Available FALCO_DRIVER_LOADER_OPTIONS drivers:"
echo " auto leverage automatic driver selection logic (default)" echo " auto leverage automatic driver selection logic (default)"
echo " modern_ebpf modern eBPF CORE probe" echo " modern_ebpf modern eBPF CORE probe"
echo " ebpf eBPF probe" echo " ebpf eBPF probe"
@ -67,7 +67,7 @@ if [[ -z "${SKIP_DRIVER_LOADER}" ]]; then
for opt in "${falco_driver_loader_option_arr[@]}" for opt in "${falco_driver_loader_option_arr[@]}"
do do
case "$opt" in case "$opt" in
kmod|ebpf) auto|kmod|ebpf|modern_ebpf)
if [ -n "$has_driver" ]; then if [ -n "$has_driver" ]; then
>&2 echo "Only one driver per invocation" >&2 echo "Only one driver per invocation"
print_usage print_usage
@ -75,6 +75,9 @@ if [[ -z "${SKIP_DRIVER_LOADER}" ]]; then
else else
if [ "$opt" != "auto" ]; then if [ "$opt" != "auto" ]; then
/usr/bin/falcoctl driver config --type $opt /usr/bin/falcoctl driver config --type $opt
else
# Needed because we need to configure Falco to start with correct driver
/usr/bin/falcoctl driver config --type modern_ebpf --type ebpf --type kmod
fi fi
has_driver="true" has_driver="true"
fi fi