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

Credhub expires-within-days returns unexpected results #181

Open
3 tasks
benjaminguttmann-avtq opened this issue Mar 17, 2021 · 3 comments
Open
3 tasks

Comments

@benjaminguttmann-avtq
Copy link

benjaminguttmann-avtq commented Mar 17, 2021

What version of the credhub server you are using?

credhub --version
CLI Version: 2.9.0
Server Version: 2.9.0

What version of the credhub cli you are using?

credhub --version
CLI Version: 2.9.0
Server Version: 2.9.0

If you were attempting to accomplish a task, what was it you were attempting to do?

I was trying to receive a list certificates expiring within a configured number of days after we created new CA certificates with transitional flag=true.

credhub get -n <some_ca_cert> -k ca still shows the old CA because the transitional flag is configured for new CA.

curl 'https://example.com/api/v1/data?path=some-credential-path&expires-within-days=X'

does not show the expiring certs anymore even if the new CA is just transitional.

What did you expect to happen?

I would expect the endpoint to provide same information as the credhub get, which means if credhub get shows me the old CA value as current I would expect the expires-within-days to provide me a result that also takes the currently 'active' CA into account and not the new one.

What was the actual behavior?

After new CAs with transitional flag were created, the endpoint did not show any expiring certificates anymore.

I saw this note in the credhub api:

Note: If a certificate credential only has one version and it is marked as transitional the credential name will not be returned by this endpoint.

In our case we have 5 versions of the certificate including one version with transitional flag. So I would think we should receive the expiry information.

Please confirm where necessary:

  • I have included a log output
  • My log includes an error message
  • I have included steps for reproduction

If you are a PCF customer with an Operation Manager (PCF Ops Manager) please direct your questions to support (https://support.pivotal.io/)

@cf-gitbot
Copy link

We have created an issue in Pivotal Tracker to manage this:

https://www.pivotaltracker.com/story/show/177376438

The labels on this github issue will be updated when the story is started.

@bruce-ricard
Copy link
Contributor

Hi @benjaminguttmann-avtq , thank you for the report.

We wondering what curl 'https://example.com/api/v1/data?path=some-credential-path' returns in the case of that certificate that has been regenerated with the transitional=true flag. Does it return the old version or the newly regenerated one?

We understand that the UX is not ideal here, and if we had a lot of free time we would definitely work on improving it. The current state of this behavior is IMHO the following: The v1/data call with expires-within-days= is meant to inform the user of certificates that are about to expire. If a certificate is found with its latest version being transitional, CredHub is assuming that you are aware of that certificate because you appear to have started a rotation, and is hence not going to return it to you.

Did you happen to miss a certificate rotation because for some reason some certificate was marked as transitional and hence not returned by the API?

@staylor14 and I

@benjaminguttmann-avtq
Copy link
Author

benjaminguttmann-avtq commented Mar 24, 2021

We wondering what curl 'https://example.com/api/v1/data?path=some-credential-path' returns in the case of that certificate that has been regenerated with the transitional=true flag. Does it return the old version or the newly regenerated one?

That actually returns the old version without transitional=true.

Did you happen to miss a certificate rotation because for some reason some certificate was marked as transitional and hence not returned by the API?

Kind of, we sometimes split up the different steps of a rotation to be done with a stemcell update and we missed one of the steps because our safety net (the monitoring of expiring certs) was just relying on the expires-within-days output.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

No branches or pull requests

3 participants