متقدم
البحث فيأدلة التثبيت
طريقة البحث
  • الصق رسالة الخطأ بين علامتي تنصيص، مثل "permission denied"، لتجد جدول الحل.
  • اختر مجالًا وجزءًا من الدليل (التثبيت، أول الإعدادات، الاستخدام اليومي، الأمان، الحلول) لتصل مباشرة إلى الخطوة الصحيحة.
  • "كلمتان" تجد العبارة بالضبط.
  • الكلمات العادية تجد الأسماء والنصوص والأمثلة.
  • ↑ ↓ للتنقل · Enter للفتح · Esc للإغلاق · / للبحث
جرّب:

الدليل 60Falco · Security

Install and set up Falco (runtime threat detection)

Falco watches what really happens on a running system — every process, file and network action, read from the Linux kernel — and raises an alert when something looks like an attack: a shell in a container, a write to /etc, reading /etc/shadow, a crypto miner, a container that talks to the Kubernetes API. It is a CNCF graduated project and the standard for runtime security (also in the CKS exam). This guide installs Falco on RHEL and Ubuntu with the modern eBPF driver, sends alerts as JSON, writes and tests your own rule, tunes noise, and shows the Kubernetes install.

  • 11 الدروس
  • 16 الأوامر

هذا الجزء لم يُترجم بعد. أنت ترى النص الإنجليزي.

$ مستخدم عادي# بصلاحية root (أو مع sudo)

60.1

Know it before you install

The driver (modern eBPF, the default) sends kernel events to Falco. Rules (YAML) have a condition (with macros and lists), an output text and a priority. Falco ships a ready rule set; you add your own in local files. Outputs send alerts to stdout/journald, files, HTTP, or through Falcosidekick to Slack, Teams, SIEMs and more.

ItemValue
Packagefalco (repository falco.org / download.falco.org)
Servicefalco-modern-bpf.service (modern eBPF driver)
Config/etc/falco/falco.yaml
Rules/etc/falco/falco_rules.yaml (shipped, do not edit), /etc/falco/falco_rules.local.yaml and /etc/falco/rules.d/ (yours)
Rule updatesfalcoctl (falcoctl-artifact-follow.service)
Needsa kernel with BTF (most kernels ≥ 5.8, RHEL 9/10, Ubuntu 22.04+)

الأوامر في هذا الدرس

60.2

Install on RHEL, Rocky, Alma and Fedora

rpm --import https://falco.org/repo/falcosecurity-packages.asc
curl -fsSL -o /etc/yum.repos.d/falcosecurity.repo https://falco.org/repo/falcosecurity-rpm.repo
FALCO_FRONTEND=noninteractive FALCO_DRIVER_CHOICE=modern_ebpf dnf -y install falco
systemctl enable --now falco-modern-bpf.service
journalctl -u falco-modern-bpf -n 20

60.3

Install on Ubuntu and Debian

curl -fsSL https://falco.org/repo/falcosecurity-packages.asc | gpg --dearmor -o /usr/share/keyrings/falco-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/falco-archive-keyring.gpg] https://download.falco.org/packages/deb stable main" > /etc/apt/sources.list.d/falcosecurity.list
apt-get update
FALCO_FRONTEND=noninteractive FALCO_DRIVER_CHOICE=modern_ebpf apt-get install -y falco
systemctl enable --now falco-modern-bpf.service

The two variables skip the driver dialog and choose the modern eBPF driver (no kernel module to build).

60.4

First configuration: outputs

Change these parts of falco.yaml — JSON alerts are easy for log tools and SIEMs:

/etc/falco/falco.yaml
json_output: true
json_include_output_property: true
priority: notice
stdout_output:
  enabled: true
file_output:
  enabled: true
  keep_alive: false
  filename: /var/log/falco/events.json
http_output:
  enabled: false
  url: http://127.0.0.1:2801/
rules_files:
  - /etc/falco/falco_rules.yaml
  - /etc/falco/falco_rules.local.yaml
  - /etc/falco/rules.d
SettingWhy
json_outputOne JSON object per alert — easy to ship to Loki, Elasticsearch or a SIEM.
priority: noticeIgnore lower-priority rules (less noise).
file_outputA local file a log shipper (Fluent Bit, Alloy) can read.
http_output → FalcosidekickSend alerts to Slack, Teams, Alertmanager, Elasticsearch, …
rules_files orderYour local files come after the shipped rules, so they can change them.
mkdir -p /var/log/falco
systemctl restart falco-modern-bpf

Test it: start a shell in a container and read a sensitive file — Falco should alert:

docker run --rm -it alpine sh -c 'cat /etc/shadow'
journalctl -u falco-modern-bpf -n 5 --output cat
{"output":"… Sensitive file opened for reading by non-trusted program (file=/etc/shadow … container_name=…)","priority":"Warning","rule":"Read sensitive file untrusted", …}

