镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Host identity cert renewal: added IANA number and jitter - #31579

Merged
getvictor merged 1 commit into
mainfrom
victor/30476-iana
Aug 7, 2025
Merged

getvictor merged 1 commit into
mainfrom
victor/30476-iana

Conversation

@getvictor

@getvictor getvictor commented Aug 4, 2025 •

Copy link
Copy Markdown
Member

Fixes #30476

Minor tweaks to host identity cert renewal feature: added IANA number and jitter

Mostly doc changes

Summary by CodeRabbit

  • Documentation

    • Added comprehensive documentation on managing custom OID extensions, including structure, usage examples, and security considerations.
    • Updated certificate renewal documentation to clarify timing details and corrected the OID value to match Fleet’s assigned namespace.
  • Bug Fixes

    • Corrected the OID used for certificate renewal extensions to the proper Fleet-assigned value.
  • New Features

    • Introduced random jitter (up to 30 minutes) to certificate renewal timing to reduce simultaneous renewal requests.

@coderabbitai

coderabbitai Bot commented Aug 4, 2025 •

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

This update adds a new documentation file about custom OID extensions, updates an existing doc to clarify certificate renewal timing and OID usage, introduces random jitter to the certificate renewal timer in code, and updates the renewal extension OID to use Fleet's assigned IANA number in both code and documentation.

Changes

Cohort / File(s) Change Summary
Custom OID Extensions Documentation
docs/Contributing/product-groups/orchestration/custom-oid-extensions.md
Adds a new doc explaining custom OID extensions, Fleet’s OID namespace, example usage, and instructions for adding new extensions.
Certificate Renewal Documentation
docs/Contributing/product-groups/orchestration/tpm-backed-http-signing.md
Updates documentation to clarify renewal timing (1 hour or 180 days plus jitter) and corrects the OID value in the CSR extension.
Renewal Timer Jitter in Code
ee/orbit/pkg/hostidentity/host_identity.go
Adds up to 30 minutes of random jitter to the certificate renewal timer to prevent thundering herd issues.
OID Value Update in Code
ee/server/service/hostidentity/types/host_identity_certificates.go
Updates the RenewalExtensionOID constant to use Fleet’s assigned IANA OID (63991) and updates the related comment.

Sequence Diagram(s)

sequenceDiagram
    participant Fleetd
    participant Timer
    participant TPM

    Note over Fleetd: On startup or after renewal
    Fleetd->Timer: Calculate renewal time (expiry - 180d + 1min)
    Timer->Timer: Add random jitter (0-30min)
    Timer->Fleetd: Wait until renewal time
    Timer->Fleetd: Trigger renewal
    Fleetd->TPM: Use TPM to generate new CSR with custom OID extension
    Fleetd->Fleet Server: Submit CSR for renewal
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Assessment against linked issues

