How falcosecurity/falco works
Project type and purpose
• Falco is a C++-based, cloud-native Linux runtime security tool that monitors kernel events (syscalls) and container metadata, applies user-defined rules, and emits alerts in real time.
• It comprises a kernel-space component (drivers/BPF), a userspace engine (event capture, filtering, rule evaluation), and a userspace daemon/CLI (falco) providing gRPC/HTTP interfaces and various output plugins.
File structure
• Top-level build orchestration: CMakeLists.txt, cmake/ modules, Makefile, Docker and CI workflows (.github/workflows/, docker/).
• Core libraries (event capture, rule engine) live under userspace/engine/.
• The Falco daemon/application (CLI, servers, output plugins) lives under userspace/falco/.
• Configuration and default rule files in config/.
• Packaging scripts under scripts/.
• Demo and containerized environment in docker/docker-compose/.
README insights
• Falco uses backends for driver loading (kernel module or modern BPF) provided via libs submodule.
• Outputs can be to stdout, file, syslog, HTTP, gRPC or via plugins (Falco Plugin SDK).
• Offers a gRPC server and embedded HTTP server for remote control and event streaming.
• Demo environment includes Falco, Falcosidekick (event shipper), Redis, and UI.
Main components & their interactions
a. Kernel-space probes (legacy kmod or eBPF):
• Raw syscall/container events
• Built via CMake modules (cmake/modules/bpf.cmake, driver.cmake)
b. Event Capture Library (libscap in userspace/engine/):
• Reads events from kernel probe
• Normalizes, buffers, and hands off to engine
c. Falco Engine (userspace/engine/):
• Applies filter rules, resolves macros, tracks stats
• Generates alerts and enriches events with metadata (e.g., Kubernetes)
d. Falco Daemon/CLI (userspace/falco/app/):
• Loads engine, handles CLI commands (run, list, start_grpc_server, etc.)
• Manages lifecycle, signal handling, config parsing
e. Output Plugins & Servers (userspace/falco/outputs*, grpc_server, webserver):
• Formats and dispatches alerts to stdout, files, syslog, HTTP POST, gRPC streams
• Embedded HTTP/gRPC servers to stream events to clients or orchestration tools
f. External Components:
• Container runtime/Kubernetes API for metadata enrichment
• SIEM/Data Lake or Falcosidekick (via Docker Compose) as downstream consumers
Architectural patterns & design principles
• Layered architecture: kernel probe → capture library → engine → output layer
• Modular CMake organization for drivers, third-party libs, static analysis
• Plugin-style outputs and server interfaces for extensibility
• Single-process, single-thread execution model in Falco daemon for deterministic behavior
Detailed and comprehensive capture
• Low-level build and packaging modules (cmake/, scripts/) as supporting elements
• Submodules (e.g., falcosecurity-libs, falcosecurity-rules) as external dependencies