openwisp / openwisp/openwisp-controller

[bug]: VPN peers not removed when VPN template is detached from device

Open
#1,221 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
773
Forks
315
Avg merge
2d 16h
Merged PRs (30d)
14

Description

Describe the bug

When a VPN template is removed from a device configuration, the device is not removed from the VPN server’s peer list (e.g. WireGuard/OpenVPN).

Although the related VpnClient record is deleted from the database, the VPN server configuration is not updated, leaving the peer active.


Steps To Reproduce

  1. Create or edit a device and attach a VPN template.
  2. Save the device and verify that the device appears in the VPN server peer list (via the VPN server preview).
  3. Edit the same device and remove the VPN template.
  4. Save the device.

Expected behavior

Removing a VPN template from a device should immediately revoke the device’s VPN access and remove its peer entry from the VPN server configuration.


Actual behavior

The peer remains present on the VPN server until the peer cache expires or the server is restarted, even though the VpnClient database record has been removed.


Screenshots

Not applicable.


System Information:

  • OS: Ubuntu (WSL)
  • Python Version: 3.x
  • Django Version: 4.x
  • OpenWISP Controller: current master
  • VPN Backend: WireGuard

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the VpnClient deletion path triggered when a VPN template is detached from a device, then inspect how the VPN server preview obtains its peer list. Reproduce the save flow with a WireGuard-backed device and verify that removing the template also removes the peer from the generated server configuration.

Written by the indexing model from the issue text.

Assessment

Tech stack
django, python
Domain
backend, networking
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.