toreamun/opnsense-plugins

GitHub: toreamun/opnsense-plugins

为 OPNsense CARP 虚拟 IP 保持 DHCP 租约活跃的第三方插件,使基于 DHCP/CGNAT 的 WAN 链路也能实现双节点故障转移。

Stars: 2 | Forks: 0

# opnsense-plugins 由 [@toreamun](https://github.com/toreamun) 开发的第三方 [OPNsense](https://opnsense.org/) 插件。 [![OPNsense 插件](https://img.shields.io/badge/OPNsense-plugin-d94f00)](https://opnsense.org/) [![许可证:BSD-2-Clause](https://img.shields.io/badge/license-BSD--2--Clause-blue)](LICENSE) [![请我喝杯咖啡](https://img.shields.io/badge/Buy%20Me%20a%20Coffee-donate-ffdd00?logo=buymeacoffee&logoColor=black)](https://buymeacoffee.com/toreamun) 本仓库的布局镜像了官方 [opnsense/plugins](https://github.com/opnsense/plugins) ports 树 (`<类别>/<插件>/`) 的结构,因此每个插件都可以使用标准的 OPNsense 插件构建系统进行构建。 ## 插件 | 插件 | 类别 | 描述 | |--------|----------|-------------| | [os-carp-vip-dhcp](net/os-carp-vip-dhcp/) | net | 为 CARP 虚拟 IP 保持 DHCP 租约活跃,从而使 CARP VIP 可以在通过 DHCP 分配的 WAN(例如 CGNAT 链路)上运行,并在两个 OPNsense 节点之间进行故障转移。 | ## 安装说明 在 OPNsense 设备上,以 root 身份执行,安装程序会解析最新的签名发布版本, 验证其签名,安装依赖项,然后安装插件: ``` fetch -o - https://raw.githubusercontent.com/toreamun/opnsense-plugins/main/install.sh | sh -s -- ``` `` 默认为 `os-carp-vip-dhcp`。每个插件各自的 README(见上表中的链接) 包含详细信息。发布版本均已签名 —— 请进行验证(见下文)。OPNsense 软件包使用通配符 ABI,因此一个构建版本可适用于所有 OPNsense 版本。 ## 验证发布版本 `pkg add` 不会验证独立软件包,因此每次发布还会附带一个 已签名的校验和清单(`SHA256SUMS` + `SHA256SUMS.sig`)。在安装之前,请在 OPNsense 设备上对其进行验证: ``` # 一次性:获取维护者公钥 fetch -o release.pub https://raw.githubusercontent.com/toreamun/opnsense-plugins/main/keys/release.pub # 将 release 的 *.pkg, SHA256SUMS 和 SHA256SUMS.sig 放在当前目录下: openssl base64 -d -in SHA256SUMS.sig -out SHA256SUMS.sig.bin openssl dgst -sha256 -verify release.pub -signature SHA256SUMS.sig.bin SHA256SUMS # -> Verified OK # 根据已签名的 manifest 检查每个 package(格式无关:通过 hash 匹配) for p in *.pkg; do grep -q "$(sha256 -q "$p")" SHA256SUMS && echo "$p: OK" || echo "$p: MISMATCH"; done ``` `Verified OK` 证明该清单已使用维护者密钥进行签名;而 diff 的结果 证明每个 `.pkg` 都与已签名的清单匹配。 ## 构建与发布 请参阅 **[RELEASE.md](RELEASE.md)** 了解 构建 → 签名 → 打标签 → 发布 的流程,以及 每个发布版本所通过的审查环节。软件包必须**在 OPNsense 设备上**进行构建 —— GitHub Actions 没有 OPNsense/FreeBSD 运行器,并且依赖项的名称与 原版 FreeBSD 有所不同(OPNsense 26.x 使用的是 `py313-scapy`)。 ## 从源码构建(开发) 如果要在正在运行的设备上进行迭代,请将该插件放入插件检出目录并直接安装, 然后重新加载 GUI 和 configd: ``` git clone https://github.com/opnsense/plugins /usr/plugins cp -a net/os-carp-vip-dhcp /usr/plugins/net/ cd /usr/plugins/net/os-carp-vip-dhcp make install configctl webgui restart ``` ## 开发 / 代码检查 - Python:PEP 8,最大行长 120(`flake8`,配置位于 [setup.cfg](setup.cfg))。 - PHP:PSR-12(`phpcs`)。 - 使用 [pre-commit](.pre-commit-config.yaml) 在本地运行所有检查: ``` pre-commit install pre-commit run --all-files ``` CI([.github/workflows/lint.yml](.github/workflows/lint.yml))会在每次推送和拉取请求时 运行相同的检查。 ## 许可证 BSD-2-Clause。请参阅 [LICENSE](LICENSE)。
标签:CGNAT, Cutter, DHCP, OPNsense, 内核驱动, 插件, 网络协议, 网络故障转移, 进程监控, 逆向工具