libkernel: the console CA file /<sandbox word>/common/cert/CA_LIST.cer is not provided, so bundled OpenSSL fails every HTTPS request once #4796 lands (ProsperoRadio, SwanStation, PSXS5, ProsperoTV) #5001

Closed
opened 2026-10-13 07:47:06 +00:00 by screamm · 4 comments
screamm commented 2026-10-13 07:47:06 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by screamm on 2026-10-13T07:47:06Z.


Once #4796 (SO_ERROR) and #4525 (POLLPRI) are in, HTTPS from inside the guest gets past the TCP connect, and the next stop for every title that bundles its own OpenSSL is the console's CA file. ProsperoRadio (PPSA99001, bundled libcurl 8.18.0 + OpenSSL 3.5.2), Windows 11 Pro 26220, main c2565f01 + #4796 + #4525:

[ProsperoRadio][http] https://all.api.radio-browser.info/json/servers: Problem with the SSL CA cert (path? access rights?) (error adding trust anchors from file: /gkbHtXc3Wq/common/cert/CA_LIST.cer)

The path is /<sceKernelGetFsSandboxRandomWord()>/common/cert/CA_LIST.cer, which docs/dev/debt/libkernel.md already records as "nothing is mounted under the name". Placing a PEM bundle (Git's ca-bundle.crt) at that path in the run directory, as a test only, makes the whole chain work: ProsperoRadio downloads its catalog (11838693 bytes in 845 ms, accepted=9556, six pages) and SwanStation (PPSA98510) goes from gamedb.yaml -> curl 7, http 0 to gamedb: index written. PSXS5 (PPSA97510) and ProsperoTV (PPSA99003) use the same import set and are expected to follow.

Open design question for the maintainers before anyone implements it: expose the host's trust store at that path (Windows: export the ROOT store to PEM at startup; Linux: the distro bundle such as /etc/ssl/certs/ca-certificates.crt), or ship a bundle. Only that a PEM file works with OpenSSL here is proven; the console's file format is not. A generic mapping of the sandbox-word prefix plus a host-provided PEM would be the smallest change; I can prepare a branch if the direction is agreed.

Traced with Claude Code assistance (the full socket/connect/poll/getsockopt trace is in my comment on #4796).

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5826574102 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/5001). Originally posted by [screamm](https://github.com/screamm) on 2026-10-13T07:47:06Z. --- Once #4796 (SO_ERROR) and #4525 (POLLPRI) are in, HTTPS from inside the guest gets past the TCP connect, and the next stop for every title that bundles its own OpenSSL is the console's CA file. ProsperoRadio (PPSA99001, bundled libcurl 8.18.0 + OpenSSL 3.5.2), Windows 11 Pro 26220, `main` `c2565f01` + #4796 + #4525: ``` [ProsperoRadio][http] https://all.api.radio-browser.info/json/servers: Problem with the SSL CA cert (path? access rights?) (error adding trust anchors from file: /gkbHtXc3Wq/common/cert/CA_LIST.cer) ``` The path is `/<sceKernelGetFsSandboxRandomWord()>/common/cert/CA_LIST.cer`, which `docs/dev/debt/libkernel.md` already records as "nothing is mounted under the name". Placing a PEM bundle (Git's `ca-bundle.crt`) at that path in the run directory, as a test only, makes the whole chain work: ProsperoRadio downloads its catalog (`11838693 bytes in 845 ms`, `accepted=9556`, six pages) and SwanStation (PPSA98510) goes from `gamedb.yaml -> curl 7, http 0` to `gamedb: index written`. PSXS5 (PPSA97510) and ProsperoTV (PPSA99003) use the same import set and are expected to follow. Open design question for the maintainers before anyone implements it: expose the host's trust store at that path (Windows: export the ROOT store to PEM at startup; Linux: the distro bundle such as `/etc/ssl/certs/ca-certificates.crt`), or ship a bundle. Only that a PEM file works with OpenSSL here is proven; the console's file format is not. A generic mapping of the sandbox-word prefix plus a host-provided PEM would be the smallest change; I can prepare a branch if the direction is agreed. Traced with Claude Code assistance (the full `socket`/`connect`/`poll`/`getsockopt` trace is in my comment on #4796).
screamm commented 2026-10-13 09:38:55 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by screamm on 2026-10-13T09:38:55Z.


Fix branch ready: screamm:feat/libkernel-sandbox-ca-list (dc51db5b, one commit on main 2a2a3dc6). Anyone eligible is welcome to carry it, keeping the commit as is; I can also open it as a PR myself now if the maintainers prefer that route.

  • The guest path resolver lives in libc (General.cpp), so it gains AddPathProvider_nid_no_patch(guestPath, provider): one exact normalized path (case-insensitive), consulted only when that path is opened; if the provider yields nothing the path resolves under the guest root as before and stays ENOENT. Every other path under the sandbox word is unchanged.
  • New libkernel/File/src/SandboxCertificates.cpp registers a provider for /<sceKernelGetFsSandboxRandomWord()>/common/cert/CA_LIST.cer. On first open it builds the PEM bundle once per process: Windows exports the user's ROOT and CA stores (CertOpenSystemStoreW, CertEnumCertificatesInStore, CryptBinaryToStringW(CRYPT_STRING_BASE64HEADER); links crypt32), Linux uses SSL_CERT_FILE or the first of /etc/ssl/certs/ca-certificates.crt, /etc/pki/tls/certs/ca-bundle.crt, /etc/ssl/ca-bundle.pem; the result is written read-only to <run>/cert_cache/CA_LIST.cer via temp file and rename, rewritten only when the content changes, and never an empty file (no certificate block means ENOENT; a store or write failure throws). Recorded in docs/dev/debt/libkernel.md: the console's file format (only that OpenSSL accepts PEM is shown), the rest of the common/cert listing, the directory itself and the write-open error are unverified; Windows fetches some roots on demand so the local store can lack them.
  • New guest_sandbox_certificates: reads the file through sceKernelOpen/sceKernelRead and fopen/fread, requires a BEGIN/END CERTIFICATE pair, checks the ./ and lower-case variants, sceKernelStat size, the read-only cache file, and ENOENT for sibling names; on Linux it points SSL_CERT_FILE at its own bundle and compares exactly. The Windows export here gives 119 certificates, all parsed by openssl.

Tested on Windows 11 Pro 26220, WinLibs MinGW-w64 GCC 15.2.0 r7, Ninja, Release, BUILD_TESTING=ON, full build including libs: the new test plus guest_fiopen, guest_realpath, guest_path_case, guest_directory, guest_filesystem, guest_posix_filesystem, guest_shm_open 3/3 (the implementer ran 22 filesystem tests 3/3); ctest -j8 -E "^agc_driver_|^video_out_flip" 688/690, the failures being patched_libraries (broken on main by #4877, fix #5025) and a load timeout of guest_raise_exception; conventions and git diff --check pass. Titles, with #4796 + #4525 + #5025 applied on top and no CA file placed by hand: ProsperoRadio downloads its whole catalog (11846160 bytes in 1458 ms, seven pages, total=59371) and is still rendering at 60 s; SwanStation logs update: latest 1.2.5, this 1.1.3, available, gamedb: index written, update: installed 1.2.5 (249 files), its self-updater now really downloading. Not run on Linux.

Written with Claude Code assistance (implementation by a subagent, reviewed and validated in this session).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6142705348 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/5001#issuecomment-6142705348). Originally posted by [screamm](https://github.com/screamm) on 2026-10-13T09:38:55Z. --- Fix branch ready: [`screamm:feat/libkernel-sandbox-ca-list`](https://github.com/screamm/AnyPS5/tree/feat/libkernel-sandbox-ca-list) (`dc51db5b`, one commit on `main` `2a2a3dc6`). Anyone eligible is welcome to carry it, keeping the commit as is; I can also open it as a PR myself now if the maintainers prefer that route. - The guest path resolver lives in libc (`General.cpp`), so it gains `AddPathProvider_nid_no_patch(guestPath, provider)`: one exact normalized path (case-insensitive), consulted only when that path is opened; if the provider yields nothing the path resolves under the guest root as before and stays `ENOENT`. Every other path under the sandbox word is unchanged. - New `libkernel/File/src/SandboxCertificates.cpp` registers a provider for `/<sceKernelGetFsSandboxRandomWord()>/common/cert/CA_LIST.cer`. On first open it builds the PEM bundle once per process: Windows exports the user's `ROOT` and `CA` stores (`CertOpenSystemStoreW`, `CertEnumCertificatesInStore`, `CryptBinaryToStringW(CRYPT_STRING_BASE64HEADER)`; links `crypt32`), Linux uses `SSL_CERT_FILE` or the first of `/etc/ssl/certs/ca-certificates.crt`, `/etc/pki/tls/certs/ca-bundle.crt`, `/etc/ssl/ca-bundle.pem`; the result is written read-only to `<run>/cert_cache/CA_LIST.cer` via temp file and rename, rewritten only when the content changes, and never an empty file (no certificate block means `ENOENT`; a store or write failure throws). Recorded in `docs/dev/debt/libkernel.md`: the console's file format (only that OpenSSL accepts PEM is shown), the rest of the `common/cert` listing, the directory itself and the write-open error are unverified; Windows fetches some roots on demand so the local store can lack them. - New `guest_sandbox_certificates`: reads the file through `sceKernelOpen`/`sceKernelRead` and `fopen`/`fread`, requires a BEGIN/END CERTIFICATE pair, checks the `./` and lower-case variants, `sceKernelStat` size, the read-only cache file, and `ENOENT` for sibling names; on Linux it points `SSL_CERT_FILE` at its own bundle and compares exactly. The Windows export here gives 119 certificates, all parsed by openssl. Tested on Windows 11 Pro 26220, WinLibs MinGW-w64 GCC 15.2.0 r7, Ninja, Release, `BUILD_TESTING=ON`, full build including `libs`: the new test plus `guest_fiopen`, `guest_realpath`, `guest_path_case`, `guest_directory`, `guest_filesystem`, `guest_posix_filesystem`, `guest_shm_open` 3/3 (the implementer ran 22 filesystem tests 3/3); `ctest -j8 -E "^agc_driver_|^video_out_flip"` 688/690, the failures being `patched_libraries` (broken on `main` by #4877, fix #5025) and a load timeout of `guest_raise_exception`; conventions and `git diff --check` pass. Titles, with #4796 + #4525 + #5025 applied on top and no CA file placed by hand: ProsperoRadio downloads its whole catalog (`11846160 bytes in 1458 ms`, seven pages, `total=59371`) and is still rendering at 60 s; SwanStation logs `update: latest 1.2.5, this 1.1.3, available`, `gamedb: index written`, `update: installed 1.2.5 (249 files)`, its self-updater now really downloading. Not run on Linux. Written with Claude Code assistance (implementation by a subagent, reviewed and validated in this session).
milescoviello commented 2026-10-13 09:46:50 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-13T09:46:50Z.


Linux run of screamm:feat/libkernel-sandbox-ca-list (dc51db5b4, on main 2a2a3dc6), since the branch hasn't been run on Linux yet. Ubuntu 24.04, GCC 13.3 (CI's compiler), Release with CI's configure flags:

  • The build is clean. guest_sandbox_certificates passes 20/20, and all 335 guest_* tests pass in two runs.
  • I also ran the distro path that the test skips, because it sets SSL_CERT_FILE to its own bundle. With that line removed, the file served at /gkbHtXc3Wq/common/cert/CA_LIST.cer is byte for byte /etc/ssl/certs/ca-certificates.crt: 183320 bytes, 122 certificates, all parsed by openssl pkcs7 -print_certs.
  • I then ran the unchanged test over that read-only cached copy. The cache was rewritten to the test's bundle and left read-only, with no .tmp file left behind.

I haven't run a title on Linux, and the design question above is still the maintainers' to answer.

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6142840539 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/5001#issuecomment-6142840539). Originally posted by [milescoviello](https://github.com/milescoviello) on 2026-10-13T09:46:50Z. --- Linux run of `screamm:feat/libkernel-sandbox-ca-list` (`dc51db5b4`, on `main` `2a2a3dc6`), since the branch hasn't been run on Linux yet. Ubuntu 24.04, GCC 13.3 (CI's compiler), Release with CI's configure flags: - The build is clean. `guest_sandbox_certificates` passes 20/20, and all 335 `guest_*` tests pass in two runs. - I also ran the distro path that the test skips, because it sets `SSL_CERT_FILE` to its own bundle. With that line removed, the file served at `/gkbHtXc3Wq/common/cert/CA_LIST.cer` is byte for byte `/etc/ssl/certs/ca-certificates.crt`: 183320 bytes, 122 certificates, all parsed by `openssl pkcs7 -print_certs`. - I then ran the unchanged test over that read-only cached copy. The cache was rewritten to the test's bundle and left read-only, with no `.tmp` file left behind. I haven't run a title on Linux, and the design question above is still the maintainers' to answer. AI-assisted: yes
santhoshkumar-dev commented 2026-10-13 16:24:56 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by santhoshkumar-dev on 2026-10-13T16:24:56Z.


Opened #5280, originally carrying @screamm's dc51db5b4 unchanged and adding a separate follow-up commit for Windows distrust/TLS-usage filtering and supplied-file/alias/blocked-mount precedence.

Local validation on e8f179733: full Windows build and 125 patched libraries, sandbox/path tests on Windows and Ubuntu/WSL2, in-memory certificate-store tests, and negative controls that fail when the corresponding fixes are removed. That validation used the original commit before rebasing. Main 0214069e3 was subsequently merged in 8fd97c296, retaining both Crypt32 and the new hardware-service dependencies; Windows/Linux sandbox/path tests and conventions pass after that merge.

I also reran the public homebrew packages on a separate validation branch with #4796 + #4525 (excluded from the PR; #5025 is on the base), without placing a CA file manually:

  • ProsperoRadio 01.000.010 downloaded three catalog pages and accepted 28,865 stations within the 60-second test window.
  • SwanStation 1.2.4 wrote its game database and installed 1.2.5 (249 files). It later reported Vulkan device loss; this is recorded in the PR, with no rendering/gameplay stability claim.

Both used the automatically generated 66-certificate Windows bundle. The host-trust design remains for maintainers to review. AI-assisted: yes.

Update 2026-10-14: per the maintainer request on #5280, rebased onto main 31bfc4e86 (head 5f1b1fe01), retaining the original author/coauthor attribution in two feature commits with no merge commits. Four Windows and three Ubuntu/WSL2 sandbox/path tests pass in a fresh checkout, along with conventions. The revision-specific results above describe the earlier validation; the host-trust design still awaits the decision in this issue.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6150162828 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/5001#issuecomment-6150162828). Originally posted by [santhoshkumar-dev](https://github.com/santhoshkumar-dev) on 2026-10-13T16:24:56Z. --- Opened #5280, originally carrying @screamm's dc51db5b4 unchanged and adding a separate follow-up commit for Windows distrust/TLS-usage filtering and supplied-file/alias/blocked-mount precedence. Local validation on e8f179733: full Windows build and 125 patched libraries, sandbox/path tests on Windows and Ubuntu/WSL2, in-memory certificate-store tests, and negative controls that fail when the corresponding fixes are removed. That validation used the original commit before rebasing. Main 0214069e3 was subsequently merged in 8fd97c296, retaining both Crypt32 and the new hardware-service dependencies; Windows/Linux sandbox/path tests and conventions pass after that merge. I also reran the public homebrew packages on a separate validation branch with #4796 + #4525 (excluded from the PR; #5025 is on the base), without placing a CA file manually: - ProsperoRadio 01.000.010 downloaded three catalog pages and accepted 28,865 stations within the 60-second test window. - SwanStation 1.2.4 wrote its game database and installed 1.2.5 (249 files). It later reported Vulkan device loss; this is recorded in the PR, with no rendering/gameplay stability claim. Both used the automatically generated 66-certificate Windows bundle. The host-trust design remains for maintainers to review. AI-assisted: yes. Update 2026-10-14: per the maintainer request on #5280, rebased onto main 31bfc4e86 (head 5f1b1fe01), retaining the original author/coauthor attribution in two feature commits with no merge commits. Four Windows and three Ubuntu/WSL2 sandbox/path tests pass in a fresh checkout, along with conventions. The revision-specific results above describe the earlier validation; the host-trust design still awaits the decision in this issue.
screamm commented 2026-10-17 08:14:33 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by screamm on 2026-10-17T08:14:33Z.


Closing: #5280 merged into main as dfdc3dec4 (2026-10-17) and carries the host-trust-store CA list this issue asked for (commit 9f4a8d6ec is included in that PR). The CA_LIST.cer path is now served from the host roots on Windows, Linux and macOS, so the bundled OpenSSL no longer fails HTTPS on the titles listed above. Follow-ups, if any, belong on new issues with the title ID and the verbatim stop line on current main.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6231614353 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/5001#issuecomment-6231614353). Originally posted by [screamm](https://github.com/screamm) on 2026-10-17T08:14:33Z. --- Closing: #5280 merged into `main` as dfdc3dec4 (2026-10-17) and carries the host-trust-store CA list this issue asked for (commit 9f4a8d6ec is included in that PR). The `CA_LIST.cer` path is now served from the host roots on Windows, Linux and macOS, so the bundled OpenSSL no longer fails HTTPS on the titles listed above. Follow-ups, if any, belong on new issues with the title ID and the verbatim stop line on current `main`.
Sign in to join this conversation.
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5#5001
No description provided.