-
Notifications
You must be signed in to change notification settings - Fork 1k
new: falcoctl driver loader #2905
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
ec4f26b
new(docker,scripts): dropped falco-driver-loader in favor of new `fal…
FedeDP edfd88e
chore(cmake): bumped falcoctl to dev from https://github.com/falcosec…
FedeDP fe3a1b1
chore(docker): cleaned up useless removal of falcoctl.
FedeDP 7e31d53
chore(scripts/systemd): properly make use of new config keys in syste…
FedeDP b05e866
fix(scripts): fixed driver names for new falcoctl/Falco naming.
FedeDP bedff24
chore(cmake/modules): bumped falcoctl to latest alpha.
FedeDP 006cb35
chore(scripts): only configure falcoctl driver type when a driver is …
FedeDP 8b099c8
update(cmake): bump falcoctl to v0.7.0-alpha2.
FedeDP 278bc1c
chore(scripts): use new default value for falcoctl driver.host-root c…
FedeDP 65f88ab
chore(scripts): integrate back master changes `FALCO_DRIVER_CHOICE` a…
FedeDP 678ca39
chore(cmake): bumped falcoctl to v0.7.0-beta1.
FedeDP ac71895
update(submodules): bumped falcosecurity-testing to latest dev.
FedeDP c78be5b
update(cmake): bump falcoctl to 0.7.0-beta2.
FedeDP d2795c5
update(cmake): bumped falcoctl to v0.7.0-beta3.
FedeDP 73be5e9
update(submodules): bumped falcosecurity/testing to latest master.
FedeDP dc49d5d
update(cmake): bumped falcoctl to v0.7.0-beta4.
FedeDP File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,6 +18,28 @@ | |
| # | ||
|
|
||
|
|
||
| print_usage() { | ||
| echo "" | ||
| echo "Usage:" | ||
| echo " falco-driver-loader [driver] [options]" | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above |
||
| echo "" | ||
| echo "Available drivers:" | ||
| echo " kmod kernel module (default)" | ||
| 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 " --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)" | ||
| echo " FALCOCTL_DRIVER_NAME specify a different name for the driver" | ||
| echo "" | ||
| } | ||
|
|
||
| echo "* Setting up /usr/src links from host" | ||
|
|
||
| for i in "$HOST_ROOT/usr/src"/* | ||
|
|
@@ -26,4 +48,64 @@ do | |
| ln -s "$i" "/usr/src/$base" | ||
| done | ||
|
|
||
| /usr/bin/falco-driver-loader "$@" | ||
| ENABLE_COMPILE="false" | ||
| ENABLE_DOWNLOAD="false" | ||
| has_driver= | ||
| has_opts= | ||
| while test $# -gt 0; do | ||
| case "$1" in | ||
| kmod|ebpf) | ||
| if [ -n "$has_driver" ]; then | ||
| >&2 echo "Only one driver per invocation" | ||
| print_usage | ||
| exit 1 | ||
| else | ||
| /usr/bin/falcoctl driver config "--type $1" | ||
| has_driver="true" | ||
| fi | ||
| ;; | ||
| -h|--help) | ||
| print_usage | ||
| exit 0 | ||
| ;; | ||
| --clean) | ||
| /usr/bin/falcoctl driver cleanup | ||
| exit 0 | ||
| ;; | ||
| --compile) | ||
| ENABLE_COMPILE="true" | ||
| has_opts="true" | ||
| ;; | ||
| --download) | ||
| ENABLE_DOWNLOAD="true" | ||
| has_opts="true" | ||
| ;; | ||
| --source-only) | ||
| >&2 echo "Support dropped in Falco 0.37.0." | ||
| print_usage | ||
| exit 1 | ||
| ;; | ||
| --print-env) | ||
| /usr/bin/falcoctl driver printenv | ||
| exit 0 | ||
| ;; | ||
| --*) | ||
| >&2 echo "Unknown option: $1" | ||
| print_usage | ||
| exit 1 | ||
| ;; | ||
| *) | ||
| >&2 echo "Unknown driver: $1" | ||
| print_usage | ||
| exit 1 | ||
| ;; | ||
| esac | ||
| shift | ||
| done | ||
|
|
||
| if [ -z "$has_opts" ]; then | ||
| ENABLE_COMPILE="true" | ||
| ENABLE_DOWNLOAD="true" | ||
| fi | ||
|
|
||
| /usr/bin/falcoctl driver install --compile=$ENABLE_COMPILE --download=$ENABLE_DOWNLOAD | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,6 +17,29 @@ | |
| # limitations under the License. | ||
| # | ||
|
|
||
|
|
||
| print_usage() { | ||
| echo "" | ||
| echo "Usage:" | ||
| echo " falco-driver-loader [driver] [options]" | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same as above |
||
| echo "" | ||
| echo "Available drivers:" | ||
| echo " kmod kernel module (default)" | ||
| 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 " --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)" | ||
| echo " FALCOCTL_DRIVER_NAME specify a different name for the driver" | ||
| echo "" | ||
| } | ||
|
|
||
| # Set the SKIP_DRIVER_LOADER variable to skip loading the driver | ||
|
|
||
| if [[ -z "${SKIP_DRIVER_LOADER}" ]]; then | ||
|
|
@@ -29,9 +52,68 @@ if [[ -z "${SKIP_DRIVER_LOADER}" ]]; then | |
| done | ||
|
|
||
| # convert the optional space-separated env variable FALCO_DRIVER_LOADER_OPTIONS to array, prevent | ||
| # shell expansion and use it as argument list for falco-driver-loader | ||
| # shell expansion and use it as argument list for falcoctl | ||
| read -a falco_driver_loader_option_arr <<< $FALCO_DRIVER_LOADER_OPTIONS | ||
| /usr/bin/falco-driver-loader "${falco_driver_loader_option_arr[@]}" | ||
|
|
||
| ENABLE_COMPILE="false" | ||
| ENABLE_DOWNLOAD="false" | ||
| has_driver= | ||
| has_opts= | ||
| for opt in "${falco_driver_loader_option_arr[@]}" | ||
| case "$1" in | ||
| kmod|ebpf) | ||
| if [ -n "$has_driver" ]; then | ||
| >&2 echo "Only one driver per invocation" | ||
| print_usage | ||
| exit 1 | ||
| else | ||
| /usr/bin/falcoctl driver config "--type $opt" | ||
| has_driver="true" | ||
| fi | ||
| ;; | ||
| -h|--help) | ||
| print_usage | ||
| exit 0 | ||
| ;; | ||
| --clean) | ||
| /usr/bin/falcoctl driver cleanup | ||
| exit 0 | ||
| ;; | ||
| --compile) | ||
| ENABLE_COMPILE="true" | ||
| has_opts="true" | ||
| ;; | ||
| --download) | ||
| ENABLE_DOWNLOAD="true" | ||
| has_opts="true" | ||
| ;; | ||
| --source-only) | ||
| >&2 echo "Support dropped in Falco 0.37.0." | ||
| print_usage | ||
| exit 1 | ||
| ;; | ||
| --print-env) | ||
| /usr/bin/falcoctl driver printenv | ||
| exit 0 | ||
| ;; | ||
| --*) | ||
| >&2 echo "Unknown option: $1" | ||
| print_usage | ||
| exit 1 | ||
| ;; | ||
| *) | ||
| >&2 echo "Unknown driver: $1" | ||
| print_usage | ||
| exit 1 | ||
| ;; | ||
| esac | ||
| done | ||
| if [ -z "$has_opts" ]; then | ||
| ENABLE_COMPILE="true" | ||
| ENABLE_DOWNLOAD="true" | ||
| fi | ||
| /usr/bin/falcoctl driver install --compile=$ENABLE_COMPILE --download=$ENABLE_DOWNLOAD | ||
|
|
||
| fi | ||
|
|
||
| exec "$@" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is misleading since there's no
falco-driver-loaderexecutable anymore.Still trying to figure out how to fix it. May we print the container image usage help message instead? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right! Will fix in a follow up PR