From 6da4e49db3c15bde6ca14e2937dccfdb4a98f130 Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Fri, 30 Oct 2026 00:19:56 +0100 Subject: [PATCH 1/2] fix(web-app-nextcloud): let the recording server verify self-signed TLS through the injected CA bundle On a clearnet deploy with self-signed TLS, test-talk-recording.js failed three times: the call recording stayed at state 4 (starting audio) because the recording server could not notify Nextcloud. Its log showed CERTIFICATE_VERIFY_FAILED on POST /ocs/v2.php/apps/spreed/api/v1/recording/backend, although compose-ca sets REQUESTS_CA_BUNDLE to the mounted bundle. nextcloud-talk-recording's BackendNotifier sends through `session.send(prepared, verify=True)`, and Session.send() skips the environment merge that only Session.request() does, so requests falls back to certifi's bundle, which does not know the injected root CA. A probe in the recording container's network namespace verified Nextcloud with the mounted bundle (200) and failed without it. When the CA is injected, the recording image now points certifi's cacert.pem at the mounted CA bundle (the system CAs plus the injected root), in the same build step as the Firefox certificate policy. Verification stays on. Without an injected CA, as with real certificates, the build arg is empty and the image is unchanged. Co-Authored-By: Claude Opus 5.5 (1M context) --- .../files/Dockerfiles/Recording/Dockerfile | 4 ++++ roles/web-app-nextcloud/templates/compose.yml.j2 | 1 + roles/web-app-nextcloud/vars/main.yml | 1 + .../python/roles/web-app-nextcloud/test_talk_configs.py | 6 ++++++ .../roles/web-app-nextcloud/test_talk_direct_media.py | 1 + 5 files changed, 13 insertions(+) diff --git a/roles/web-app-nextcloud/files/Dockerfiles/Recording/Dockerfile b/roles/web-app-nextcloud/files/Dockerfiles/Recording/Dockerfile index c64cd5e1f5..3a6dc1bd35 100644 --- a/roles/web-app-nextcloud/files/Dockerfiles/Recording/Dockerfile +++ b/roles/web-app-nextcloud/files/Dockerfiles/Recording/Dockerfile @@ -40,9 +40,13 @@ RUN set -ex; \ linux-headers ARG RECORDING_CA_CERT +ARG RECORDING_CA_BUNDLE RUN if [ -n "${RECORDING_CA_CERT}" ]; then \ mkdir -p /etc/firefox/policies \ && printf '{"policies":{"Certificates":{"Install":["%s"]}}}\n' "${RECORDING_CA_CERT}" > /etc/firefox/policies/policies.json; \ + fi \ + && if [ -n "${RECORDING_CA_BUNDLE}" ]; then \ + ln -sf "${RECORDING_CA_BUNDLE}" "$(python3 -c 'import certifi; print(certifi.where())')"; \ fi WORKDIR ${RECORDING_DIRECTORY} diff --git a/roles/web-app-nextcloud/templates/compose.yml.j2 b/roles/web-app-nextcloud/templates/compose.yml.j2 index 4c353b9171..47458ec484 100644 --- a/roles/web-app-nextcloud/templates/compose.yml.j2 +++ b/roles/web-app-nextcloud/templates/compose.yml.j2 @@ -222,6 +222,7 @@ RECORDING_DIRECTORY: "{{ NEXTCLOUD_RECORDING_DIRECTORY }}" RECORDING_CONFIG_DIRECTORY: "{{ NEXTCLOUD_RECORDING_CONFIG_TARGET | dirname }}" RECORDING_CA_CERT: "{{ NEXTCLOUD_RECORDING_CA_CERT }}" + RECORDING_CA_BUNDLE: "{{ NEXTCLOUD_RECORDING_CA_BUNDLE }}" {{ lookup('compose_only', 'pull_policy', 'never') }} {{ lookup('container_image', application_id, service_name, version=NEXTCLOUD_RECORDING_TAG) }} {{ lookup('compose_only', 'container_name', NEXTCLOUD_RECORDING_CONTAINER) }} diff --git a/roles/web-app-nextcloud/vars/main.yml b/roles/web-app-nextcloud/vars/main.yml index e18c9ea95e..924a767869 100644 --- a/roles/web-app-nextcloud/vars/main.yml +++ b/roles/web-app-nextcloud/vars/main.yml @@ -256,6 +256,7 @@ NEXTCLOUD_RECORDING_CONFIG_HOST: "{{ [ lookup('container', application_id, 'dire NEXTCLOUD_RECORDING_CONFIG_TARGET: "{{ lookup('volume', application_id, 'talk_recording_conf').target }}" NEXTCLOUD_RECORDING_DIRECTORY: "{{ lookup('volume', application_id, 'talk_recording_tmp').target }}" NEXTCLOUD_RECORDING_CA_CERT: "{{ CA_TRUST.inject_cert_container if lookup('ca_injected', application_id) else '' }}" +NEXTCLOUD_RECORDING_CA_BUNDLE: "{{ CA_TRUST.inject_bundle_container if lookup('ca_injected', application_id) else '' }}" NEXTCLOUD_COLLABORA_URL: "{{ lookup('tls', 'web-svc-collabora', 'url.base') }}" diff --git a/tests/unit/python/roles/web-app-nextcloud/test_talk_configs.py b/tests/unit/python/roles/web-app-nextcloud/test_talk_configs.py index 5c99d89ba0..c02e2f70b8 100644 --- a/tests/unit/python/roles/web-app-nextcloud/test_talk_configs.py +++ b/tests/unit/python/roles/web-app-nextcloud/test_talk_configs.py @@ -46,6 +46,7 @@ VARIABLES = { "NEXTCLOUD_RECORDING_USER_ID": 122, "NEXTCLOUD_RECORDING_CONFIG_TARGET": "/conf/recording.conf", "NEXTCLOUD_RECORDING_CA_CERT": "/tmp/infinito/ca/root-ca.crt", + "NEXTCLOUD_RECORDING_CA_BUNDLE": "/tmp/infinito/ca/ca-bundle.crt", } AIO_SIGNALING = { @@ -347,6 +348,11 @@ class TestTalkDockerfiles(unittest.TestCase): '"/tmp/infinito/ca/root-ca.crt" > /etc/firefox/policies/policies.json', rendered, ) + self.assertIn( + 'ln -sf "/tmp/infinito/ca/ca-bundle.crt" ' + "\"$(python3 -c 'import certifi; print(certifi.where())')\"", + rendered, + ) self.assertIn("USER 122", rendered) self.assertIn( 'ENTRYPOINT ["python", "-m", "nextcloud.talk.recording"]', rendered diff --git a/tests/unit/python/roles/web-app-nextcloud/test_talk_direct_media.py b/tests/unit/python/roles/web-app-nextcloud/test_talk_direct_media.py index 0c8dae4f7a..4bf346cb04 100644 --- a/tests/unit/python/roles/web-app-nextcloud/test_talk_direct_media.py +++ b/tests/unit/python/roles/web-app-nextcloud/test_talk_direct_media.py @@ -106,6 +106,7 @@ RECORDING = """ talk_recording: RECORDING_DIRECTORY: "" RECORDING_CONFIG_DIRECTORY: ">" RECORDING_CA_CERT: "" + RECORDING_CA_BUNDLE: "" }> )> From 88d138ba1ca76b853581adee6b514882ac49b9ee Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Fri, 30 Oct 2026 00:46:44 +0100 Subject: [PATCH 2/2] style: rewrap three test lines past ruff's line length make autoformat rewraps the firewall-backend entry in test_userland_proxy.py, the _direct_media call in test_talk_direct_media.py and the _git listing context in test_files.py, which ran past 88 characters. The text is ruff's own output, the same store-i18n commits, so the next merge between the lines resolves cleanly. Co-Authored-By: Claude Opus 5.5 (1M context) --- .../python/roles/sys-svc-container/test_userland_proxy.py | 4 +++- .../python/roles/web-app-nextcloud/test_talk_direct_media.py | 4 +++- tests/unit/python/utils/cache/test_files.py | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/tests/unit/python/roles/sys-svc-container/test_userland_proxy.py b/tests/unit/python/roles/sys-svc-container/test_userland_proxy.py index 463c7bdbe9..7a210fbc5c 100644 --- a/tests/unit/python/roles/sys-svc-container/test_userland_proxy.py +++ b/tests/unit/python/roles/sys-svc-container/test_userland_proxy.py @@ -36,7 +36,9 @@ def _daemon_json(**overrides): "swarm": {"registry": {"host": "", "port": 5000}}, "groups": {"svc-registry-cache": []}, "ansible_facts": {"os_family": "Debian"}, - "SYS_SVC_CONTAINER_DOCKER_FIREWALL_BACKEND_BY_OS_FAMILY": {"Debian": "iptables"}, + "SYS_SVC_CONTAINER_DOCKER_FIREWALL_BACKEND_BY_OS_FAMILY": { + "Debian": "iptables" + }, "NETWORK_DOCKER_ADDRESS_POOLS": [{"base": "10.208.0.0/12", "size": 24}], "sys_svc_container_kvm": _shim(False), "sys_svc_container_kata_shim": _shim(False), diff --git a/tests/unit/python/roles/web-app-nextcloud/test_talk_direct_media.py b/tests/unit/python/roles/web-app-nextcloud/test_talk_direct_media.py index 4bf346cb04..45f2835ffd 100644 --- a/tests/unit/python/roles/web-app-nextcloud/test_talk_direct_media.py +++ b/tests/unit/python/roles/web-app-nextcloud/test_talk_direct_media.py @@ -373,7 +373,9 @@ class TestDirectMediaFlag(unittest.TestCase): def test_the_loopback_placeholder_keeps_it_off(self): self.assertIs( - _direct_media(list(STANDALONE_TURN), ip4="127.0.0.1", applications=OPTED_IN), + _direct_media( + list(STANDALONE_TURN), ip4="127.0.0.1", applications=OPTED_IN + ), False, ) diff --git a/tests/unit/python/utils/cache/test_files.py b/tests/unit/python/utils/cache/test_files.py index 08851cd066..f934c6778b 100644 --- a/tests/unit/python/utils/cache/test_files.py +++ b/tests/unit/python/utils/cache/test_files.py @@ -208,7 +208,9 @@ class TestRepositoryFiles(_ProjectRootFixture, unittest.TestCase): def test_leaves_out_a_tracked_file_deleted_in_the_worktree(self) -> None: gone = "roles/web-app-nextcloud/filter_plugins/gone.py" - with self._git(f"{self.TRACKED}\0{gone}\0".encode(), f"{gone}\0".encode()) as run: + with self._git( + f"{self.TRACKED}\0{gone}\0".encode(), f"{gone}\0".encode() + ) as run: self.assertEqual((self.TRACKED,), files_module.repository_files()) self.assertEqual(["--deleted"], run.call_args_list[1].args[0][-1:])