60.5

Your own rule

Alert on any shell in the containers of the shop namespace (or with the shop image), and on writes below /etc inside containers:

/etc/falco/rules.d/shop.yaml
- list: shell_binaries_shop
  items: [bash, sh, zsh, ash, dash]
 
- rule: Shell in shop container
  desc: A shell started inside a shop container (possible attack or manual change)
  condition: >
    spawned_process and container
    and proc.name in (shell_binaries_shop)
    and (k8s.ns.name = "shop" or container.image.repository endswith "/shop")
  output: >
    Shell in shop container (user=%user.name cmd=%proc.cmdline container=%container.name
    image=%container.image.repository pod=%k8s.pod.name ns=%k8s.ns.name)
  priority: WARNING
  tags: [container, shell, mitre_execution]
 
- rule: Write below etc in container
  desc: A process in a container wrote a file below /etc
  condition: open_write and container and fd.name startswith /etc/
  output: File below /etc written in container (file=%fd.name cmd=%proc.cmdline container=%container.name)
  priority: ERROR
  tags: [container, filesystem, mitre_persistence]

Check the rules, then restart:

falco --validate /etc/falco/rules.d/shop.yaml
systemctl restart falco-modern-bpf

Tune noise without editing the shipped file — append an exception to an existing rule in your local file:

/etc/falco/falco_rules.local.yaml
- rule: Read sensitive file untrusted
  exceptions:
    - name: backup_agent
      fields: [proc.name, fd.name]
      values:
        - [restic, /etc/shadow]
  override:
    exceptions: append

60.6

Kubernetes install

In a cluster, Falco runs as a DaemonSet (one Pod per node) — with Falcosidekick and its UI:

helm repo add falcosecurity https://falcosecurity.github.io/charts
helm repo update
helm upgrade --install falco falcosecurity/falco -n falco --create-namespace --set driver.kind=modern_ebpf --set falcosidekick.enabled=true --set falcosidekick.webui.enabled=true --set tty=true
kubectl -n falco get pods
kubectl -n falco logs -l app.kubernetes.io/name=falco -c falco --tail 20

Custom rules go in the chart values (customRules:).

60.7

Daily use: the commands and the real uses

journalctl -u falco-modern-bpf -f
tail -f /var/log/falco/events.json | jq -r '.priority + " " + .rule'
falco --list | head
falco -L | grep -i shell
falcoctl artifact list
falcoctl artifact install falco-rules:4
systemctl status falcoctl-artifact-follow

Real uses at work:

  • Detect attacks at runtime: shells in containers, reverse shells, privilege escalation, crypto miners, reads of secrets.
  • Compliance evidence (PCI, SOC 2): file integrity and process monitoring.
  • Feed a SIEM / incident response; with Falco Talon or other tools, react automatically (for example isolate a Pod).
  • CKS exam tasks: find which container did something from Falco output.

60.8

Make it safe

Security checklist:

  • Keep the shipped rules updated with falcoctl; never edit falco_rules.yaml — use local files.
  • Send alerts off the host (a SIEM or Alertmanager) — an attacker on the host can delete local logs.
  • Tune with exceptions, not by turning rules off; review new noise each week.
  • Protect the Falco config and service (root only); alert when Falco stops.
  • Use it together with prevention: Pod Security, least privilege, read-only root file systems, NetworkPolicies.

60.9

Update and remove

dnf -y upgrade falco
apt-get install --only-upgrade -y falco
systemctl restart falco-modern-bpf
systemctl disable --now falco-modern-bpf
dnf -y remove falco

60.10

Fix common problems

ProblemCauseFix
Falco does not start: driver / BPF errorKernel without BTF or too old for modern eBPF.Update the kernel, or choose the kmod / ebpf driver (falcoctl driver config --type kmod).
No alerts in the testWrong service (falco.service vs falco-modern-bpf), or priority too high.systemctl status falco-modern-bpf; lower priority; check rules_files.
Too many alertsNormal tools trigger rules.Add exceptions in a local file; raise priority.
LOAD_ERR_COMPILE_CONDITIONA typo in your rule (field, macro or list name).falco --validate FILE; check field names with falco --list.
k8s.* fields are emptyNo container/Kubernetes metadata on this host.Run Falco in the cluster (Helm chart), or match on container.* fields.
High CPU on busy nodesVery many syscalls or heavy rules.Tune rules, use the base syscall set, check falco metrics.

60.11

Next steps

1Where do you put your own Falco rules and exceptions, and why not in falco_rules.yaml?

In falco_rules.local.yaml or rules.d/; the shipped file is replaced at every rules update.

2How do you check a new rule file before restarting Falco?

الأوامر في هذا الدرس

كل الأوامر في هذا الفصل