Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 端口转发功能 #5439

Merged
merged 2 commits into from
Jun 15, 2024
Merged

feat: 端口转发功能 #5439

merged 2 commits into from
Jun 15, 2024

Conversation

endymx
Copy link
Contributor

@endymx endymx commented Jun 13, 2024

What this PR does / why we need it?

  • 增加 ufw/firewalld 防火墙下对端口转发的支持(含前端页面)
  • 考虑到 ufw 本身转发会导致重启服务时多次添加相同规则(曾经使用宝塔遭遇过该问题)与实现难度,改为使用iptables实现转发

Summary of your change

@endymx

  • 后端api实现
  • 增加1panel启动时初始化端口转发规则:
    (ufw) 清空iptables nat表规则,根据数据库内规则reload
    (firewalld) 检测端口伪装并开启
  • ufw 下增删转发规则时,同步修改数据库
  • 测试功能在 Debian12 与 Centos7 下的可用性

@yawntee

  • 前端页面实现

@ExerciseBook

  • 需求跟进

Please indicate you've done the following:

  • Made sure tests are passing and test coverage is added if needed.
  • Made sure commit message follow the rule of Conventional Commits specification.
  • Considered the docs impact and opened a new docs issue or PR with docs changes if needed.

Copy link

f2c-ci-robot bot commented Jun 13, 2024

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.

Instructions 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/test-infra repository.

Copy link

f2c-ci-robot bot commented Jun 13, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign zhengkunwang223 for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@endymx endymx marked this pull request as draft June 13, 2024 04:37
@wanghe-fit2cloud
Copy link
Member

感谢支持。


const rules = reactive({
protocol: [Rules.requiredSelect],
port: [Rules.requiredInput],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

port 的规则可以直接用 Rules.port ,因为端口那边支持端口范围,所以没法直接用,这里可以用

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

考虑到之后会有范围端口转发的需求,还是采用原有方案

backend/router/ro_host.go Outdated Show resolved Hide resolved
@ssongliu
Copy link
Contributor

非常感谢代码贡献,有一点点地方可以优化一下。

refactor(forward): 优化前端代码
fix: 删除iptables规则时排序问题
fix: router注释遗漏
refactor(forward): 优化i18n描述
fix(forward): 修复参数校验
fix(forward): ip可空
fix: 删除debug部分

Co-authored-by: endymx <[email protected]>
Co-authored-by: yawntee <[email protected]>
@wanghe-fit2cloud wanghe-fit2cloud merged commit af0ecce into 1Panel-dev:dev Jun 15, 2024
1 check was pending
KaySar12 pushed a commit to KaySar12/1Panel that referenced this pull request Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants