fix(ns.ovpntunnel): enhance certificate extraction logic to support role labels#1533
Merged
fix(ns.ovpntunnel): enhance certificate extraction logic to support role labels#1533
Conversation
Tbaile
approved these changes
Feb 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request refactors how certificate roles are labeled and managed when extracting certificate information from PEM files in the
ns.ovpntunnelmodule. The changes improve clarity and consistency in how server, client, and CA certificates are labeled and handled, especially to manage case where the hostname is not arbitrary "NethSec".Certificate handling improvements:
get_certificates_from_pemfunction now accepts an optionalrole_labelparameter to explicitly assign a role label (e.g., 'server', 'client', 'CA') to extracted certificates, improving clarity and flexibility.role_labelis provided, it's used directly; otherwise, the label defaults to 'client' for client certificates and 'CA' for others, replacing the previous logic that mapped the CN 'NethSec' to 'CA'.Integration with VPN tunnel listing:
list_tunnelsfunction, certificate extraction now consistently uses the newrole_labelparameter to assign 'server', 'client', or 'CA' labels when updating the certificates dictionary for each VPN tunnel. This ensures the correct association of certificate roles in the output. In particular:server peer: userole_labelparameter to force certificate key on response payloadclient peer: useclientif CN is equal toclient,CAotherwise. In this case, the two certificates are contained inside the same file (/etc/openvpn/{instance}/pki/cert.pem).