Skip to content

app-misc/ca-certificates: Only bundle roots trusted for TLS - #4333

Open
sayanchowdhury wants to merge 1 commit into
mainfrom
sayan/fix-tls-certdata2pem-script
Open

sayanchowdhury wants to merge 1 commit into
mainfrom
sayan/fix-tls-certdata2pem-script

Conversation

@sayanchowdhury

Copy link
Copy Markdown
Member

certdata2pem.py was ported from Debian in 2014 and still included roots that Mozilla trusts only for S/MIME. The ebuild puts every root into ca-certificates.crt, and OpenSSL, curl and Go use that bundle for TLS without checking the trust purpose, so email-only roots became TLS roots.

That is why the compromised eMudhra intermediates still validate on Flatcar after ca-certificates 3.131.1. emSign ECC Root CA - G3 were removed, but the intermediates were also cross-signed by AAA Certificate Services, which is email-only in Mozilla's data and was never removed. It was bundled anyway.

Port the relevant Debian changes to certdata2pem.py:

  • 8a7d7c7: only include roots with SERVER_AUTH trust. This drops 49
    email-only? roots for us (167 -> 118 certs on NSS 3.131.1), AAA included.
  • 12497a6: drop the CKO_NETSCAPE_* checks. Current certdata.txt has none,
    so this does not change the output.
  • 813fc23: rename a certificate to _2.pem when its file name is
    already taken, instead of overwriting the first. No duplicate labels
    exist in current NSS data.

AI was used to identify the missing ports from Debian script to Flatcar and generate the changes.

CI Running https://jenkins.flatcar.org/job/container/job/packages_all_arches/890/cldsv/

Testing done

[Describe the testing you have done before submitting this PR. Please include both the commands you issued as well as the output you got.]

  • Changelog entries added in the respective changelog/ directory (user-facing change, bug fix, security fix, update)
  • Inspected CI output for image differences: /boot and /usr size, packages, list files for any missing binaries, kernel modules, config files, kernel modules, etc.

Copilot AI balanced review requested due to automatic review settings October 22, 2026 09:01
@sayanchowdhury
sayanchowdhury requested a review from a team as a code owner October 22, 2026 09:01

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

The duplicate-filename fallback can still overwrite an existing certificate and silently omit a trusted root from the bundle.

1 open issue
What changed in this PR

Restricts Flatcar’s CA bundle to roots Mozilla trusts for TLS, preventing email-only roots from becoming TLS trust anchors.

Changes:

  • Filters roots by server-authentication trust and removes legacy Netscape trust checks.
  • Adds a duplicate-filename fallback to the certificate converter.
  • Adds an ebuild revision to ship the updated bundle generation.
File Description
sdk_container/​src/​third_party/​coreos-overlay/​app-misc/​ca-certificates/​files/​certdata2pem.py Restricts trust selection to TLS and adds filename collision handling.
sdk_container/​src/​third_party/​coreos-overlay/​app-misc/​ca-certificates/​ca-certificates-3.131.1-r1.ebuild Introduces the package revision using the updated converter.

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings October 22, 2026 11:26
certdata2pem.py was ported from Debian in 2014 and still included roots
that Mozilla trusts only for S/MIME. The ebuild puts every root into
ca-certificates.crt, and OpenSSL, curl and Go use that bundle for TLS
without checking the trust purpose, so email-only roots became TLS roots.

That is why the compromised eMudhra intermediates still validate on
Flatcar after ca-certificates 3.131.1. emSign ECC Root CA - G3 were
removed, but the intermediates were also cross-signed by
AAA Certificate Services, which is email-only in Mozilla's data and
was never removed. It was bundled anyway.

Signed-off-by: Sayan Chowdhury <sayan.chowdhury2012@gmail.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

A verified duplicate-label case retains an email-only certificate in the TLS bundle because trust is matched by label rather than certificate identity.

1 open issue
1 resolved since last review

Review effort: Balanced

Comment on lines +131 to +134
while os.path.exists(fname):
print("Found duplicate certificate name %s, renaming." % fname)
fname = basename + '_%d.pem' % suffix
suffix += 1
Copilot AI balanced review requested due to automatic review settings October 22, 2026 11:29

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 Needs a closer look

The system-wide trust-anchor removal needs human verification of the generated bundle and completed image-build and upgrade validation.

1 open issue

Review effort: Balanced

@chewi

chewi commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

I would feel safer taking Debian's version as-is. It includes these changes and some others. Unfortunately, the file handling is a bit different, so the ebuild becomes slightly awkward, but it's not that bad.

@@ -72,10 +72,14 @@ gen_tmpfiles() {
 }
 
 src_compile() {
-	local certdata="${MY_P}/nss/lib/ckfw/builtins/certdata.txt"
-	${PYTHON} "${FILESDIR}/certdata2pem.py" "${certdata}" certs || die
-
+	mkdir certs || die
 	cd certs || die
+
+	ln -s "../${MY_P}/nss/lib/ckfw/builtins/certdata.txt" . || die
+	${PYTHON} "${FILESDIR}/certdata2pem.py" || die
+	rm certdata.txt || die
+	rename .crt .pem *.crt || die
+
 	gen_hash_links *.pem
 	cat *.pem > ca-certificates.crt || die
 	gen_tmpfiles * > "${S}/${PN}.conf" || die

@chewi

chewi commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

Forgot to add that I compared the results of the two different versions and they are the same.

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

I'll approve this for now, but we should look into switching to Gentoo's package, as we don't seem to know why we're not using it.

This branch is waiting to be deployed

1 waiting deployment
development — c34d9843 Waiting Oct 22, 2026 by sayanchowdhury via Wait for approval #6020
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.

3 participants