New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: allow parsing of certificate chains and password-less certificates #5125
fix: allow parsing of certificate chains and password-less certificates #5125
Conversation
Welcome @handsomejack-42! |
Hi @handsomejack-42. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
7ff2eff
to
9fc95d0
Compare
When parsing the config into credential providers in NewAuthProvider, the only way to trigger the certificate credential path is to have password protected certificate. Certificates can exist without password protection. Remove this condition to enable even password-less certificates. Signed-off-by: HandsomeJack <dusek.honza@gmail.com>
azidentity.ParseCertificates The `decodePksc12` function fails to parse my PKCS12 certificate chain with the message ``` decoding the client certificate: decoding the PKCS#12 client certificate: pkcs12: expected exactly two safe bags in the PFX PDU ``` because, internally, it uses the pkcs12.Decode function, which expects only the key and a main cert, not a whole chain of certs. It is mentioned in the comment that > Since PKCS#12 files often contain more than one certificate, you probably want to use [DecodeChain] instead. The option is either switching to that `.DecodeChain` function, or, there is a cert parser implemented in azidentity, that provides even more (PEM) parsing capabilities. I propose using the parsing function from `azidentity` instead, as that is the 'native' identity provider for azure anyway. Signed-off-by: HandsomeJack <dusek.honza@gmail.com>
9fc95d0
to
3cc2005
Compare
Thanks for the fix! |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: handsomejack-42, MartinForReal The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/ok-to-test |
sub 50m approve and merge, wow! kudos @MartinForReal |
What type of PR is this?
/kind bug
What this PR does / why we need it:
Certificate parsing function isn't capable of parsing certificate chains
The
decodePksc12
function fails to parse my PKCS12 certificate chain with the messagebecause, internally, it uses the pkcs12.Decode function, which expects only the key and a main cert, not a whole chain of certs. It is mentioned in the comment that
The option is either switching to that
.DecodeChain
function, or, there is a cert parser implemented in azidentity, that provides even more (PEM) parsing capabilities.I propose using the parsing function from
azidentity
instead, as that is the 'native' identity provider for azure anyway.Password-less certificates
When parsing the config into credential providers in
NewAuthProvider
, the only way to trigger the certificate credential path is to have password protected certificate. Certificates can exist without password protection.Remove this condition to allow even password-less certificates.
Which issue(s) this PR fixes:
x
Special notes for your reviewer:
x
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: