Skip to content

Implement Persistent, Auto-Renewing Local CA PKI - #64

Merged
tyronechrisharris merged 5 commits into
mainfrom
jules-persistent-ca-renewal-8825928146862250262
Mar 22, 2026
Merged

tyronechrisharris merged 5 commits into
mainfrom
jules-persistent-ca-renewal-8825928146862250262

Conversation

@tyronechrisharris

Copy link
Copy Markdown
Owner

This PR transitions the system from an ephemeral Root CA (where the private key was destroyed after leaf generation) to a Persistent Local CA architecture.

Key changes include:

  1. Refactored Utility: EphemeralCAUtility.java is now LocalCAUtility.java.
  2. Persistence: The Root CA private key is now securely stored in osh-keystore.p12 under the alias root-ca. It is encrypted using the auto-generated password in .app_secrets.
  3. Automated Renewal: SensorHubWrapper now calls LocalCAUtility.checkAndRenewCertificates() on every boot. If the jetty leaf certificate is within 30 days of expiration, it is automatically regenerated and signed by the persistent Root CA.
  4. Lifespan Changes: Root CA now has a 20-year lifespan to minimize manual trust-store updates for operators. Leaf certificates remain at 1 year.
  5. Centralized Management: Launch scripts no longer manually call the CA utility; all certificate lifecycle management is now handled within the Java application's startup sequence.
  6. Documentation: Architecture wikis have been updated to reflect the new persistent PKI and automated renewal logic as per AI_CONTRIBUTING_RULES.md.

Verification:

  • Added LocalCAUtilityTest.java to verify initial generation and lifespan logic.
  • Verified compilation and test pass via ./gradlew :security-utils:test.
  • Manual inspection of launch.sh and launch.bat confirm removal of obsolete generation steps.

Fixes #63


PR created automatically by Jules for task 8825928146862250262 started by @tyronechrisharris

- Rename EphemeralCAUtility to LocalCAUtility and implement persistent Root CA storage.
- Update LocalCAUtility to generate 20-year Root CA and 1-year Leaf certificate.
- Securely store Root Private Key in osh-keystore.p12 under 'root-ca' alias.
- Add checkAndRenewCertificates() to LocalCAUtility to automatically renew Leaf if it expires within 30 days.
- Integrate certificate renewal check into SensorHubWrapper startup sequence.
- Remove manual CA generation from launch.sh and launch.bat.
- Update SECURITY_ARCHITECTURE.md and SYSTEM_ARCHITECTURE.md to reflect new architecture.
- Add unit test for initial certificate generation in LocalCAUtilityTest.java.

Co-authored-by: tyronechrisharris <142608718+tyronechrisharris@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

google-labs-jules Bot and others added 4 commits March 22, 2026 13:09
…enewing Local CA

- Rename EphemeralCAUtility to LocalCAUtility and implement persistent Root CA storage.
- Update LocalCAUtility to generate 20-year Root CA and 1-year Leaf certificate.
- Securely store Root Private Key in osh-keystore.p12 under 'root-ca' alias.
- Add checkAndRenewCertificates() to LocalCAUtility to automatically renew Leaf if it expires within 30 days.
- Integrate certificate renewal check into SensorHubWrapper startup sequence with graceful fallback for missing secrets or Root keys.
- Remove manual CA generation from launch.sh and launch.bat.
- Update SECURITY_ARCHITECTURE.md and SYSTEM_ARCHITECTURE.md to reflect new architecture.
- Add unit test for initial certificate generation in LocalCAUtilityTest.java.

Co-authored-by: tyronechrisharris <142608718+tyronechrisharris@users.noreply.github.com>
- Transition from ephemeral to persistent Local CA architecture.
- Generate 20-year Root CA and 1-year Leaf certificate on first boot.
- Securely store Root Private Key in osh-keystore.p12 under 'root-ca' alias.
- Add automated 30-day leaf certificate renewal in SensorHubWrapper.
- Implement fail-secure startup: Remove all hardcoded password fallbacks ('atakatak', 'changeit').
- Update launch scripts (sh/bat) to halt with critical error if secrets are missing.
- Update SECURITY_ARCHITECTURE.md and SYSTEM_ARCHITECTURE.md.
- Add unit test for CA lifecycle management in LocalCAUtilityTest.java.

Co-authored-by: tyronechrisharris <142608718+tyronechrisharris@users.noreply.github.com>
- Transition from ephemeral to persistent Local CA architecture.
- Generate 20-year Root CA and 1-year Leaf certificate on first boot.
- Securely store Root Private Key in osh-keystore.p12 under 'root-ca' alias.
- Add automated 30-day leaf certificate renewal in SensorHubWrapper.
- Implement fail-secure startup: Remove all hardcoded password fallbacks ('atakatak', 'changeit').
- FIX FIRST-BOOT: Re-ordered launch scripts to run CA generation before password validation.
- FIX FIRST-BOOT: Use auto-generated secret for TRUSTSTORE_PASSWORD if not provided.
- FIX FIRST-BOOT: Deleted pre-existing dummy keystore from distribution template.
- Update SensorHubWrapper to load truststore password from .app_secrets.
- Update SECURITY_ARCHITECTURE.md and SYSTEM_ARCHITECTURE.md.
- Add unit test for CA lifecycle management in LocalCAUtilityTest.java.

Co-authored-by: tyronechrisharris <142608718+tyronechrisharris@users.noreply.github.com>
- Transition from ephemeral to persistent Local CA architecture.
- Generate 20-year Root CA and 1-year Leaf certificate on first boot.
- Securely store Root Private Key in osh-keystore.p12 under 'root-ca' alias.
- Add automated 30-day leaf certificate renewal in SensorHubWrapper.
- Implement fail-secure startup: Remove all hardcoded password fallbacks ('atakatak', 'changeit').
- FIX FIRST-BOOT: Re-ordered launch scripts to run CA generation before password validation.
- FIX FIRST-BOOT: Use auto-generated secret for TRUSTSTORE_PASSWORD if not provided.
- FIX FIRST-BOOT: Deleted pre-existing dummy keystore from distribution template.
- FIX DEPENDENCY CONFLICT: Removed legacy BouncyCastle JARs (bcprov-jdk14.jar) causing IncompatibleClassChangeError.
- Update SensorHubWrapper to load truststore password from .app_secrets.
- Update SECURITY_ARCHITECTURE.md and SYSTEM_ARCHITECTURE.md.
- Add unit test for CA lifecycle management in LocalCAUtilityTest.java.

Co-authored-by: tyronechrisharris <142608718+tyronechrisharris@users.noreply.github.com>
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.

Security/Infrastructure: Replace Ephemeral CA with Persistent, Auto-Renewing Local CA

1 participant