🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: linux.debian.bugs.dist
2 messages
2 total messages Started by Rafa Sun, 29 Nov 2026 00:40
Bug#1155718: jks-keystore hook: --fresh branch is unreachable, so "update-ca-certificates --fresh" never removes stale CAs from ...
#6641
Author: Rafa
Date: Sun, 29 Nov 2026 00:40
112 lines
7329 bytes
Package: ca-certificates-java
Version: 20260311
Severity: important
Tags: security

Dear Maintainer,

/etc/ca-certificates/update.d/jks-keystore only activates the
"update-ca-certificates-java-fresh" trigger when it is called with
-f or --fresh as $1:

     case "$1" in
         -f|--fresh)
             dpkg-trigger --no-await update-ca-certificates-java-fresh
             ;;
         *)
             dpkg-trigger --no-await update-ca-certificates-java
             ;;
     esac

But update-ca-certificates (ca-certificates 20261123) runs every hook
without arguments, even when it was called with --fresh
(/usr/sbin/update-ca-certificates, lines 215-218; line breaks added):

     eval run-parts "$VERBOSE_ARG" --test -- "$HOOKSDIR" |
       while read -r hook
     do
       ( cat "$ADDED"
         cat "$REMOVED" ) | "$hook" ||
         echo "E: $hook exited with code $?."
     done

So the -f|--fresh branch can never be taken. Running
"update-ca-certificates --fresh" always activates the normal
"update-ca-certificates-java" trigger. In that mode the hook only
gets "+" lines (see #866670): every CA gets re-added and nothing gets
removed. The alias reconciliation in update_cacerts(), which would
drop stale aliases, only runs in fresh mode. Here it is reached only
on initial install, on upgrades from versions older than 20210218, or
when /etc/ssl/certs/java/cacerts does not exist.

Consequence: the procedure most users would try first to repair an
outdated keystore does not remove distrusted roots. Java keeps
trusting CAs that OpenSSL, GnuTLS and NSS no longer trust.

Observed on this system (unstable, amd64):
  - Because of #1069251, /etc/ssl/certs/java/cacerts had not changed
    since 2025-08-08. It had 150 entries, while /etc/ssl/certs had 118
    CA symlinks. About 42 removed roots were still trusted (Entrust x4,
    AffirmTrust x4, CommScope x4, Trustwave x3, emSign C1/C3,
    Baltimore, ...) and 10 new roots were missing (SECOM 2024,
    Telia v3, TrustAsia TLS, OISTE Server G1, SwissSign 2022,
    e-Szigno 2023).
  - "update-ca-certificates --fresh" (run twice): "118 added,
    0 removed", then "Replacing"/"Adding" for every CA, with no
    removal. Afterwards the keystore had 160 entries, and all the
    stale roots were still there.
  - The only working recovery was to move the keystore away:
        mv /etc/ssl/certs/java/cacerts cacerts.old
        update-ca-certificates
    The postinst then enters fresh mode (lines 236-238) and builds a
    new keystore with exactly the 118 current CAs.

Steps to reproduce:
  1. Add any extra trusted entry to the keystore, for example an
     alias "debian:stale_test.pem":
        keytool -importcert -cacerts -storepass changeit -noprompt \
                -alias debian:stale_test.pem -file <some CA .pem>
  2. update-ca-certificates --fresh
  3. keytool -list -cacerts -storepass changeit | grep stale_test
     -> the entry is still there.

Possible fixes (any of these):
  a) In update_cacerts(), always reconcile the keystore aliases
     against find_pem_files(), not only when
     /var/lib/ca-certificates-java/fresh exists. This would also make
     the Java side robust against #1069251, #866670 and #1153564.
  b) Make the hook detect a fresh run some other way, for example an
     environment variable exported by update-ca-certificates. That
     needs a coordinated change in ca-certificates.
  c) At least document that "--fresh" does not rebuild the Java
     keystore, and how to rebuild it (delete cacerts and run
     update-ca-certificates).

Note: the alias parsing in the same code path is locale-dependent, so
even when fresh mode is reached it removes nothing on non-English
systems. I am filing that as a separate bug.

-- System Information:
Debian Release: forky/sid
Architecture: amd64
Kernel: Linux 7.3.6+deb14-amd64
Locale: LANG=es_ES.UTF-8, LC_MESSAGES=es_ES.UTF-8

Relevant package versions:
ii  ca-certificates            20261123
ii  ca-certificates-java       20260311
ii  default-jre-headless       2:1.25-77
ii  openjdk-21-jre-headless    21.0.13.1+2-1
ii  openjdk-25-jre-headless    25.0.5.1+2-1

/etc/default/cacerts: cacerts_updates=yes

---
Relevant package versions:
ii  ca-certificates            20261123
ii  ca-certificates-java       20260311
ii  default-jre-headless       2:1.25-77
ii  openjdk-21-jre-headless    21.0.13.1+2-1
ii  openjdk-25-jre-headless    25.0.5.1+2-1

/etc/default/cacerts: cacerts_updates=yes
Bug#1155718: jks-keystore hook: --fresh branch is unreachable
#6643
Author: Rafa
Date: Sun, 29 Nov 2026 01:00
2 lines
2720 bytes
The locale-dependent alias parsing mentioned in the last paragraph
of this report is now #1155719.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads