writing-skills
writing-skills
Use when creating new skills, editing existing skills, or verifying skills work before deployment
performing-cloud-native-forensics-with-falco使用 Falco YAML 规则在容器和 Kubernetes 中进行运行时威胁检测,监控系统调用以检测 shell 生成、文件篡改、网络异常和权限提升。通过 Falco gRPC API 管理 Falco 规则并解析 Falco 告警输出。适用于构建容器运行时安全或调查 k8s 集群入侵。
Independent GitHub snapshot · Automated classification · Original documentation governs
在容器化环境中部署和管理 Falco 规则,用于运行时安全检测。解析 Falco 告警以进行事件响应。
# 检测容器中 shell 的自定义 Falco 规则
- rule: Shell Spawned in Container
desc: 检测在容器中启动 shell 进程
condition: >
spawned_process and container
and proc.name in (bash, sh, zsh, dash, csh)
and not proc.pname in (docker-entrypo, supervisord)
output: >
容器中生成 shell
(user=%user.name command=%proc.cmdline container=%container.name
image=%container.image.repository)
priority: WARNING
tags: [container, shell, mitre_execution]
关键检测规则:
# 使用自定义规则运行 Falco
falco -r /etc/falco/custom_rules.yaml -o json_output=true
# 解析 JSON 告警
cat /var/log/falco/alerts.json | python3 -c "import json,sys; [print(json.loads(l)['output']) for l in sys.stdin]"