🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.debian.bugs.dist
Article #6642

Bug#1155719: postinst: fresh-mode alias parsing depends on keytool's locale, so stale CAs are never removed on non-English syste...

#6642
From: Rafa
Date: Sun, 29 Nov 2026 00:50
72 lines
5295 bytes
Package: ca-certificates-java
Version: 20260311
Severity: normal

Dear Maintainer,

In fresh mode, update_cacerts() in the postinst builds the list of
existing aliases like this (line 161; line breaks added):

     cacerts_aliases=$(keytool ${castore} -storepass "$storepass" \
         -list -rfc | sed -n 's/^Alias name: *debian://ip' \
         | tr '\n' ' ')

keytool localises that label. Using the system Java (OpenJDK
25.0.5.1):

     $ LANG=es_ES.UTF-8 keytool -cacerts -storepass changeit \
           -list -rfc | grep -m1 -i alias
     Nombre de Alias: debian:ac_raiz_fnmt-rcm.pem

     $ LC_ALL=pt_BR.UTF-8 keytool -cacerts -storepass changeit \
           -list -rfc | grep -m1 -i alias
     Nome do alias: debian:ac_raiz_fnmt-rcm.pem

     $ LC_ALL=C keytool -cacerts -storepass changeit \
           -list -rfc | grep -m1 -i alias
     Alias name: debian:ac_raiz_fnmt-rcm.pem

With a non-English locale the sed expression matches nothing, so
$cacerts_aliases is empty. No "-alias" line is ever written to
/var/lib/ca-certificates-java/fresh, and stale CAs stay trusted even
when fresh mode is reached. dpkg passes the caller's locale to
maintainer scripts, so this happens whenever apt/dpkg is run from a
non-English session, which is the normal case on a localised desktop.

(Fresh mode is currently reached only on initial install, on upgrades
from versions older than 20210218, and when cacerts is missing; see
#1155718 about the unreachable --fresh branch of the jks-keystore
hook. This bug becomes much more important if that reconciliation is
ever run more often.)

Suggested fix: force a fixed locale for the keytool call. For
example:

     cacerts_aliases=$(LC_ALL=C keytool \
         -J-Duser.language=en -J-Duser.country=US \
         ${castore} -storepass "$storepass" -list -rfc \
         | sed -n 's/^Alias name: *debian://ip' | tr '\n' ' ')

On this system both "LC_ALL=C" and "-J-Duser.language=en
-J-Duser.country=US" (without LC_ALL) make keytool print
"Alias name:". Other keytool calls in the postinst whose output is
parsed should probably get the same treatment.

-- 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

parsed should probably get the same treatment.

-- 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  openjdk-25-jre-headless    25.0.5.1+2-1
Technical Details
Message-ID: <O4Bh7-eM5k-1@gated-at.bofh.it>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.hispagatos.org!news.samoylyk.net!gothmog.csi.it!news.servidellagleba.it!bofh.it!news.nic.it!robomod

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.hispagatos.org!news.samoylyk.net!gothmog.csi.it!news.servidellagleba.it!bofh.it!news.nic.it!robomod
From: Rafa <rafagr2972@gmail.com>
Newsgroups: linux.debian.bugs.dist
Subject: Bug#1155719: postinst: fresh-mode alias parsing depends on keytool's locale, so stale CAs are never removed on non-English systems
Date: Sun, 29 Nov 2026 01:50:01 +0100
Message-ID: <O4Bh7-eM5k-1@gated-at.bofh.it>
X-Mailbox-Line: From debian-bugs-dist-request@lists.debian.org  Sun Nov 29 00:41:09 2026
Old-Return-Path: <debbugs@buxtehude.debian.org>
X-Spam-Flag: NO
X-Spam-Score: -0.298
Reply-To: Rafa <rafagr2972@gmail.com>, 1155719@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 1155719
X-Debian-Pr-Package: ca-certificates-java
X-Debian-Pr-Source: ca-certificates-java
X-Gm-Message-State: APuU4Z8igieJvkiVETsnDUpbpYWlXdu/EWVtV22MVh/dGl8DBnzfSA8V
	jGo/TCfkpeWwwlAwdvJitGtv4ZbT5HT+UYWZcQ8vq2qv/Dht3dVCw0QOAuGnWw==
X-Gm-Gg: AZFdTZevT7LErhdJ3EC1xM3DowqgIxUuJZQsEfMQwgW8DraRFIDGcrWlERxeN4RyPNl
	H4A+euo6JYuhjP8l7Ci55zHcvniKzNuJZ6ezabFSt2WsprVvbkk6P5nSR97hgAGfQOFJ7w5GjEr
	EO8l/ElYBSCsMJq2l2KEyltnS1aag2whc++FBVP9atpFMotRmoVNptob9ivaGRSPqXL5vpPz70V
	RkGoSoJotkNhQiCoKuV0DCFv1jG0/NgTgTB/ltr16wGbvV6I3NOazU29fh78njOZNdJVals23u3
	sD5G51jsC2VKirCfZOuNTLcGKjJvbQlncHP0Tp8IDt9GQIGPKWXk1YgxFv7yqtLlOSpEOtFeOT0
	AnZCDeLgqn1QqmWGix6ADxy0LY1er6f/1PQifw/GXF6MJufJYd0YoGwVII64pf9LypLaJLYJ22d
	Pl5u3CizcbSWZz0xrHG/MmnAZ8RS3SYkoAjPdiTC0nV+lp5crW6qVM01aZWRknWif9H3yfIGywC
	SWFvlBcVQSnG9YKbUv7Jmaj/ipYWmtFBrWOAk8Pp4vuoHnl9qoTS5RKyRCuBM+5W7bY0s0Sn8gT
	3/0uo+LZyeSFvDJ2lheY/P+X/t6+clBL9Z4M
X-Received: by 2002:a05:6102:54a1:b0:7c2:7a0:ae28 with SMTP id ada2fe7eead31-7d73966dae9mr18086179137.30.1795912798770;
        Sat, 28 Nov 2026 16:39:58 -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/2005745
List-ID: <debian-bugs-dist.lists.debian.org>
List-URL: <https://lists.debian.org/debian-bugs-dist/>
Approved: robomod@news.nic.it
Lines: 72
Organization: linux.* mail to news gateway
Sender: robomod@news.nic.it
X-Original-Date: Sat, 28 Nov 2026 21:39:54 -0300
X-Original-Message-ID: <5b025678-f675-4945-a1ea-553aac7fe8cd@gmail.com>