apernet / OpenGFW

OpenGFW is a flexible, easy-to-use, open source implementation of GFW (Great Firewall of China) on Linux
https://gfw.dev/
Mozilla Public License 2.0
9.47k stars 711 forks source link

Adding Mirror Traffic Detection #67

Open ZeroKong-CN opened 6 months ago

ZeroKong-CN commented 6 months ago

After testing, it seems that the core routers & switches' mirror ports' traffic is not currently supported. I enabled the promiscuous mode of the network card under CentOS7 for testing and found that there was no log output. I hope to add this feature for the following reasons: The company's security construction is relatively mature, and it is not possible to make major changes under the current circumstances, especially using self-built cores at key nodes. Therefore, I hope to add support for the detection of traffic on mirror ports, to find users with matching characteristics and intercept them through firewalls or AC devices (internet behavior management). Please assess whether the requirement is feasible to be included in the plan.

经过测试目前貌似并不支持核心路由器&交换机镜像端口的流量,我在CentOS7下开启了网卡混杂模式进行测试发现并没有日志输出。 希望能够添加该功能,原因如下: 目前公司安全建设已经相对成熟,在现有的情况下并不能做大的改动特别是使用自建核心在关键节点。因此希望增加支持对镜像端口流量的检测功能,找出符合特征的用户通过防火墙或AC设备(上网行为管理)进行拦截。 请评估是否可行将该需求纳入计划中。

zfdx123 commented 6 months ago

我注意到这个项目是做流量转发来实现,但是在某些场景下利用镜像端口来处理流量似乎可以减轻服务器压力和降低建设成本以及保证链路稳定性,但是不确定在大流量下是否会出现漏网之鱼的流量,利用交换机镜像端口来实现,我认为很有价值

tobyxdd commented 6 months ago

因为目前是按 inline 部署在路由/交换机上设计的,这样才能实现拦截特定流/包。添加端口镜像的支持本身应该不难,但是现有的 block/drop/modify 这些 actions 就没法实现了。

zfdx123 commented 6 months ago

利用两个网络接口,一个镜像一个发送rst等来实现阻断,不知道是否可行

ZeroKong-CN commented 6 months ago

因为目前是按 inline 部署在路由/交换机上设计的,这样才能实现拦截特定流/包。添加端口镜像的支持本身应该不难,但是现有的 block/drop/modify 这些 actions 就没法实现了。

主要是大型集团类型的公司只能这样子镜像流量去分析数据。(核心数通设备肯定是那几家的) 对于现有的这些actions可能需要的也是过滤展示数据(流量分析纯日志模式)。。。

tobyxdd commented 6 months ago

因为目前是按 inline 部署在路由/交换机上设计的,这样才能实现拦截特定流/包。添加端口镜像的支持本身应该不难,但是现有的 block/drop/modify 这些 actions 就没法实现了。

主要是大型集团类型的公司只能这样子镜像流量去分析数据。(核心数通设备肯定是那几家的) 对于现有的这些actions可能需要的也是过滤展示数据(流量分析纯日志模式)。。。

那可以做一个端口镜像的模式, actions 是无效的,只能打 log。等我先弄好日志模式搞吧

tobyxdd commented 6 months ago

利用两个网络接口,一个镜像一个发送rst等来实现阻断,不知道是否可行

这样最多可以实现 block,还是做不了 drop 和 modify

lengxu commented 6 months ago

因为目前是按 inline 部署在路由/交换机上设计的,这样才能实现拦截特定流/包。添加端口镜像的支持本身应该不难,但是现有的 block/drop/modify 这些 actions 就没法实现了。

在文档中查看到: 支持的 action allow: 放行连接,不再处理后续的包。 block: 阻断连接,不再处理后续的包。 drop: 对于 UDP,丢弃触发规则的包,但继续处理同一流中的后续包。对于 TCP,效果同 block。 modify: 对于 UDP,用指定的修改器修改触发规则的包,然后继续处理同一流中的后续包。对于 TCP,效果同 allow。

对于drop这个action TCP协议是否可以实现,丢弃触发规则的包,但会继续处理后续的包这个效果。