openwisp-controller icon indicating copy to clipboard operation
openwisp-controller copied to clipboard

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

Open Ady0333 opened this issue 9 months ago • 3 comments

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

Ady0333 avatar Feb 13 '26 12:02 Ady0333

@Ady0333 did you run the celery worker in a separate terminal?

pandafy avatar Jul 02 '26 12:07 pandafy

@Ady0333 did you install the Wireguard automation as the docs suggests? That is, with: https://github.com/openwisp/ansible-wireguard-openwisp ? Do you have any log to share?

nemesifier avatar Jul 02 '26 12:07 nemesifier

@pandafy @nemesifier I couldn't reproduce the bug.

CodingWithSaksham avatar Jul 02 '26 15:07 CodingWithSaksham