Skip to content

fix(users): block deletion of users with VPN - #1968

Open
gsanchietti wants to merge 2 commits into
improve_openvpnfrom
vpn_user_delete
Open

gsanchietti wants to merge 2 commits into
improve_openvpnfrom
vpn_user_delete

Conversation

@gsanchietti

@gsanchietti gsanchietti commented Oct 26, 2026 •

Copy link
Copy Markdown
Member

Deleting a user from Users & Objects left their OpenVPN Road Warrior certificate valid. The certificate could work again if a user with the same name was created later. Found during the review of #1961, related to #1963.

A user with a Road Warrior account can no longer be deleted: the administrator must delete the VPN account first, and that step revokes the certificate. Certificates already left behind by older releases are revoked when a VPN account is added for a user with the same name. Before, that operation always failed with user_certificate_already_exists.

  • nethsec.users: delete_local_user() and delete_remote_user() return the new user_has_vpn_account validation error, with unit tests
  • ns.ovpnrw add-user: revokes a certificate left by a deleted user and generates a new one

This PR is based on #1961, which adds the certificate revocation code it uses: merge #1961 first.

How to test

  1. Create a Road Warrior server, add a local user and create their VPN account
  2. Delete the user from Users & Objects: the deletion is refused
  3. Delete the VPN account, then delete the user: both succeed
  4. To simulate a user deleted by an older release, remove only the user record (uci delete users.<id>; uci commit users), leaving the certificate. Create the user again and add the VPN account: it succeeds, the old configuration is rejected with certificate revoked, the new one connects

See also


Generated by Claude Code:claude-opus-5-5 with nethserver-pr

Deleting a user from the users database left its OpenVPN Road
Warrior certificate valid: it worked again if a user with the same
name was created later.

Refuse the deletion while the user has a Road Warrior account, so
the account must be removed first and the certificate revoked.

Assisted-by: Claude Code:Opus 5.5
Users deleted before the previous fix left a valid certificate
behind: adding a Road Warrior account for a new user with the same
name failed, and no action could revoke it.

When adding an account, revoke a certificate left by a deleted user
and generate a new one.

Assisted-by: Claude Code:Opus 5.5

This branch has not been deployed

No deployments
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.

1 participant