Skip to content

Commit 89dd082

Browse files
committed
Fix flatpak TLS without touching the system CA store
Revert the update-ca-trust approach, which regenerated the system CA bundle and stripped the Pulp cert (p11-kit rejects non-CA certs), breaking all Python bindings tests. Instead, configure the OSTree remote's tls-ca-path directly after flatpak remote-add. This scopes the TLS trust change to the flatpak remote only, leaving the system CA store and certifi untouched. Made-with: Cursor
1 parent 0ab9b11 commit 89dd082

2 files changed

Lines changed: 41 additions & 6 deletions

File tree

.github/workflows/scripts/post_before_script.sh

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,4 @@ SCENARIOS=("pulp" "performance" "azure" "gcp" "s3" "generate-bindings" "lowerbou
22
if [[ " ${SCENARIOS[*]} " =~ " ${TEST} " ]]; then
33
# Needed by pulp_container/tests/functional/api/test_flatpak.py:
44
cmd_prefix dnf install -yq dbus-daemon flatpak
5-
6-
# Add the Pulp CA cert to the system trust store inside the container so that
7-
# flatpak/OSTree (which uses GLib/GIO) trusts the Pulp registry's TLS certificate.
8-
# Using cp + update-ca-trust extract (the standard RHEL9 approach) rather than
9-
# "trust anchor", which behaved unexpectedly when given the full CA bundle path.
10-
cmd_prefix bash -c "cp /etc/pulp/certs/pulp_webserver.crt /etc/pki/ca-trust/source/anchors/ && update-ca-trust extract"
115
fi

pulp_container/tests/functional/api/test_flatpak.py

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
"""Tests that verify Flatpak support"""
22

3+
import os
34
import pytest
45
import subprocess
6+
from urllib.parse import urlparse
57

68
from pulp_container.tests.functional.constants import REGISTRY_V2
79

@@ -17,6 +19,45 @@ def run_flatpak_commands(host):
1719
"oci+" + host,
1820
]
1921
)
22+
23+
# OSTree (used by flatpak) verifies TLS against the system CA store, not certifi.
24+
# For CI environments using a self-signed cert, configure the remote to trust
25+
# the Pulp CA directly rather than relying on system-wide CA trust, which would
26+
# interfere with the Python bindings trust setup in script.sh.
27+
if urlparse(host).scheme == "https":
28+
flatpak_user_repo = os.path.expanduser("~/.local/share/flatpak/repo")
29+
ca_cert = "/etc/pulp/certs/pulp_webserver.crt"
30+
if os.path.exists(ca_cert):
31+
subprocess.run(
32+
[
33+
"ostree",
34+
"config",
35+
"--repo",
36+
flatpak_user_repo,
37+
"--group",
38+
'remote "pulptest"',
39+
"set",
40+
"tls-ca-path",
41+
ca_cert,
42+
],
43+
check=False,
44+
)
45+
else:
46+
subprocess.run(
47+
[
48+
"ostree",
49+
"config",
50+
"--repo",
51+
flatpak_user_repo,
52+
"--group",
53+
'remote "pulptest"',
54+
"set",
55+
"tls-permissive",
56+
"true",
57+
],
58+
check=False,
59+
)
60+
2061
# See <https://pagure.io/fedora-lorax-templates/c/cc1155372046baa58f9d2cc27a9e5473bf05a3fb>
2162
# "lorax-embed-flatpaks.tmpl: Run the flatpak-install under dbus-run-session" for the need for
2263
# dbus-run-session to avoid "error: Cannot autolaunch D-Bus without X11 $DISPLAY":

0 commit comments

Comments
 (0)