Skip to content

fix: disable strongswan autostart in postinst - #647

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

caixr23 merged 1 commit into
linuxdeepin:masterfrom
caixr23:master

Conversation

@caixr23

@caixr23 caixr23 commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor
  1. Add systemctl disable strongswan to dcc-network-plugin.postinst, alongside the existing ipsec/xl2tpd/openvpn disables.
  2. strongSwan 6.x ships only a native systemd unit (strongswan.service), no LSB init script, so update-rc.d cannot handle it; use systemctl disable instead.
  3. The ipsec entry maps to /etc/init.d/ipsec from strongswan-starter, the legacy SysV stack; the strongswan metapackage instead installs the systemd stack (charon-systemd + strongswan-swanctl), so that entry is a no-op here. strongswan comes in via the network-manager-strongswan dependency, and its strongswan.service declares WantedBy=multi-user.target, so it autostarts once installed.

Log: unreviewed strongswan.service no longer autostarts (security baseline)

Influence:

  1. Fresh install: systemctl list-unit-files | grep strongswan shows disabled; strongswan.service must not autostart at boot.
  2. Upgrade existing install: postinst re-run emits no error and strongswan.service ends up disabled.
  3. IPsec VPN via NetworkManager still works (backend started on demand).

PMS: BUG-379501

fix: postinst 中禁用 strongswan 自启

  1. 在 dcc-network-plugin.postinst 中新增 systemctl disable strongswan, 与已有的 ipsec/xl2tpd/openvpn 禁用逻辑并列。
  2. strongSwan 6.x 仅提供原生 systemd 单元(strongswan.service),无 LSB init 脚本,update-rc.d 无法处理,需改用 systemctl disable。
  3. 上面的 ipsec 对应 strongswan-starter 提供的 /etc/init.d/ipsec,属传统 SysV 栈;而 strongswan 元包实际安装的是 systemd 栈(charon-systemd + strongswan-swanctl),故该条在此为空操作。strongswan 经 network-manager-strongswan 依赖引入,其 strongswan.service 声明 WantedBy=multi-user.target,安装即开机自启。

Log: 系统自启服务不再包含未经评审的 strongswan.service(安全基线)

Influence:

  1. 全新安装:systemctl list-unit-files | grep strongswan 应为 disabled, 开机不再自启 strongswan.service。
  2. 升级安装:重跑 postinst 无报错,strongswan.service 被禁用。
  3. 通过 NetworkManager 使用 IPsec VPN 仍正常(后端按需启动)。

PMS: BUG-379501

Summary by Sourcery

Bug Fixes:

  • Disable the strongSwan systemd service during package installation and upgrades to prevent unreviewed automatic startup.

1. Add `systemctl disable strongswan` to dcc-network-plugin.postinst,
   alongside the existing ipsec/xl2tpd/openvpn disables.
2. strongSwan 6.x ships only a native systemd unit (strongswan.service),
   no LSB init script, so update-rc.d cannot handle it; use systemctl
   disable instead.
3. The `ipsec` entry maps to /etc/init.d/ipsec from strongswan-starter, the
   legacy SysV stack; the `strongswan` metapackage instead installs the
   systemd stack (charon-systemd + strongswan-swanctl), so that entry is a
   no-op here. strongswan comes in via the network-manager-strongswan
   dependency, and its strongswan.service declares
   WantedBy=multi-user.target, so it autostarts once installed.

Log: unreviewed strongswan.service no longer autostarts (security baseline)

Influence:
1. Fresh install: `systemctl list-unit-files | grep strongswan` shows
   disabled; strongswan.service must not autostart at boot.
2. Upgrade existing install: postinst re-run emits no error and
   strongswan.service ends up disabled.
3. IPsec VPN via NetworkManager still works (backend started on demand).

PMS: BUG-379501

fix: postinst 中禁用 strongswan 自启

1. 在 dcc-network-plugin.postinst 中新增 `systemctl disable strongswan`,
   与已有的 ipsec/xl2tpd/openvpn 禁用逻辑并列。
2. strongSwan 6.x 仅提供原生 systemd 单元(strongswan.service),无 LSB
   init 脚本,update-rc.d 无法处理,需改用 systemctl disable。
3. 上面的 `ipsec` 对应 strongswan-starter 提供的 /etc/init.d/ipsec,属传统
   SysV 栈;而 `strongswan` 元包实际安装的是 systemd 栈(charon-systemd +
   strongswan-swanctl),故该条在此为空操作。strongswan 经
   network-manager-strongswan 依赖引入,其 strongswan.service 声明
   WantedBy=multi-user.target,安装即开机自启。

Log: 系统自启服务不再包含未经评审的 strongswan.service(安全基线)

Influence:
1. 全新安装:`systemctl list-unit-files | grep strongswan` 应为 disabled,
   开机不再自启 strongswan.service。
2. 升级安装:重跑 postinst 无报错,strongswan.service 被禁用。
3. 通过 NetworkManager 使用 IPsec VPN 仍正常(后端按需启动)。

PMS: BUG-379501
@sourcery-ai

sourcery-ai Bot commented Oct 21, 2026

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

Reviewer's Guide

Updates the post-installation script to disable strongswan.service, preventing the unreviewed systemd-based strongSwan backend from autostarting while retaining NetworkManager-driven IPsec VPN support.

File-Level Changes

Change Details Files
Disable the native strongSwan systemd service during package installation and upgrades.
  • Add systemctl disable strongswan alongside the existing VPN service-disable commands.
  • Use systemd-specific disabling because the strongSwan 6.x package provides strongswan.service without a SysV init script.
  • Preserve on-demand NetworkManager IPsec functionality while preventing boot-time autostart.
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 ✨

@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 ece8022 into linuxdeepin:master Oct 21, 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