ECA-15056: Database Maintenance Worker: Add cert-deletion-mode radio (Delete-Expired / Delete-Revoked / None) + ARCHIVED-status fix#1054
Open
John-D-B wants to merge 1 commit into
Conversation
The worker could delete expired certificates but had no path to bulk-delete revoked-but-unexpired ones. Under a single-active-certificate constraint, cert-manager-style renewals revoke each predecessor (SUPERSEDED) without expiring it, so revoked rows accumulate with no scheduled cleanup. Adds a mutually-exclusive cert-deletion mode (NONE / EXPIRED / REVOKED) with a revocation-reason filter and an independent revoke-delay, plus CertificateStoreSession primitives that delete by an AND-composition of criteria. Existing deleteExpiredCertificates configs migrate to the new mode for backward compatibility. Admin-GUI service form refactored to radio buttons. Ref: ECA-15056 (Keyfactor support #172467)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request: Fix 27: DBMS Reaper for Revoked Certificates
Target title:
ECA-15056: Database Maintenance Worker:
Add cert-deletion-mode radio (Delete-Expired / Delete-Revoked / None) + ARCHIVED-status fix
Author: JohnB, with AI pair-programming support by Anthropic Claude Code (Opus, 1M-context)
Target branch:
mainSource branch:
fix-27-dbms-worker-revoked-reaperSummary
Restructure the Database Maintenance Worker's cert-side cleanup around
a radio-button selection of three mutually-exclusive deletion modes.
This matches the three lifecycle buckets that cert-manager-style churn produces,
and that operators reason about directly:
MODE_EXPIRED (default operational mode):
Reaps any certificate past
its
notAfterregardless of revocation status. JPQL:expireDate < now − delayAfterExpiration.Catches the
E(naturally expired) andR(revoked-and-expired) lifecycle buckets.MODE_REVOKED (cleanup mode for accumulated revoked-by-reason zombies):
Reaps any certificate whose
revocationReasonis in theoperator-selected set, regardless of expiry. JPQL:
status IN (REVOKED, ARCHIVED) AND revocationReason IN :reasons AND revocationDate < now − delayAfterRevocationCatches the
r(revoked-but-not-yet-expired) andR(revoked-and-expired, including the archivedstatus=60substate) lifecycle buckets.MODE_NONE (safety default for fresh workers):
No certificate deletion; only the independent CRL-side reaper runs if its checkbox is ticked.
FYI: ELT status codes
The widened
status IN (REVOKED, ARCHIVED)filter in MODE_REVOKED isthe critical design fix vs the original
status = REVOKEDformulation:EJBCA's post-expiry housekeeping transitions revoked-and-expired rows
from
status=40tostatus=60(ARCHIVED) over time, and the originalfilter silently excluded them — leaving operators with a real
accumulation of unsweepable rows on long-running stacks.
The CRL-side sweep (Match expired CRLs) remains a separate, independent
sweep over
CRLData— orthogonal to the cert-deletion mode radio.The cert-deletion mode didn't exist as a configurable option in CE
before this PR. Pre-PR, the admin-GUI form, the Type bean, and the
constants were present for the older
deleteExpiredCertificatescheckbox, but no worker class implemented them, so configuring the
worker raised
ClassNotFoundExceptionat runtime. This PR ships thefirst working
DatabaseMaintenanceWorker.javain CE history andrestructures the existing GUI around the radio-mode design.
Layout of the refactored admin-GUI form:
https://github.com/John-D-B/Claudes/blob/main/2026-06-01.EJBCA-tools/ejbca-ce/Docs/fix27-gui-mockup.png
Backward compatibility for pre-radio configurations (EE installs with
deleteExpiredCertificates=truein their property bag) is preservedvia a legacy-fallback in the bean: if
certDeletionModeis absent, themode is derived from the legacy booleans (
deleteExpiredCertificates=true→ MODE_EXPIRED;
deleteRevokedCertificates=true→ MODE_REVOKED). Goingforward,
certDeletionModeis the source of truth.This is the foundation PR for ticket #172467 / engineering reference
ECA-15056 (already accepted by Keyfactor engineering 25 May 2026, per
the ticket "solved" / "tracked through engineering" status). A
follow-up PR (Fix 26) builds an on-demand REST equivalent
(
DELETE /v1/certificate/{issuer_dn}/{serial}) on top of the EJBprimitive added here. The two PRs together fulfil the (a) and (b) parts
of the original ticket request.
External references
The "Fix-26" and "Fix-27" terms come from earlier work with JohnB's EJBCA Lifecycle Tool (ELT):
A user-visible demonstration of PKI workflow for this pull request is in JohnB's repository:
A PowerPoint overview is here: