Skip to content
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

update logic for cert and key #98

Merged
merged 5 commits into from
May 20, 2020
Merged

update logic for cert and key #98

merged 5 commits into from
May 20, 2020

Conversation

aramase
Copy link
Member

@aramase aramase commented May 13, 2020

What this PR does / why we need it:

  • Changes the default behavior for cert
    • When an object of type cert is provided, only the certificate in PEM format is written to the file.
    • When an object of type secret is provided, the certificate and private in PEM format are written to the file.
    • When an object of type key is provided, only the public key in PEM format is written to the file.

This is similar to the behavior currently support with az keyvault <secret | certificate> download

Commands used to generate EC cerfificate

openssl ecparam -name prime256v1 -out contoso.com.prime256v1.param.pem
openssl ecparam -in contoso.com.prime256v1.param.pem -text -noout

openssl req -new -x509 -sha256 -newkey ec:contoso.com.prime256v1.param.pem -nodes -keyout contoso.com.prime256v1.key.pem -days 365 -out contoso.com.prime256v1.cert.pem
openssl x509 -in contoso.com.prime256v1.cert.pem -text -noout

openssl pkcs12 -export -keysig -out contoso.com.prime256v1.cert.pfx -inkey contoso.com.prime256v1.key.pem -in contoso.com.prime256v1.cert.pem

Which issue(s) this PR fixes (optional, using fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when the PR gets merged):
Fixes #

Special notes for your reviewer:

pkg/azure/provider.go Outdated Show resolved Hide resolved
pkg/azure/provider.go Outdated Show resolved Hide resolved
err := errors.Errorf("cert key is not exportable")
return "", wrapObjectTypeError(err, objectType, objectName, objectVersion)
}
secretBundle, err := kvClient.GetSecret(ctx, *vaultURL, objectName, objectVersion)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NOTE: The sync k8s secrets logic in the csi driver will need to be updated to look for the private key from the secret instead of the cert. This is not backward compatible. We should make a note of this in the readme and the release note after we cut a new release from both repos.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There wouldn't be a change in logic, right? Instead of the object type being cert, the user would need to change object type to secret to get both the private key and certificate? https://github.com/kubernetes-sigs/secrets-store-csi-driver/blob/master/sample/ingress-controller-tls/secretproviderclass-azure-tls.yaml#L21-L22

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Opened an issue to track that - #106

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea you are right. I thought there was an e2e that tests this logic which would need to be updated, but I guess not. We should add one :)

Copy link
Member

@ritazh ritazh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@aramase aramase merged commit 3795264 into Azure:master May 20, 2020
@aramase aramase deleted the ec branch May 20, 2020 16:45
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.

None yet

2 participants