falcosecurity / falcoctl

Administrative tooling for Falco
Apache License 2.0
82 stars 57 forks source link

wip: new(cmd/driver): download compatible driver version if requested #569

Open FedeDP opened 1 month ago

FedeDP commented 1 month ago

What type of PR is this?

/kind feature

Any specific area of the project related to this PR?

/area cli

What this PR does / why we need it:

This small patch allows to download compatible driver versions instead of the currently configured one. This is how it works:

Now, we cannot do the same for the compilation because we have only local sources for the driver installed Falco was shipped with, but that's not a big deal for now. We could have a post-submit job triggered whenever a new driver version is added (https://github.com/falcosecurity/test-infra/tree/master/driverkit/config) that push driver sources configured for Falco under eg: https://download.falco.org/driver/$version/src/.

Disabled by default for now.

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Keeping it as wip until we decide what to do for compilation too.

poiana commented 1 month ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: FedeDP

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files: - ~~[OWNERS](https://github.com/falcosecurity/falcoctl/blob/main/OWNERS)~~ [FedeDP] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment
FedeDP commented 1 month ago

Example output:

sudo ./falcoctl driver install --compatible --type kmod --log-level debug --version 7.0.0+driver
[sudo] password di federico: 
2024-05-31 11:37:02 DEBUG Fetched kernel info
                      ├ arch: x86_64
                      ├ kernel release: 6.8.0-31-generic
                      └ kernel version: #31-Ubuntu SMP PREEMPT_DYNAMIC Sat Apr 20 00:40:06 UTC 2024
2024-05-31 11:37:02 DEBUG Discovered distro target: ubuntu-generic
2024-05-31 11:37:02 DEBUG Detected supported driver type: kmod
2024-05-31 11:37:02 INFO  Running falcoctl driver install
                      ├ driver version: 7.0.0+driver
                      ├ driver type: kmod
                      ├ driver name: falco
                      ├ compile: true
                      ├ download: true
                      ├ target: ubuntu-generic
                      ├ arch: x86_64
                      ├ kernel release: 6.8.0-31-generic
                      └ kernel version: #31-Ubuntu SMP PREEMPT_DYNAMIC Sat Apr 20 00:40:06 UTC 2024
2024-05-31 11:37:02 INFO  Check if kernel module is still loaded.               
2024-05-31 11:37:02 INFO  OK! There is no module loaded. 
2024-05-31 11:37:02 INFO  Check all versions of kernel module in dkms. 
2024-05-31 11:37:02 INFO  OK! There are no module versions in dkms. 
2024-05-31 11:37:02 DEBUG Loading compatible driver version from S3 
2024-05-31 11:37:03 INFO  Using compatible driver version: 7.2.0+driver