feat: add port security awareness panel to firewall page#12704
feat: add port security awareness panel to firewall page#12704zhangt2333 wants to merge 2 commits into1Panel-dev:dev-v2from
Conversation
|
Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
对firewalld 和 ufw 做适配测试了么 |
|
docker network bind 可以做的很复杂,这里也没有做复杂状态下判断 |
|
想法不错,但是建议多打磨打磨(你目前应该是在用的 ChatGPT codex,可以让他再多看看...) |
|
感谢贡献,这个方向是有价值的,Docker 端口映射绕过常规 INPUT 链规则确实容易让用户误判端口暴露状态。 不过当前实现暂不建议合并。主要原因是扫描逻辑还不够准确:Docker 发布端口不一定会表现为宿主机监听 socket,当前以监听端口为主数据源可能漏掉真正需要提示的 Docker 暴露端口;同时对绑定地址、防火墙规则、firewalld / ufw 以及复杂 Docker network bind 场景的判断还比较粗,可能给用户“已保护/安全”的错误结论。 建议继续打磨后再提交,至少需要补充 firewalld、ufw、iptables 以及不同 Docker 端口绑定方式下的验证,并调整判断逻辑和文案,避免安全状态误判。 |
|
@HynoR @wanghe-fit2cloud Thank you very much for your valuable feedback. I'm currently continuing to work on this. I really need this feature and am strongly motivated to implement it well in 1Panel. Could you please re-open this PR? There's no need to open another PR — I will set the current one to draft status. I'll keep pushing updates and will notify you when it's ready. |
|
Nice direction — 18 linked issues over 3+ years show this is a real pain point. I think the framing in the PR description is the right one: a full fix would mean taking over Docker's default iptables rules (DOCKER / DOCKER-USER chain management, ufw-docker-style integration, etc.), and the compatibility surface there is genuinely large — stopped containers, user-defined networks, One consequence of that scoping: because this PR explicitly doesn't change any iptables rule, the classification output is the product. There's no enforcement backstop that catches a misclassification at runtime — whatever the panel says, the user believes. That raises the bar on accuracy more than it would for a typical feature. A few spots where I think the current classifier could mislead: 1.
|






Thanks for building 1Panel — I am a commercial license holder and use it daily.
What this PR does / why we need it?
While using the firewall module extensively, we discovered that Docker container port mappings bypass iptables INPUT chain rules, so ports that appear protected by the firewall may actually be publicly exposed. This issue has existed almost since 1Panel's initial release, spanning 3+ years (2023–2026) with 18 related community reports:
Fully solving the Docker bypass problem (e.g., managing
DOCKER-USERchain rules or integrating ufw-docker) would require significant changes to the firewall architecture. This PR takes a deliberate first step — giving users visibility into which ports are effectively protected and which are exposed through Docker. Once awareness is in place, further enforcement mechanisms can be built on top of it incrementally.Summary of your change
POST /hosts/firewall/port/security, admin-only) — concurrently scans listening ports, Docker container bindings, and firewall rules to classify each port's effective security statusfirewall/port/awareness/index.vue) above the existing rules tableport/index.vueis modified in existing code to import and render the new panel; the rest is additiveScreenshots:
Please indicate you've done the following: