Skip to content

fix: migrate VPN backend disable logic from network-manager-integration-plugins - #641

Merged
caixr23 merged 1 commit into
linuxdeepin:masterfrom
caixr23:master
Oct 15, 2026
Merged

caixr23 merged 1 commit into
linuxdeepin:masterfrom
caixr23:master

Conversation

@caixr23

@caixr23 caixr23 commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

The postinst from network-manager-integration-plugins (0.0.5-0deepin) was not migrated when its dependency was replaced with direct NM plugin deps in 581b0c6, leaving ipsec/xl2tpd/openvpn init.d services enabled on fresh installs.

fix: 迁移 network-manager-integration-plugins 的 VPN 后端禁用逻辑

581b0c6 移除 network-manager-integration-plugins 依赖时未迁移其 postinst 的 VPN 后端禁用逻辑,导致 ipsec/xl2tpd/openvpn 的 init.d 服务保持启用。 本提交将 postinst 原样迁移到 dcc-network-plugin,安装时自动禁用这三个服务。

Log: 迁移 VPN 后端禁用逻辑到 dcc-network-plugin
PMS: BUG-379501
Influence: 安装 dcc-network-plugin 后首次配置会禁用 ipsec/xl2tpd/openvpn 的 init.d 服务,由 NetworkManager 统一管理 VPN 后端,避免重复自启。

Summary by Sourcery

Bug Fixes:

  • Disable the ipsec, xl2tpd, and openvpn init.d services when dcc-network-plugin is installed so NetworkManager exclusively manages VPN backends.

@sourcery-ai

sourcery-ai Bot commented Oct 15, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

The PR restores the VPN backend service-disable logic lost when the dependency was replaced, by adding a dcc-network-plugin post-install script that disables ipsec, xl2tpd, and openvpn on installation.

File-Level Changes

Change Details Files
Add a package post-install script to disable legacy VPN backend services after installation.
  • Migrates the former dependency package’s post-install behavior into the direct NetworkManager plugin package.
  • Disables the ipsec, xl2tpd, and openvpn init.d services so NetworkManager remains the sole VPN service manager.
debian/dcc-network-plugin.postinst

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

@caixr23
caixr23 requested a review from mhduiy October 15, 2026 06:14
Comment thread debian/dcc-network-plugin.postinst Outdated
…on-plugins

The postinst from network-manager-integration-plugins (0.0.5-0deepin) was
not migrated when its dependency was replaced with direct NM plugin deps
in 581b0c6, leaving ipsec/xl2tpd/openvpn init.d services enabled on
fresh installs.

fix: 迁移 network-manager-integration-plugins 的 VPN 后端禁用逻辑

581b0c6 移除 network-manager-integration-plugins 依赖时未迁移其 postinst
的 VPN 后端禁用逻辑,导致 ipsec/xl2tpd/openvpn 的 init.d 服务保持启用。
本提交将 postinst 原样迁移到 dcc-network-plugin,安装时自动禁用这三个服务。

Log: 迁移 VPN 后端禁用逻辑到 dcc-network-plugin
PMS: BUG-379501
Influence: 安装 dcc-network-plugin 后首次配置会禁用 ipsec/xl2tpd/openvpn
的 init.d 服务,由 NetworkManager 统一管理 VPN 后端,避免重复自启。
@deepin-ci-robot

Copy link
Copy Markdown

deepin pr auto review

🤖 AI 代码审查报告

总体评分: 98 分 (通过阈值: 70分)

Pass


📊 总体评价

项目 结果
审查结论 代码审查通过
评分详情 代码安全维度无安全漏洞,语法逻辑、代码质量、代码性能三个维度均通过。代码实现了从 network-manager-integration-plugins 迁移 VPN 后端禁用逻辑到 dcc-network-plugin 的目的,使用标记文件确保幂等性,逻辑清晰,实现合理。仅有轻微的注释语法和代码风格问题,不影响功能。
PR 信息 fix: migrate VPN backend disable logic from network-manager-integration-plugins
作者 caixr23
修改文件 debian/dcc-network-plugin.postinst (新增文件)
分析模式 全量分析

🔍 详细分析

1. 语法逻辑 ✅

评分: 25/25 分 ✓
评价: 语法正确,逻辑清晰

分析:

  • #!/bin/sh shebang 正确,适用于 Debian postinst 脚本
  • if [ ! -e /var/cache/deepin/mark-setup-network-services ];then 条件判断语法正确
  • update-rc.d ... disable || true 正确使用 || true 防止包安装失败
  • mkdir -p 在 touch 之前调用,确保目录存在,顺序正确
  • #DEBHELPER# 为正确的 debhelper 占位符
  • exit 0 对 postinst 脚本正确
  • 标记文件机制确保幂等性(仅首次安装时执行)
  • 逻辑流程清晰:检查标记 → 禁用服务 → 创建标记

潜在问题:
✅ 未发现明显问题


2. 代码质量 ✅

评分: 23/25 分 ✓
评价: 代码结构清晰,注释完整

分析:

  • 注释存在,说明了脚本目的("Disable the network manager plugin backend service")
  • 代码结构简单清晰,适合 postinst 脚本场景
  • 三行 update-rc.d 命令模式一致,对于简单脚本无需抽象
  • 无残留调试代码,无敏感信息

潜在问题:

  1. debian/dcc-network-plugin.postinst 第10行:注释 "NetworkManager will start service automatic" 语法有误,"automatic" 应为 "automatically",属于轻微语法问题
  2. debian/dcc-network-plugin.postinst 第11行:代码风格问题,];then 中分号与 then 之间缺少空格,约定俗成的写法为 ]; then

建议:

  • 建议在注释中补充说明为何需要禁用这三个特定服务(ipsec/xl2tpd/openvpn),以及 NetworkManager 统一管理 VPN 后端的原因
  • 建议修正注释语法和代码风格

3. 代码性能 ✅

评分: 20/20 分 ✓
评价: 性能良好,资源使用合理

分析:

  • 脚本简单高效,仅包含少量系统命令
  • mkdir -p 是幂等操作,高效且安全
  • update-rc.d 为标准系统命令,每个服务仅调用一次
  • 无不必要的操作,无资源泄漏风险

潜在问题:
✅ 未发现明显问题


4. 代码安全 🔒

评分: 30/30 分 ✓
评价: 存在0个安全漏洞

分析:

  • 无用户输入处理,不存在命令注入风险
  • 路径 /var/cache/deepin/mark-setup-network-services 为固定路径,不存在路径遍历风险
  • 无硬编码密钥、凭证或敏感信息
  • 脚本在包安装时以 root 权限运行,创建的文件默认为 root 所有
  • 禁用 VPN 服务(ipsec/xl2tpd/openvpn)是预期的安全行为,由 NetworkManager 统一管理
  • || true 防止安装失败但不掩盖安全问题
  • 标记文件机制确保一次性执行,避免重复操作

安全漏洞详情:
✅ 未发现安全漏洞

漏洞对比统计: 新增漏洞 0 个,减少漏洞 0 个,持平 0 个

建议:
✅ 无安全建议


💡 改进建议代码示例

#!/bin/sh

# Disable the network manager plugin backend service.
# NetworkManager will start service automatically.
# Disable ipsec/xl2tpd/openvpn init.d services to avoid duplicate startup,
# as NetworkManager manages VPN backends centrally.
if [ ! -e /var/cache/deepin/mark-setup-network-services ]; then
    update-rc.d ipsec disable || true
    update-rc.d xl2tpd disable || true
    update-rc.d openvpn disable || true
    mkdir -p /var/cache/deepin
    touch /var/cache/deepin/mark-setup-network-services
fi

#DEBHELPER#

exit 0

📋 审查清单

维度 评分 通过 评价
语法逻辑 25/25 ✓ 语法正确,逻辑清晰
代码质量 23/25 ✓ 代码结构清晰,注释完整
代码性能 20/20 ✓ 性能良好,资源使用合理
代码安全 30/30 ✓ 存在0个安全漏洞
总分 98/100 ✓ 优秀

本报告由 AI 代码审查工具自动生成
项目: linuxdeepin/dde-network-core | PR: #641 | 分析模式: 全量分析

@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: caixr23, mhduiy

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

Details 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

@caixr23
caixr23 merged commit ab02e23 into linuxdeepin:master Oct 15, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants