falcosecurity / driverkit

Kit for building Falco drivers: kernel modules or eBPF probes
Apache License 2.0
64 stars 53 forks source link

new(pkg,cmd): refactored builder script logic. #324

Closed FedeDP closed 6 months ago

FedeDP commented 6 months ago

What type of PR is this?

/kind cleanup /kind feature

Any specific area of the project related to this PR?

/area cmd /area pkg

What this PR does / why we need it:

Builder script has been split in 3 different scripts:

This way, we can reuse download libs script among all of them. Moreover, it is useful to have a download headers script that is invokeable by itself, because it has the logic to download and extract headers for a given distro.

Finally, fixed a couple of things with local builder:

Basically, what we want to achieve here is to allow falcoctl driver loader to be able to fetch KernelURLs using driverkit libraries, and then extract kernel urls using the newly provided templated bash scripts (note: this is a distro specific knowledge, we cannot just "untar" the headers), and finally pass the KERNELDIR env variable back to local build processor. In the end, this approach will enable us to drop the kernel headers dependency for Falco installations on distros supported by driverkit, at least when the headers are actually found by driverkit itself.

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Note that ~400Locs come from new _kernel.sh templates licenses.

Does this PR introduce a user-facing change?:

NONE
FedeDP commented 6 months ago

Here is the output for falcoctl leveraging the new kernel downloader script: https://github.com/falcosecurity/falcoctl/pull/476#issuecomment-1996780861

FedeDP commented 6 months ago

/cc @EXONER4TED

poiana commented 6 months ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: EXONER4TED, 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/driverkit/blob/master/OWNERS)~~ [EXONER4TED,FedeDP] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment