Chuyển đến nội dung
Skillpedia
Bảo mật35k · #8033

implementing-ebpf-security-monitoring

Skill này làm gì

Công cụ này cho phép bạn theo dõi những gì đang diễn ra trên máy tính hoặc máy chủ theo thời gian thực, như chương trình nào được chạy, tệp nào được truy cập và kết nối mạng nào được thực hiện. Nó làm việc này rất hiệu quả, trực tiếp trong “lõi” của hệ điều hành (kernel).

Khi nào nên dùng

  • ✓Khi bạn cần biết chính xác điều gì đang xảy ra trên máy chủ Linux hoặc cụm Kubernetes.
  • ✓Khi các công cụ giám sát thông thường làm chậm hệ thống.
  • ✓Khi bạn muốn ngăn chương trình nguy hiểm chạy hoặc truy cập tệp quan trọng.

Liên kết skill

https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/implementing-ebpf-security-monitoring/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/implementing-ebpf-security-monitoring/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Giám sát mọi lần tệp /etc/passwd bị đọc trên máy chủ của tôi.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Công cụ dùng công nghệ eBPF để quan sát các sự kiện hệ thống trực tiếp trong kernel, mà không cần chạy thêm chương trình tốn tài nguyên. Bạn có thể định nghĩa quy tắc để lọc và phản ứng với các sự kiện này.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

Implementing eBPF Security Monitoring

When to Use

  • When deploying kernel-level runtime security monitoring on Linux hosts or Kubernetes clusters
  • When you need sub-millisecond visibility into process execution, network connections, and file access
  • When traditional userspace monitoring tools introduce unacceptable performance overhead
  • When building detection pipelines that require in-kernel filtering before events reach userspace
  • When enforcing runtime security policies (kill process, send signal) at the kernel level

Prerequisites

  • Linux kernel 5.3+ with BTF (BPF Type Format) support enabled
  • Kubernetes 1.24+ cluster (for Kubernetes deployment) or standalone Linux host
  • Helm 3.x installed (for Kubernetes deployment)
  • kubectl configured with cluster access
  • tetra CLI installed for local event streaming
  • Python 3.8+ with requests, kubernetes, pyyaml dependencies
  • Root or CAP_BPF/CAP_SYS_ADMIN capabilities for eBPF program loading

Instructions

1. Install Tetragon on Kubernetes

Deploy Tetragon via Helm to get default process lifecycle observability:

helm repo add cilium https://helm.cilium.io
helm repo update
helm install tetragon cilium/tetragon -n kube-system \
  --set tetragon.enableProcessCred=true \
  --set tetragon.enableProcessNs=true

Verify the installation:

kubectl get pods -n kube-system -l app.kubernetes.io/name=tetragon
kubectl logs -n kube-system -l app.kubernetes.io/name=tetragon -c export-stdout -f | head -20

2. Install Tetragon on Standalone Linux

For non-Kubernetes Linux hosts, install from the tarball release:

curl -LO https://github.com/cilium/tetragon/releases/latest/download/tetragon-linux-amd64.tar.gz
tar xzf tetragon-linux-amd64.tar.gz
sudo cp tetragon /usr/local/bin/
sudo cp tetra /usr/local/bin/

# Start tetragon daemon
sudo tetragon --btf /sys/kernel/btf/vmlinux &

# Stream events
tetra getevents -o compact

3. Monitor Process Execution (Default)

Tetragon generates process_exec and process_exit events by default without any TracingPolicy:

# Stream process events in compact format
tetra getevents -o compact

# Stream in JSON for SIEM ingestion
tetra getevents -o json | jq '.process_exec // .process_exit'

Example process_exec JSON event:

{
  "process_exec": {
    "process": {
      "binary": "/usr/bin/curl",
      "arguments": "https://malicious.example.com/payload",
      "cwd": "/tmp",
      "uid": 1000,
      "pod": {
        "namespace": "default",
        "name": "webapp-7b4d9f8c6-x2k9p"
      },
      "parent": {
        "binary": "/bin/bash",
        "pid": 1234
      }
    }
  }
}

4. Author TracingPolicy for File Access Monitoring

Create a TracingPolicy CRD to monitor access to sensitive files via the sys_openat kprobe:

# file-access-monitor.yaml
apiVersion: cilium.io/v1alpha1
kind: TracingPolicy
metadata:
  name: monitor-sensitive-file-access
spec:
  kprobes:
    - call: "fd_install"
      syscall: false
      args:
        - index: 0
          type: "int"
        - index: 1
          type: "file"
      selectors:
        - matchArgs:
            - index: 1
              operator: "Prefix"
              values:
                - "/etc/shadow"
                - "/etc/passwd"
                - "/etc/sudoers"
                - "/root/.ssh/"
                - "/etc/kubernetes/pki/"
          matchActions:
            - action: Post

Apply and observe:

kubectl apply -f file-access-monitor.yaml
tetra getevents -o compact --process-filter "event_set:PROCESS_KPROBE"

5. Author TracingPolicy for Network Connection Monitoring

Monitor outbound TCP connections using the tcp_connect kprobe:

# network-monitor.yaml
apiVersion: cilium.io/v1alpha1
kind: TracingPolicy
metadata:
  name: monitor-tcp-connections
spec:
  kprobes:
    - call: "tcp_connect"
      syscall: false
      args:
        - index: 0
          type: "sock"
      selectors:
        - matchActions:
            - action: Post

6. Author TracingPolicy for Privilege Escalation Detection

Detect setuid/setgid calls that may indicate privilege escalation:

# privilege-escalation-detect.yaml
apiVersion: cilium.io/v1alpha1
kind: TracingPolicy
metadata:
  name: detect-privilege-escalation
spec:
  kprobes:
    - call: "__sys_setuid"
      syscall: false
      args:
        - index: 0
          type: "int"
      selectors:
        - matchArgs:

…
Câu hỏi thường gặp

eBPF là gì?

eBPF là công nghệ cho phép chạy các chương trình nhỏ một cách an toàn bên trong kernel Linux, để giám sát và quan sát hệ thống mà không thay đổi mã của kernel.

Cilium Tetragon là gì?

Đây là công cụ dùng eBPF để giám sát bảo mật theo thời gian thực và thực thi các chính sách bảo mật ở mức kernel.

“Kernel” là gì?

Kernel là lõi của hệ điều hành, chịu trách nhiệm quản lý tài nguyên phần cứng và cho phép các chương trình hoạt động.

Chi tiết

Mô tả gốc của tác giả

Implements eBPF-based security monitoring using Cilium Tetragon for real-time process execution tracking, network connection observability, file access auditing, and runtime enforcement. Covers TracingPolicy CRD authoring with kprobe/tracepoint hooks, in-kernel filtering via matchArgs/matchBinaries selectors, JSON event export, and integration with SIEM pipelines. Use when building kernel-level ru

repo: mukul975/Anthropic-Cybersecurity-Skills

Độ phổ biến

Sao GitHub
35k
Vị trí xếp hạng
#8033
Giấy phép
Apache-2.0
Cập nhật
31/8/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự