Skip to content

Fix: restore CommonName in ACME-issued certificates after lego v5 upgrade#744

Merged
gardener-prow[bot] merged 2 commits into
masterfrom
fix/enable-common-name
Jun 12, 2026
Merged

Fix: restore CommonName in ACME-issued certificates after lego v5 upgrade#744
gardener-prow[bot] merged 2 commits into
masterfrom
fix/enable-common-name

Conversation

@MartinWeindel

Copy link
Copy Markdown
Member

How to categorize this PR?

/kind bug

What this PR does / why we need it:

Summary

Re-enables Common Name (CN) population in certificates issued via ACME after the lego v5 upgrade. lego v5 changed the default to omit CN; this PR opts back in via EnableCommonName: true on both ObtainRequest and ObtainForCSRRequest, restoring the pre-v5 behavior expected by existing consumers.

Changes

  • pkg/shared/legobridge/certificate.go: set EnableCommonName: true in obtainForDomains and obtainForCSR.
  • test/utils/pebble.go: set PromoteCommonName: true on both Pebble profiles so the local ACME CA emits a CN, mirroring the client-side opt-in (test-only).
  • test/integration/controller/issuer/issuer_test.go: extend ACME tests to assert Subject.CommonName and DNSNames on the issued cert; add coverage for the CSR path (obtainForCSR) and for the "CommonName + extra
    DNSNames" combination. New helpers: buildCSR, parseCertFromSecret. getCertificate gains a variadic dnsNames parameter (backward-compatible).
  • test/integration/controller/issuer/certificate_test.go: tighten the CA-path SAN test with a Subject.CommonName assertion.

Which issue(s) this PR fixes:
Fixes #

Special notes for your reviewer:

Release note:

ACME-issued certificates now include the correct Subject Common Name again. The recent lego v5 upgrade had silently dropped the CN from issued certificates, breaking consumers that pin to or parse `Subject.CommonName`. The CN is now populated from `spec.commonName` (or the first DNS name when CN is unset and ≤64 characters).

@gardener-prow gardener-prow Bot added the kind/bug Bug label Jun 11, 2026
@MartinWeindel

Copy link
Copy Markdown
Member Author

/cc @marc1404

@gardener-prow gardener-prow Bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jun 11, 2026
@gardener-prow gardener-prow Bot requested a review from marc1404 June 11, 2026 21:06
@gardener-prow gardener-prow Bot added the cla: yes Indicates the PR's author has signed the cla-assistant.io CLA. label Jun 11, 2026

@marc1404 marc1404 left a comment

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.

/lgtm
/approve

@gardener-prow gardener-prow Bot added the lgtm Indicates that a PR is ready to be merged. label Jun 12, 2026
@gardener-prow

gardener-prow Bot commented Jun 12, 2026

Copy link
Copy Markdown

LGTM label has been added.

DetailsGit tree hash: be145ceb938df0d52842402ef2b05627d1517b53

@gardener-prow

gardener-prow Bot commented Jun 12, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: marc1404

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@gardener-prow gardener-prow Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 12, 2026
@gardener-prow gardener-prow Bot merged commit 2c03eef into master Jun 12, 2026
31 checks passed
@gardener-prow gardener-prow Bot deleted the fix/enable-common-name branch June 12, 2026 06:30
@MartinWeindel

Copy link
Copy Markdown
Member Author

/cherry-pick release-v0.24

@gardener-ci-robot

Copy link
Copy Markdown
Collaborator

@MartinWeindel: new pull request created: #745

Details

In response to this:

/cherry-pick release-v0.24

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cla: yes Indicates the PR's author has signed the cla-assistant.io CLA. kind/bug Bug lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants