Skip to content

Injector/Operator: use RSA keys for webhook serving certs#9873

Merged
JoshVanL merged 8 commits into
dapr:masterfrom
JoshVanL:tls-rsa-for-kube-webhooks
May 5, 2026
Merged

Injector/Operator: use RSA keys for webhook serving certs#9873
JoshVanL merged 8 commits into
dapr:masterfrom
JoshVanL:tls-rsa-for-kube-webhooks

Conversation

@JoshVanL

@JoshVanL JoshVanL commented May 4, 2026

Copy link
Copy Markdown
Contributor

The Kubernetes API server on some managed cloud distributions rejects Ed25519 serving certificates when invoking admission webhooks. After the workload-identity key algorithm was switched to Ed25519, the Dapr injector (mutating sidecar webhook) and operator (CRD conversion, validating, and mutating webhooks) could no longer be reached by the apiserver in those environments.

The injector and operator each have a single SPIFFE identity that backs both their webhook TLS cert and any other mTLS they perform, so switching the entire identity algorithm is sufficient. Sentry's CA already accepts CSRs of any supported algorithm, so no signing-side changes are needed.

This commit plumbs a new spiffe.KeyAlgorithm option through security.Options into spiffe.New (added in dapr/kit) and sets it to ptr.Of(spiffe.KeyAlgorithmRSA) in the injector and operator binaries. All other control plane components (sentry, placement, scheduler) and daprd workloads keep the Ed25519 default, since the new option is nil-defaulted.

The Kubernetes API server on some managed cloud distributions rejects
Ed25519 serving certificates when invoking admission webhooks. After
the workload-identity key algorithm was switched to Ed25519, the Dapr
injector (mutating sidecar webhook) and operator (CRD conversion,
validating, and mutating webhooks) could no longer be reached by the
apiserver in those environments.

The injector and operator each have a single SPIFFE identity that
backs both their webhook TLS cert and any other mTLS they perform, so
switching the entire identity algorithm is sufficient. Sentry's CA
already accepts CSRs of any supported algorithm, so no signing-side
changes are needed.

This commit plumbs a new spiffe.KeyAlgorithm option through
security.Options into spiffe.New (added in dapr/kit) and sets it to
ptr.Of(spiffe.KeyAlgorithmRSA) in the injector and operator binaries.
All other control plane components (sentry, placement, scheduler) and
daprd workloads keep the Ed25519 default, since the new option is
nil-defaulted.

Signed-off-by: joshvanl <[email protected]>
Copilot AI review requested due to automatic review settings May 4, 2026 21:57
@JoshVanL
JoshVanL requested review from a team as code owners May 4, 2026 21:57
@JoshVanL

JoshVanL commented May 4, 2026

Copy link
Copy Markdown
Contributor Author

/ok-to-test

@dapr-bot

dapr-bot commented May 4, 2026

Copy link
Copy Markdown
Collaborator

Dapr E2E test

🔗 Link to Action run

Commit ref: ebd665f

❌ Infrastructure deployment failed

Cluster Resource group name Azure region
Linux Dapr-E2E-dapre2e546213eb4dl eastus
Windows Dapr-E2E-dapre2e546213eb4dw eastus
Linux/arm64 Dapr-E2E-dapre2e546213eb4dla eastus

Please check the logs for details on the failure.

❌ Build failed for linux/amd64

Please check the logs for details on the error.

❌ Build failed for windows/amd64

Please check the logs for details on the error.

Copilot AI 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.

Pull request overview

This PR updates Dapr’s Kubernetes control-plane components to use RSA workload keys for webhook-serving TLS certificates (injector/operator) to improve compatibility with Kubernetes API servers that reject Ed25519 serving certs, while keeping Ed25519 as the default elsewhere. It does this by plumbing a key-algorithm option through pkg/security into SPIFFE identity creation and adding integration coverage to assert the resulting serving-certificate key types.

Changes:

  • Add KeyAlgorithm to pkg/security.Options and pass it through to the SPIFFE identity provider.
  • Configure the injector and operator to request RSA workload keys (to back webhook-serving certs).
  • Add integration tests + a shared TLS-cert capture helper to assert Ed25519 vs RSA serving certs across components.

Reviewed changes

