Skip to content

fix(openvpn): revoke road warrior certificates - #1961

Draft
gsanchietti wants to merge 3 commits into
mainfrom
improve_openvpn
Draft

gsanchietti wants to merge 3 commits into
mainfrom
improve_openvpn

Conversation

@gsanchietti

@gsanchietti gsanchietti commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

This PR fixes the following issues:

  • Regenerating a Road Warrior certificate did not revoke the old one, so old configurations kept connecting
  • Deleting a user revoked only the latest certificate, so older ones worked again once the user was added back
  • With certificate plus password or OTP (one-time password), one user's certificate could be used with another user's credentials

Changes:

  • Added revoke_stale_certificates() and generate_crl() to nethsec.ovpn: they revoke every valid certificate not saved inside pki/issued and update the CRL (certificate revocation list), with unit tests
  • Regenerate and delete now use them and close the user connection; regeneration keeps the current certificate if the new one can't be created
  • Added a check to the connect script: the certificate CN must match the user name
  • Documented that certificates migrated from NethServer 7 can't be revoked

Existing installations

Old certificates left valid by previous releases are not revoked on upgrade. To invalidate them, use "Regenerate all certificates" on the Road Warrior server (ns.ovpnrw regenerate-all-certificates): it creates a new CA, server and user certificates, so the new configuration must be distributed to all clients.

How to test

  1. Create a Road Warrior server with "username, password and certificate" mode, add a user and download its configuration
  2. Regenerate the certificate: the old configuration is rejected, the new one connects
  3. Delete the user and add it back: all old configurations are rejected
  4. Use one user's configuration with another user's password: rejected

Closes #1963


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

@gsanchietti gsanchietti self-assigned this Oct 23, 2026
@gsanchietti
gsanchietti force-pushed the improve_openvpn branch 2 times, most recently from 2a1dbb3 to 54764fc Compare October 23, 2026 07:17
Comment thread packages/ns-api/files/ns.ovpnrw Outdated
Regenerating a road warrior certificate did not revoke the old one.
Deleting a user revoked only the latest certificate, so older ones
worked again once the user was added back.

Revoke all valid certificates not saved inside the issued directory
and update the CRL. Regeneration keeps the current certificate if the
new one can't be created. Both actions close the user connection.

Assisted-by: Claude Code:Opus 5.5
With certificate and credentials, a certificate issued to one user
could be used with the credentials of another user. Reject the
connection if the certificate CN doesn't match the user name.

Assisted-by: Claude Code:Opus 5.5
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.

OpenVPN Road Warrior: old client certificates are not revoked

1 participant