Objective Addressed Explanation
Fleetd renews host identity certificate using correct OID and adds jitter to renewal timing (#30476) ✅
Documentation accurately reflects certificate renewal timing and OID usage (#30476) ✅
No changes to UI, CLI, YAML, REST API, GitOps, permissions, or paid features as specified (#30476) ✅

Assessment against linked issues: Out-of-scope changes

No out-of-scope changes found.

Possibly related PRs

  • fleetdm/fleet#31372: Adds documentation for Fleet’s custom OID extensions, which is directly related to the implementation and documentation changes in this PR.

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch victor/30476-iana

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@getvictor

Copy link
Copy Markdown
Member Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Aug 4, 2025

Copy link
Copy Markdown
Contributor
✅ Actions performed

Full review triggered.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (3)
ee/orbit/pkg/hostidentity/host_identity.go (1)

184-187: optional: include jitter in log field

logging the actual jitter value can help when debugging scheduling:

 logger.Info().
     Dur("renewal_in", renewalTime).
+    Dur("jitter", jitter).
     Time("cert_expires", clientCert.NotAfter).
     Msg("Scheduling host identity certificate renewal timer")
docs/Contributing/product-groups/orchestration/tpm-backed-http-signing.md (1)

334-358: duplicate / conflicting renewal description

lines 334-335 already describe the new “1 hour or 180 days + jitter” rule, while lines 355-357 restate the old “180 days” rule and then add jitter. the two sections read as contradictory.

suggest keeping a single, clear paragraph:

-The certificate is issued with a validity period of 365 days. Orbit attempts to renew it within 180 days of expiration.
-
-To prevent thundering herd issues when multiple hosts need to renew certificates simultaneously, Orbit adds a random jitter of 0-30 minutes to the renewal timer. This ensures that certificate renewal requests are spread out over time, reducing load on the Fleet server.
+The certificate is valid for 365 days. Orbit schedules renewal for **the later of**  
+• one hour from now, or  
+• 180 days before expiration,  
+plus a random 0–30 minute jitter.  
+This spreads renewal traffic and avoids thundering-herd spikes.
docs/Contributing/product-groups/orchestration/custom-oid-extensions.md (1)

7-19: minor style nit

markdown-lint points out mixed “dash” vs “asterisk” list markers; the rest of the repo generally uses dashes. no functional impact, but worth normalizing when you next touch the file.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f2df737 and 1245144.

📒 Files selected for processing (4)
  • docs/Contributing/product-groups/orchestration/custom-oid-extensions.md (1 hunks)
  • docs/Contributing/product-groups/orchestration/tpm-backed-http-signing.md (3 hunks)
  • ee/orbit/pkg/hostidentity/host_identity.go (2 hunks)
  • ee/server/service/hostidentity/types/host_identity_certificates.go (1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: getvictor
PR: fleetdm/fleet#30589
File: ee/server/service/hostidentity/depot/depot.go:104-119
Timestamp: 2025-07-08T16:06:54.576Z
Learning: In ee/server/service/hostidentity/depot/depot.go, the security concern where shared challenges allow certificate revocation (lines 104-119) is a known issue that will be addressed in a later feature, not an immediate concern to fix.
📚 Learning: in ee/server/service/hostidentity/depot/depot.go, the security concern where shared challenges allow...
Learnt from: getvictor
PR: fleetdm/fleet#30589
File: ee/server/service/hostidentity/depot/depot.go:104-119
Timestamp: 2025-07-08T16:06:54.576Z
Learning: In ee/server/service/hostidentity/depot/depot.go, the security concern where shared challenges allow certificate revocation (lines 104-119) is a known issue that will be addressed in a later feature, not an immediate concern to fix.

Applied to files:

  • docs/Contributing/product-groups/orchestration/tpm-backed-http-signing.md
  • ee/orbit/pkg/hostidentity/host_identity.go
  • ee/server/service/hostidentity/types/host_identity_certificates.go
🪛 markdownlint-cli2 (0.17.2)
docs/Contributing/product-groups/orchestration/tpm-backed-http-signing.md

371-371: Unordered list style
Expected: asterisk; Actual: dash

(MD004, ul-style)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (28)
  • GitHub Check: test-go (vuln, ubuntu-latest, mysql:8.0.36, false)
  • GitHub Check: test-go (main, ubuntu-latest, mysql:8.0.36, false)
  • GitHub Check: test-go (vuln, ubuntu-latest, mysql:9.3.0, false)
  • GitHub Check: test-go (main, ubuntu-latest, mysql:9.3.0, false)
  • GitHub Check: test-go (service, ubuntu-latest, mysql:9.3.0, false)
  • GitHub Check: test-go (scripts, ubuntu-latest, mysql:8.0.36, false)
  • GitHub Check: test-go (mysql, ubuntu-latest, mysql:9.3.0, false)
  • GitHub Check: test-go (service, ubuntu-latest, mysql:8.0.36, false)
  • GitHub Check: test-go (mysql, ubuntu-latest, mysql:8.0.36, false)
  • GitHub Check: test-go (integration-enterprise, ubuntu-latest, mysql:8.0.36, false)
  • GitHub Check: test-go (fleetctl, ubuntu-latest, mysql:8.0.36, false)
  • GitHub Check: test-go (fleetctl, ubuntu-latest, mysql:9.3.0, false)
  • GitHub Check: test-go (integration-enterprise, ubuntu-latest, mysql:9.3.0, false)
  • GitHub Check: test-go (integration-mdm, ubuntu-latest, mysql:8.0.36, false)
  • GitHub Check: test-go (fast, ubuntu-latest, mysql:8.0.36, false)
  • GitHub Check: test-go (integration-core, ubuntu-latest, mysql:8.0.36, false)
  • GitHub Check: test-go (integration-core, ubuntu-latest, mysql:9.3.0, false)
  • GitHub Check: test-go (integration-mdm, ubuntu-latest, mysql:9.3.0, false)
  • GitHub Check: markdown-link-check
  • GitHub Check: build (20.x)
  • GitHub Check: test-db-changes
  • GitHub Check: lint (windows-latest)
  • GitHub Check: build-binaries
  • GitHub Check: lint (ubuntu-latest)
  • GitHub Check: Analyze (go)
  • GitHub Check: lint (macos-latest)
  • GitHub Check: Analyze (javascript)
  • GitHub Check: publish
🔇 Additional comments (1)
ee/server/service/hostidentity/types/host_identity_certificates.go (1)

13-15: renewal OID looks good

the constant now references Fleet’s real IANA PEN (1.3.6.1.4.1.63991.1.1). that lines up with the docs and removes the placeholder. nothing else to flag here.

@codecov

codecov Bot commented Aug 4, 2025 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 63.69%. Comparing base (030e292) to head (1245144).
⚠️ Report is 49 commits behind head on main.

Files with missing lines Patch % Lines
ee/orbit/pkg/hostidentity/host_identity.go 0.00% 3 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main   #31579   +/-   ##
=======================================
  Coverage   63.69%   63.69%           
=======================================
  Files        1960     1960           
  Lines      191086   191089    +3     
  Branches     6128     6128           
=======================================
+ Hits       121716   121719    +3     
- Misses      59824    59825    +1     
+ Partials     9546     9545    -1     
Flag Coverage Δ
backend 65.08% <0.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@getvictor
getvictor marked this pull request as ready for review August 4, 2025 18:28
@getvictor
getvictor requested review from a team, lukeheath and sharon-fdm as code owners August 4, 2025 18:28

The certificate is issued with a validity period of 365 days. Orbit attempts to renew it within 180 days of expiration.

To prevent thundering herd issues when multiple hosts need to renew certificates simultaneously, Orbit adds a random jitter of 0-30 minutes to the renewal timer. This ensures that certificate renewal requests are spread out over time, reducing load on the Fleet server.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!

@sharon-fdm sharon-fdm left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@getvictor
getvictor merged commit b2636d8 into main Aug 7, 2025
@getvictor
getvictor deleted the victor/30476-iana branch August 7, 2025 06:24

This branch was previously deployed

1 inactive deployment
Docker Hub — 12451446 Deployed Aug 4, 2025 by getvictor
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.

TPM Linux: host identity cert renewal

2 participants