Skip to content

Commit 5a2e599

Browse files
davdhacsclaude
andcommitted
fix: Add update-ca-trust workaround for unprivileged containers
In UBI9, update-ca-trust fails when running as an unprivileged user (nobody:nobody) because it attempts to write to system-wide paths. Use the -o flag to specify a user-writable output directory. Also switch restore-all-dir-contents to use --no-clobber to avoid overwriting CA trust files that were already updated at runtime. See: https://bugzilla.redhat.com/show_bug.cgi?id=2241240 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 0f8c870 commit 5a2e599

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

image/scanner/scripts/import-additional-cas

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,6 @@ copy_existing /usr/local/share/ca-certificates
1919
# Copy the custom trusted CA bundles injected by the Openshift Network Operator.
2020
copy_existing /etc/pki/injected-ca-trust
2121

22-
update-ca-trust extract
22+
# The -o flag is required for running as an unprivileged user in containers.
23+
# See: https://bugzilla.redhat.com/show_bug.cgi?id=2241240
24+
update-ca-trust extract -o /etc/pki/ca-trust/extracted

image/scanner/scripts/restore-all-dir-contents

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ set -euo pipefail
44

55
[ -d /.init-dirs ] || exit 0
66

7-
cp -rfP /.init-dirs/* /
7+
cp --recursive --no-dereference --no-clobber /.init-dirs/* /

image/scanner/scripts/trust-root-ca

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,7 @@ CA_PATH="/run/secrets/stackrox.io/certs/ca.pem"
66

77
# For RHEL
88
cp "${CA_PATH}" /etc/pki/ca-trust/source/anchors/root-ca.pem
9-
update-ca-trust
9+
10+
# The -o flag is required for running as an unprivileged user in containers.
11+
# See: https://bugzilla.redhat.com/show_bug.cgi?id=2241240
12+
update-ca-trust extract -o /etc/pki/ca-trust/extracted

0 commit comments

Comments
 (0)