Skip to content

OPNsense ​

OPNsense封禁模块

下载模块 ​

shell
wget https://raw.githubusercontent.com/SecAegis/SecAutoBan/main/device/block/opnsense/opnsense.py

配置OPNsense ​

添加API ​

查看官方文档为用户添加API密钥

创建别名组 ​

在防火墙-别名页面新建别名sec_auto_ban并保存:

为别名组创建封禁规则 ​

在防火墙-规则-浮动页面新建两条规则,分别为阻止源IP为别名组及目标IP为别名组,图例:

配置模块 ​

安装依赖 ​

shell
pip3 install SecAutoBan requests

修改配置 ​

修改回连核心模块配置 ​

更改脚本第56-58行

python
server_ip = "127.0.0.1",
server_port = 80,
sk = "sk-xxx",

修改与OPNsense连接的地址 ​

更改脚本第51行

python
"url": "http://xxx.xxx.xxx.xxx",

修改刚刚获取的OPNsense API ​

更改脚本第52-53行

python
"api_key": "xxx",
"api_secret": "xxx",

运行 ​

shell
python3 opnsense.py