Add NX-API PKCS#12 workaround for certificate provisioning#382
Open
felix-kaestner wants to merge 5 commits into
Open
Add NX-API PKCS#12 workaround for certificate provisioning#382felix-kaestner wants to merge 5 commits into
felix-kaestner wants to merge 5 commits into
Conversation
96c2914 to
d83b434
Compare
d83b434 to
dc46084
Compare
f3082a9 to
7c35426
Compare
Signed-off-by: Felix Kästner <felix.kaestner@sap.com>
Signed-off-by: Felix Kästner <felix.kaestner@sap.com>
The Version type was a plain string, which meant comparisons like
VersionUnknown < VersionNX10_7_1 were lexicographic and incorrect
("Unknown" > "10.7(1)"). Switch to uint8 with iota so that
relational operators reflect actual release ordering.
Signed-off-by: Felix Kästner <felix.kaestner@sap.com>
Append the ca.crt field (if present) to the PEM block passed to tls.X509KeyPair so the resulting tls.Certificate contains the full chain (leaf + intermediates + root), not just the leaf. Signed-off-by: Felix Kästner <felix.kaestner@sap.com>
gNOI LoadCertificate on NX-OS < 10.7(1) does not support CA certificate chains and creates immutable KeyPair entries that block rotation. Work around both issues by importing a PKCS#12 bundle via NX-API CLI for versions below 10.7(1). The NX-API path encodes the certificate, chain, and private key into a PKCS#12 bundle (LegacyRC2 for NX-OS compatibility), writes it to bootflash in chunks via base64, and imports it with crypto ca import. Existing trustpoint and keypair are cleaned up via idempotent gNMI delete before each import. Also passes CA certificates to gNOI LoadCertificate for the >= 10.7(1) path so the full chain is available once that version ships with chain support. Signed-off-by: Felix Kästner <felix.kaestner@sap.com>
7c35426 to
b1f9e91
Compare
Merging this branch will decrease overall coverage
Coverage by fileChanged files (no unit tests)
Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code. |
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.
gNOI LoadCertificate on NX-OS does not support CA chains and creates immutable KeyPair entries that block rotation.
Work around both issues by encoding the certificate as PKCS#12 and importing it via NX-API CLI commands for older versions.
Also pass the CA chain to gNOI LoadCertificate for >= 10.7(1) which is expected to fix this issue (to be tested when released).
See #162