Copilot reviewed 12 out of 13 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/integration/suite/sentry/servingcerted.go New integration test asserting Sentry serving cert is Ed25519.
tests/integration/suite/scheduler/servingcerted.go New integration test asserting Scheduler serving cert is Ed25519.
tests/integration/suite/placement/servingcerted.go New integration test asserting Placement serving cert is Ed25519.
tests/integration/suite/operator/servingcertrsa.go New integration test asserting Operator webhook serving cert is RSA.
tests/integration/suite/injector/servingcertrsa.go New integration test asserting Injector webhook serving cert is RSA.
tests/integration/suite/daprd/mtls/servingcerted.go New integration test asserting daprd mTLS serving cert is Ed25519.
tests/integration/framework/process/operator/operator.go Expose operator webhook port so tests can target the webhook TLS listener.
tests/integration/framework/cert/cert.go Add helper to capture a server’s leaf cert and assert its public-key type (Ed25519/RSA).
pkg/security/security.go Add KeyAlgorithm option and forward it into spiffe.New(...).
pkg/operator/operator.go Set KeyAlgorithm to RSA for operator security identity (webhook-serving cert).
cmd/injector/app/app.go Set KeyAlgorithm to RSA for injector security identity (webhook-serving cert).
go.mod Adds a replace directive for github.com/dapr/kit (currently problematic; see PR comment).
go.sum Updates sums consistent with the go.mod replace of github.com/dapr/kit.

Comment thread go.mod Outdated
acroca
acroca previously approved these changes May 5, 2026
Comment thread cmd/injector/app/app.go
// The injector serves a mutating admission webhook to the Kubernetes
// API server, which on some cloud distributions rejects Ed25519
// serving certs.
KeyAlgorithm: ptr.Of(spiffe.KeyAlgorithmRSA),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I guess we can't know which cert would be allowed, right? It'd be cool to use ed25519 when possible, but I'm not sure we can check if it's supported dynamically.

@JoshVanL JoshVanL May 5, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah it's tricky because as the webhook server it is difficult to tell why the peer didn't connect, and it would be a lot of machinery to rotate with a different key in these scenarios

@acroca
acroca dismissed their stale review May 5, 2026 09:42

go mod changes

@JoshVanL

JoshVanL commented May 5, 2026

Copy link
Copy Markdown
Contributor Author

/ok-to-test

@dapr-bot

dapr-bot commented May 5, 2026

Copy link
Copy Markdown
Collaborator

Dapr E2E test

🔗 Link to Action run

Commit ref: 2a04932

❌ Infrastructure deployment failed

Cluster Resource group name Azure region
Linux Dapr-E2E-dapre2eb29ff84692l eastus
Windows Dapr-E2E-dapre2eb29ff84692w eastus
Linux/arm64 Dapr-E2E-dapre2eb29ff84692la eastus

Please check the logs for details on the failure.

❌ Build failed for linux/amd64

Please check the logs for details on the error.

❌ Build failed for windows/amd64

Please check the logs for details on the error.

@JoshVanL JoshVanL added autoupdate DaprBot will keep the Pull Request up to date with master branch backport release-1.18 labels May 5, 2026
@cicoyle cicoyle mentioned this pull request May 5, 2026

@cicoyle cicoyle 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.

changes lgtm

@cicoyle cicoyle added the automerge Allows DaprBot to automerge and update PR if all approvals are in place label May 5, 2026
@JoshVanL
JoshVanL merged commit dfd4ab3 into dapr:master May 5, 2026
62 of 65 checks passed
JoshVanL added a commit that referenced this pull request May 5, 2026
)

* Injector/Operator: use RSA keys for webhook serving certs

The Kubernetes API server on some managed cloud distributions rejects
Ed25519 serving certificates when invoking admission webhooks. After
the workload-identity key algorithm was switched to Ed25519, the Dapr
injector (mutating sidecar webhook) and operator (CRD conversion,
validating, and mutating webhooks) could no longer be reached by the
apiserver in those environments.

The injector and operator each have a single SPIFFE identity that
backs both their webhook TLS cert and any other mTLS they perform, so
switching the entire identity algorithm is sufficient. Sentry's CA
already accepts CSRs of any supported algorithm, so no signing-side
changes are needed.

This commit plumbs a new spiffe.KeyAlgorithm option through
security.Options into spiffe.New (added in dapr/kit) and sets it to
ptr.Of(spiffe.KeyAlgorithmRSA) in the injector and operator binaries.
All other control plane components (sentry, placement, scheduler) and
daprd workloads keep the Ed25519 default, since the new option is
nil-defaulted.



* Update dapr/kit to origin HEAD



* Fix serving cert algo int test



---------




(cherry picked from commit dfd4ab3)

Signed-off-by: joshvanl <[email protected]>
Signed-off-by: dapr-bot <[email protected]>
Co-authored-by: Josh van Leeuwen <[email protected]>
Co-authored-by: Cassie Coyle <[email protected]>
@nelson-parente nelson-parente added this to the v1.18 milestone May 20, 2026
msfussell added a commit to dapr/docs that referenced this pull request May 24, 2026
* sentry: document Ed25519 default workload identity keys

