Article View: linux.debian.bugs.dist
Article #6641Bug#1155718: jks-keystore hook: --fresh branch is unreachable, so "update-ca-certificates --fresh" never removes stale CAs from ...
From: Rafa
Date: Sun, 29 Nov 2026 00:40
Date: Sun, 29 Nov 2026 00:40
112 lines
7329 bytes
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
Technical Details
Message-ID:
<O4B7r-eM1P-1@gated-at.bofh.it>Path:
mbox-mo1.pugleaf.net!srl.newsdeef.eu!news.samoylyk.net!gothmog.csi.it!bofh.it!news.nic.it!robomodShow Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srl.newsdeef.eu!news.samoylyk.net!gothmog.csi.it!bofh.it!news.nic.it!robomod
From: Rafa <rafagr2972@gmail.com>
Newsgroups: linux.debian.bugs.dist
Subject: Bug#1155718: jks-keystore hook: --fresh branch is unreachable, so "update-ca-certificates --fresh" never removes stale CAs from the Java keystore
Date: Sun, 29 Nov 2026 01:40:01 +0100
Message-ID: <O4B7r-eM1P-1@gated-at.bofh.it>
X-Original-To: submit@bugs.debian.org
X-Mailbox-Line: From debian-bugs-dist-request@lists.debian.org Sun Nov 29 00:37:09 2026
Old-Return-Path: <debbugs@buxtehude.debian.org>
X-Spam-Flag: NO
X-Spam-Score: -0.298
Reply-To: Rafa <rafagr2972@gmail.com>, 1155718@bugs.debian.org
Resent-To: debian-bugs-dist@lists.debian.org
Resent-Cc: pkg-java-maintainers@lists.alioth.debian.org
X-Debian-Pr-Message: report 1155718
X-Debian-Pr-Package: ca-certificates-java
X-Debian-Pr-Keywords: security
X-Debian-Pr-Source: ca-certificates-java
X-Gm-Message-State: APuU4Z8oP2ijOhAUfVhvY1KHKKnidfyyWy8LMljxP4DxhiGVRfeqHjp+
FifpycU58oGZSalNaVaw6wJ5uyw7xMh02jVFAB614vh8+mADoh/+duJOufKJaQ==
X-Gm-Gg: AZFdTZf/28y1iH/u7KFraB2EGzRT9OJVsK7ty2+6hbcdESe+YefgqnynJDcERv1Uccq
YR4Uv/fcw5i6KkRpu+5bHjo2lh3e9iYhegxMljRrzDpkeS1Vw/7oEyITs4ktwDOE/CW8+1vMfDD
phK5/eSsd3Xgz8MOVnoy9OCL7gcZDYMTOECy1rs5o+iZqgGVbhnxifq6XxOvfH5+lW5LzdEasQz
jOPx7qABcuTlGz924zySWTnmy6l3lGbrlv4lxd3KPNnUErLWSygg9C6o5W7NCrQ+MoZ7Ugbb1Vz
SOIRJOsr5t+jRVrvy9E1HI65Ihq//+kz//LzCM12Q/phNquRq558D1RLpwo29lvoEQKuJN55V9x
GtzhUio0td78pbyM9EodO0zcArfvX7lvirWzxfaTa3qJ1rp8hF+yyXt1UD2Jk8ZSlh82KiRuOQr
X3+8dhqSOD8/VLUwnm7Q9t703CQfRb7ovlt+mmGU4DSM1mFMxw+KkZudWWHFdZPgDEe3rwRMe1N
e/T+75G0S2+TFu120pfj6hO/k8as8iW+oXC6qNut3R7ZdLM9mfnbvj5DN4brsQRS10fyUXDkDko
WYalnpiiLTanSy6JgX4Np2WTOREDzupa97da
X-Received: by 2002:a05:6122:628b:b0:5ea:d18e:dca5 with SMTP id 71dfb90a1353d-5ee8af76532mr21754111e0c.16.1795912503043;
Sat, 28 Nov 2026 16:35:03 -0800 (PST)
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Content-Language: es-ES
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Debian-Message: from BTS
X-Mailing-List: <debian-bugs-dist@lists.debian.org> archive/latest/2005744
List-ID: <debian-bugs-dist.lists.debian.org>
List-URL: <https://lists.debian.org/debian-bugs-dist/>
Approved: robomod@news.nic.it
Lines: 112
Organization: linux.* mail to news gateway
Sender: robomod@news.nic.it
X-Original-Date: Sat, 28 Nov 2026 21:34:59 -0300
X-Original-Message-ID: <7721961b-8b6c-4353-8b7e-bb3efb6d0f27@gmail.com>