← 输入框|github.com|刷新
Skip to content

Remote access VPN users are disconnected on every LB, ACL, port forward or firewall change (xl2tpd restarted on every iptables pass) #14545

Open

Description

@willbennett-devops

problem

Since 4.22.1.0, every remote access VPN (L2TP/IPsec) client on a router is disconnected whenever an unrelated rule
changes on that router: creating or deleting an LB rule, an ACL rule, a port forward, a firewall rule, a static NAT or
a site-to-site VPN. The client has to reconnect each time. Some clients (macOS) don't reconnect on their own.

cloud.log on the router shows xl2tpd being restarted on every one of those passes, although none of the L2TP files
changed except the secrets file, which was rewritten with the same content:

Nothing to commit. The /etc/ipsec.d/l2tp.conf file did not change
Wrote edited file /etc/ipsec.d/ipsec.any.secrets
Nothing to commit. The /etc/xl2tpd/xl2tpd.conf file did not change
Nothing to commit. The /etc/ppp/options.xl2tpd file did not change
Executing: ipsec update
Executing: systemctl restart xl2tpd
Executing: ipsec rereadsecrets

Root cause, line numbers from the 4.22 branch (56306ab), same code in 4.23.0.0 and main:

  • systemvm/debian/opt/cloud/bin/configure.py:1277, in configure_l2tpIpsec(): secret.empty() before
    secret.addeq(": PSK ...") and secret.commit().
  • systemvm/debian/opt/cloud/bin/cs/CsFile.py:51-53: empty() clears both config (the copy read from disk) and
    new_config. is_changed() (CsFile.py:42-46) compares the two, so after empty() the file always reads as
    changed and commit() always returns True.
  • configure.py:1247-1250: since Restart xl2tpd service when the VPN configuration is modified #12422 (the fix for VPN setting changes are not propagated to the Virtual Router #12195), a changed config means systemctl restart xl2tpd
    instead of systemctl start xl2tpd. Restarting xl2tpd kills every pppd session.
  • CsRemoteAccessVpn.process() runs from IpTablesExecutor.process() (configure.py:1615-1616), which runs for every
    data bag with process_iptables: True (configure.py:1673-1690), not only for VPN changes.

Before #12422 the same pass ran systemctl start xl2tpd, a no-op on a running service, so the always-changed secrets
file did no harm.

Impact: on 4.22.1.0 and later, any router with a remote access VPN drops all its VPN users on any rule change in the
network or VPC. With CKS, the cloud controller manager's LB and ACL reconciles trigger it too.

versions

4.22.1.0, 4.22.1.1 and 4.23.0.0 (any version containing #12422). Seen on 4.23.0.0 with KVM, VPC with redundant
routers, advanced networking. Not specific to the hypervisor.

The steps to reproduce the bug

  1. Create a VPC, enable remote access VPN on its source NAT IP and add a VPN user.
  2. Connect an L2TP/IPsec client and keep a ping running to a VM in a tier.
  3. Create (or delete) an LB rule, or add an ACL rule, in that VPC.
  4. The client's session drops. cloud.log on the router shows "Wrote edited file /etc/ipsec.d/ipsec.any.secrets"
    followed by systemctl restart xl2tpd.

What to do about it?

Use secret.repopulate() instead of secret.empty() in configure_l2tpIpsec(). repopulate() (CsFile.py:55-56)
clears only new_config and keeps the copy loaded from disk, so an unchanged PSK compares equal and xl2tpd is only
restarted when something really changed, which is what #12422 intended. A changed PSK still restarts it. PR to follow.

Activity

  1. github-actions commented on Nov 2, 2026

    @github-actions

    Warning

    threat detection engine error
    The threat detection engine encountered an error and could not complete analysis. This is a tooling failure, not a security finding.

    What happened

    The threat detection engine failed to produce results.

    Review the workflow run logs for details.

    🎯 Triage report

    Since 4.22.1.0, configure_l2tpIpsec() in the VR config empties the secrets file before rewriting it. CsFile.empty() clears the on-disk copy too, so the file always reads as changed. Combined with the restart-on-change logic from #12422, every iptables pass restarts xl2tpd and drops all VPN sessions. The reporter's proposed fix is to use secret.repopulate() instead of secret.empty(), which keeps the disk copy for comparison.

    📊 Assessment

    Dimension Value Reasoning
    Type type:bug Unintended disconnects after a change in 4.22.1+ (regression)
    Component component:virtual-router Bug is in configure.py / CsFile.py on the VR
    Severity Severity:Major All VPN users on the router drop on any rule change; no data loss reported
    Labels type:bug, component:virtual-router, component:vpc, Severity:Major
    Coding agent Suitable Specific root cause and one-line fix direction with line references; scope is self-contained

    🔗 Similar issues

    💡 Notes and suggestions
    • Reproduction: VPC with remote access VPN and a connected L2TP client; add or delete an LB or ACL rule and watch cloud.log on the VR for systemctl restart xl2tpd.
    • Verify that a changed PSK still restarts xl2tpd after the fix.
    • Probably worth a regression test in the VR config tests.

    Generated by Daily Issue Triage · copilot · haiku55 · ~2 AIC · ⊞ 3.8K · ◷

    Add this agentic workflow to your repo

    To install this agentic workflow, run

    gh aw add githubnext/agentics/workflows/daily-issue-triage.md@139fa09ef17cde4135e696ff8e7af09bc5ddfa6e
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions