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

Exception when attempting to revoke expired deleted certificate #2901

Open
darkphoenix opened this issue Jan 30, 2025 · 0 comments
Open

Exception when attempting to revoke expired deleted certificate #2901

darkphoenix opened this issue Jan 30, 2025 · 0 comments
Labels

Comments

@darkphoenix
Copy link

Describe the Bug

When attempting to revoke a certificate that has previously been deleted, but is still present in the inventory, but has also since expired, the Puppetserver CA throws a FileNotFoundException.

Expected Behavior

Like in other cases where revoke is called for an already revoked or nonexistent certificate, it fails cleanly and returns a 404 to the API.

Steps to Reproduce

Steps to reproduce the behavior:

  1. Create and revoke a certificate with very short lifetime
puppetserver ca generate --certname manually-deleted.test.invalid --ttl 60s
puppetserver ca clean --certname=manually-deleted.test.invalid
  1. wait for the 60s to run out if they haven't already
  2. attempt to revoke the certificate again
$ puppetserver ca revoke --certname=manually-deleted.test.invalid
Error:
    When attempting to revoke certificate 'manually-deleted.test.invalid', received:
      code: 500
      body: Internal Server Error: java.io.FileNotFoundException: /etc/puppetlabs/puppetserver/ca/signed/manually-deleted.test.invalid.pem (No such file or directory)

Environment

  • Version: 8.7.0
  • Platform: Debian 11

Additional Context

This appears to be because the Puppetserver CA code first attempts to find the certificate serial number in the inventory, but skips expired entries in that case, and then if it finds nothing falls through to searching the filesystem. For some reason, this error is caught cleanly when the certificate has never existed, and obviously the certificate is just revoked again if it is correctly found in the inventory. The issue only occurs when an expired entry exists in the inventory, but the file has been removed.

The Foreman plugin for Puppet always attempts to revoke and delete any previous certificates with the same hostname, which is usually a safe operation to perform on a nonexistent certificate. In this case, the exception causes the VM creation to fail.

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

No branches or pull requests

1 participant