Sentry switched workload X.509 certificate key generation from ECDSA
P-256 to Ed25519 in Dapr 1.18 (dapr/dapr#9598).

Changes:
- concepts/security-concept.md: add 'Workload identity key algorithm'
  subsection under 'Secure Dapr to Dapr communication'. Covers what
  changed (default: Ed25519 for workload/CA certs, RSA for injector/
  operator webhook serving certs, RSA-2048 for JWT/OIDC unchanged),
  why (smaller keys/sigs, faster ops, cleaner curve design), mixed-
  version rolling-upgrade compatibility, FIPS callout (Ed25519 is not
  FIPS-140 approved; BYO-CA path is the workaround), and downgrade
  floor alert (1.17.7). Also updates stale 'ECDSA private key'
  sentence in the same section.
- operations/security/mtls.md: add 'Workload identity key algorithm'
  section at the top pointing to the concept page. Adds BYO-CA note
  explaining that supplied issuer key algorithm is what Sentry uses.
  Updates stale 'ECDSA PEM encoded' in self-hosted BYO-certs prose.
  Adds inline note on the Kubernetes openssl example clarifying that
  RSA keys are also accepted (relevant for FIPS environments).

Related: dapr/dapr#9873 (injector/operator RSA webhook certs —
tracked separately as gap R5).
Targets v1.18.

Signed-off-by: Nelson Parente <[email protected]>

* sentry: tighten Ed25519 workload identity docs (review pass)

Signed-off-by: Nelson Parente <[email protected]>

---------

Signed-off-by: Nelson Parente <[email protected]>
Co-authored-by: Mark Fussell <[email protected]>
msfussell added a commit to dapr/docs that referenced this pull request May 26, 2026
* sentry: document Ed25519 default workload identity keys

Sentry switched workload X.509 certificate key generation from ECDSA
P-256 to Ed25519 in Dapr 1.18 (dapr/dapr#9598).

Changes:
- concepts/security-concept.md: add 'Workload identity key algorithm'
  subsection under 'Secure Dapr to Dapr communication'. Covers what
  changed (default: Ed25519 for workload/CA certs, RSA for injector/
  operator webhook serving certs, RSA-2048 for JWT/OIDC unchanged),
  why (smaller keys/sigs, faster ops, cleaner curve design), mixed-
  version rolling-upgrade compatibility, FIPS callout (Ed25519 is not
  FIPS-140 approved; BYO-CA path is the workaround), and downgrade
  floor alert (1.17.7). Also updates stale 'ECDSA private key'
  sentence in the same section.
- operations/security/mtls.md: add 'Workload identity key algorithm'
  section at the top pointing to the concept page. Adds BYO-CA note
  explaining that supplied issuer key algorithm is what Sentry uses.
  Updates stale 'ECDSA PEM encoded' in self-hosted BYO-certs prose.
  Adds inline note on the Kubernetes openssl example clarifying that
  RSA keys are also accepted (relevant for FIPS environments).

Related: dapr/dapr#9873 (injector/operator RSA webhook certs —
tracked separately as gap R5).
Targets v1.18.



* sentry: tighten Ed25519 workload identity docs (review pass)



---------

Signed-off-by: Nelson Parente <[email protected]>
Co-authored-by: Mark Fussell <[email protected]>
marcduiker pushed a commit to marcduiker/dapr-docs that referenced this pull request May 28, 2026
* sentry: document Ed25519 default workload identity keys

Sentry switched workload X.509 certificate key generation from ECDSA
P-256 to Ed25519 in Dapr 1.18 (dapr/dapr#9598).

Changes:
- concepts/security-concept.md: add 'Workload identity key algorithm'
  subsection under 'Secure Dapr to Dapr communication'. Covers what
  changed (default: Ed25519 for workload/CA certs, RSA for injector/
  operator webhook serving certs, RSA-2048 for JWT/OIDC unchanged),
  why (smaller keys/sigs, faster ops, cleaner curve design), mixed-
  version rolling-upgrade compatibility, FIPS callout (Ed25519 is not
  FIPS-140 approved; BYO-CA path is the workaround), and downgrade
  floor alert (1.17.7). Also updates stale 'ECDSA private key'
  sentence in the same section.
- operations/security/mtls.md: add 'Workload identity key algorithm'
  section at the top pointing to the concept page. Adds BYO-CA note
  explaining that supplied issuer key algorithm is what Sentry uses.
  Updates stale 'ECDSA PEM encoded' in self-hosted BYO-certs prose.
  Adds inline note on the Kubernetes openssl example clarifying that
  RSA keys are also accepted (relevant for FIPS environments).

Related: dapr/dapr#9873 (injector/operator RSA webhook certs —
tracked separately as gap R5).
Targets v1.18.

Signed-off-by: Nelson Parente <[email protected]>

* sentry: tighten Ed25519 workload identity docs (review pass)

Signed-off-by: Nelson Parente <[email protected]>

---------

Signed-off-by: Nelson Parente <[email protected]>
Co-authored-by: Mark Fussell <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automerge Allows DaprBot to automerge and update PR if all approvals are in place autoupdate DaprBot will keep the Pull Request up to date with master branch backport release-1.18

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

6 participants