secureexec/secureexec-agent

GitHub: secureexec/secureexec-agent

一个跨平台 EDR 代理,使用 eBPF/Endpoint Security/ETW 收集安全事件并通过 gRPC/mTLS 上报。

Stars: 4 | Forks: 1

# SecureExec 代理 [![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](LICENSE) 一个多平台 EDR(端点检测与响应)代理,用于收集安全事件并通过 gRPC/mTLS 将其流式传输到 [SecureExec](https://secureexec.co) 服务器。 ## 平台 | 平台 | 技术 | Crate | |------|------|-------| | Linux | eBPF(跟踪点 + kprobes) | `linux/agent` | | macOS | 端点安全 + 网络扩展 | `macos/agent` | | Windows | ETW / WMI | `windows/agent` | 共享传输、管道和事件类型位于 `generic/` 中。 ## 收集的事件 | 事件 | Linux | macOS | Windows | |------|------:|------:|-------:| | 进程创建 / fork / 退出 | x | x | 计划中 | | 文件创建 / 修改 / 删除 | x | x | 计划中 | | 文件重命名 | x | x | | | 文件权限更改(chmod/chown) | x | | | | 文件链接 / 符号链接 | x | | | | 网络连接 | x | x | 计划中 | | 网络监听(accept / bind) | x | x | | | DNS 查询 | x | | | | 注册表写入 | | | 计划中 | | 特权更改(setuid/setgid) | x | | | | 进程访问(ptrace) | x | | | | 进程虚拟机读/写 | x | | | | 进程信号(kill) | x | | | | 内存映射(执行/写入) | x | | | | memfd_create | x | | | | 内核模块加载 | x | | | | BPF 程序加载 | x | | | | 能力更改 | x | | | | 命名空间更改(unshare/setns) | x | | | | 挂载 / 卸载 | x | | | | keyctl | x | | | | io_uring 初始化 | x | | | | 代理生命周期 / 心跳 | x | x | x | ## 仓库布局 ``` agent/ ├── generic/ # Shared: EventKind, gRPC transport, pipeline, filter ├── proto/ # secureexec.proto (gRPC schema) ├── linux/ │ ├── agent/ # Userspace eBPF consumer │ ├── ebpf/ # Kernel eBPF programs (tracepoints / kprobes) │ ├── ebpf-common/ # Shared kernel↔userspace types │ └── kmod/ # Optional kernel module (firewall) ├── macos/ │ ├── agent/ # Endpoint Security sensor (Rust) │ ├── app/ # Menu bar app (Swift/SwiftUI) │ ├── activator/ # System extension activator (Swift) │ └── network-ext/ # Network Extension (Swift) └── windows/ └── agent/ # ETW/WMI sensor (Rust) ``` ## 构建 ### 先决条件 - Rust 1.81+(`rustup update stable`) - 对于 Linux eBPF:`bpf-linker`、LLVM 18+、夜间 Rust 工具链 - 对于 macOS 应用程序:Xcode 15+ - 协议编译器:`protoc`(`generic/build.rs` 中由 `tonic-build` 需要) - Docker(用于从 macOS 交叉编译 Linux 代理) ### Linux 代理(Docker —— 推荐) 从任意主机(macOS / Linux)构建,无需本地安装 LLVM 或 bpf-linker。 首次运行约需 5–10 分钟(构建工具链镜像);后续运行约 30–60 秒。 ``` make linux-build-docker ``` 静态 musl 二进制文件位于 `./target/x86_64-unknown-linux-musl/release/secureexec-agent-linux`。 要清除 Docker 构建缓存并从头开始: ``` make linux-build-docker-clean ``` ### Linux 代理(本地构建) 需要 musl 工具链、LLVM 18+ 以及主机上的 `bpf-linker`。 ``` make linux-build ``` ### macOS 代理 ``` make macos-build ``` 二进制文件位于 `./target/release/secureexec-agent-macos`。 ### Windows 代理 ``` make windows-build ``` ## 配置 代理读取 JSON 配置文件(默认:`/opt/secureexec/var/secureexec-agent.json`): ``` { "backend_url": "https://your-server:50051", "tls_ca": "/opt/secureexec/etc/certs/ca.crt", "tls_client_cert": "/opt/secureexec/etc/certs/agent.crt", "tls_client_key": "/opt/secureexec/etc/certs/agent.key", "auth_token": "your-org-token" } ``` ## eBPF 许可说明 Linux eBPF 内核程序(`linux/ebpf/`)在编译后的二进制文件中嵌入了 `"Dual MIT/GPL"` 许可标签。这是 Linux 内核验证器访问仅限 GPL 的 BPF 辅助函数所需的技术要求,与支配本仓库源代码的 Apache 2.0 许可不同。详细信息请参见 [NOTICE](NOTICE)。 ## 许可 Apache 2.0 —— 参见 [LICENSE](LICENSE)。 本代理是 [SecureExec](https://secureexec.co) 平台的一部分。
标签:Agent, BPF程序, Crate, Docker镜像, EDR, Endpoint Detection and Response, Endpoint Security, ETW, gRPC, kprobes, mTLS, Python工具, SecureExec, tracepoints, 事件管道, 共享传输, 内存映射, 内核模块, 可视化界面, 命名空间, 多平台, 安全事件收集, 安全资源, 心跳, 挂载管理, 文件操作, 权限变更, 正则匹配, 流式传输, 网络连接, 脆弱性评估, 进程信号, 进程创建, 进程访问, 通知系统, 遥测