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

Named cert import states that the cert already exists instead of importing the updated cert #22

Open
clintsimmons opened this issue Jan 9, 2024 · 2 comments
Assignees
Labels
bug Something isn't working investigation

Comments

@clintsimmons
Copy link

Running this: New-Pfa2Certificate -Certificate $cert1 -IntermediateCertificate $cert2 -Key $key -Passphrase $pp --Name management
results in error:
New-Pfa2Certificate: Certificate exists (), https://arrayname/api/2.17/certificates?names=management (POST)
Expected result: new CA certificate imports and overwrites existing CA certificate (both for updating old cert or moving from self-signed to CA signed).

Also, if attempting to update without using the name parameter it does not tell you which parameter is missing:
New-Pfa2Certificate: Missing or invalid parameter. (), https://arrayname/api/2.17/certificates (POST)
Expected result: Error plus listing the parameter that was expected.

Utilizing CLI method directly works, although cannot use it via the SDK2 since it is interactive:
@purearray> purecert setattr management --certificate --intermediate-certificate --key --passphrase

@clintsimmons
Copy link
Author

Forgot to add, using the PATCH method (Update-Pfa2Certificate) -
Update-Pfa2Certificate -Certificate $cert1 -Key $keycert1 -IntermediateCertificate $intcert1
-Passphrase $pp -Name management -Verbose
Produces "Update-Pfa2Certificate: Failed to load the private key.
(), https://arrayname/api/2.17/certificates?names=management (PATCH)"

Verbose:
VERBOSE: PureStorage.Rest Verbose: 13 : 2024-01-09T20:17:43.7583398Z Error: Exception "PureRestException: HttpStatusCode = 'BadRequest', RestErrorCode = 'InternalError', Details = '[{"context":null,"message":"Failed to load the private key.\n"},{"context":"PATCH","message":"https://arrayname/api/2.17/certificates?names=management"}]', InnerException = ''", StackTrace=
at PureStorage.FlashArray.Rest.Api.CertificatesApi.Api224CertificatesPatchWithHttpInfo(CertificatePost certificate, String authorization, String xRequestID, List1 names, Nullable1 generateNewKey, String apiVersion)
at PureStorage.FlashArray.Rest.Rest2Api.<>c__DisplayClass132_0.<Patch_Certificates>b__0()
at PureStorage.Rest.PureClient.DoRetries[T](String method, String path, String apiVersion, Func`1 retriable)

VERBOSE: PureStorage.Rest Error: 12 : 2024-01-09T20:17:43.7586037Z '"PureRestException: HttpStatusCode = 'BadRequest', RestErrorCode = 'InternalError', Details = '[{"context":null,"message":"Failed to load the private key.\n"},{"context":"PATCH","message":"https://arrayname/api/2.17/certificates?names=management"}]', InnerException = ''"'

VERBOSE: PureStorage.Rest Verbose: 13 : 2024-01-09T20:17:43.7587721Z Parameter: HttpHeader:x-auth-token=ff8fbb15-3ab8-4d9d-ac12-dd04b315010d

VERBOSE: PureStorage.Rest Verbose: 13 : 2024-01-09T20:17:43.7589009Z Parameter: HttpHeader:Accept=application/json

VERBOSE: PureStorage.Rest Verbose: 13 : 2024-01-09T20:17:43.7590447Z Parameter: QueryString:names=management

@mikenelson-io
Copy link
Collaborator

From engineering-

The expected behavior for New-Pfa2Certificate when the cert already exists is to return an error. It is working as wexpected.

However, for Update-Pfa2Certificates, it would be nice if the error message has more details on what parameters are missing.

This is an issue that is being tracked internally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working investigation
Projects
None yet
Development

No branches or pull requests

3 participants