feat(broker): let a confined worker read openssl's configuration

Merged
KI
23d ago
+97-13

Problem

A confined worker cannot start Node.js. Node's OpenSSL reads its configuration file at startup and stops with exit 13 when it gets EACCES:

/usr/bin/node: OpenSSL configuration error:
…:error:8000000D:system library:BIO_new_file:Permission denied:…:calling fopen(/usr/lib/ssl/openssl.cnf, rb)

#95 and #98 measured this on Ubuntu 26.04, Debian 13, Fedora 45, Arch, and Alpine 3.24, each with its own Node.js. On every one, Node.js started once that single file was readable. The file is /etc/ssl/openssl.cnf, which Debian reaches through /usr/lib/ssl/openssl.cnf, and /etc/pki/tls/openssl3.cnf on Fedora. The maintainer chose to make it a default rather than leave every Node.js user to pass --direct.

Change

  • /etc/ssl/openssl.cnf and /etc/pki/tls/openssl3.cnf join /etc/ld.so.cache as runtime files the worker may only read (confine.rs, RUNTIME_FILES). As before, a file that does not exist is skipped.
    • The rule is on the file itself, not its directory, so the worker still cannot list /etc/ssl or read anything beside the file.
    • On Fedora, /etc/ssl/openssl.cnf links to /etc/pki/tls/openssl.cnf, so the rule covers that file too.
  • A new test, kernel::a_confined_worker_can_read_openssl_configuration, has the worker read each of the two files the host has. It also checks that /etc/passwd and a listing of /etc/ssl are still refused, where each resolves inside /etc.

Safety and compatibility

  • Every confined worker can now read these files, without an audit event, as it can /etc/ld.so.cache. They are configuration, readable by every local user on the systems measured, and hold no data a grant should carry.
  • A grant that contains one of the files is not refused, because single runtime files are not compared, as RFC 0008 already says for /etc/ld.so.cache. A grant over /etc/ssl is therefore allowed and partly readable directly, but only that one file.
  • Some existing commands could now fail. If /etc/ssl or /etc/pki/tls exists but cannot be opened, the worker now fails to start and names the file. allow_if_present skips only a missing file. This has not been seen on any system measured.
  • The other files in /etc (name lookups, CA certificates, /etc/gitconfig, /etc/passwd) stay opt-in with --direct, as #95 and #98 document.

Verification

  • The test fails without the change: CI on 04e2a42, which has only the test. On the runner's Ubuntu, check and arm64 both failed with reading /etc/ssl/openssl.cnf failed: Permission denied (os error 13). It was the only failure in each: check passed 48 tests and arm64 47, with 2 ignored in each.
  • The first run with the change failed in the test's own check: CI on c22cf21. In distros (ubuntu-26.04-arm, nix) the worker read /etc/passwd, which the test expected refused. In the nixos/nix image that file links into /nix/store, which a confined worker may read since #83. 783baa5 now runs the two refusal checks only where the path resolves inside /etc, and RFC 0008 notes the Nix case. I cancelled the rest of that run once it was superseded.
  • The test passes with the change: CI on 783baa5, pending.
  • Locally, on macOS 26.2 with Rust 1.99.1:
    • cargo fmt --all --check: clean.
    • cargo clippy --all-targets --locked -- -D warnings: clean. So was clippy for x86_64-unknown-linux-gnu and aarch64-unknown-linux-gnu, and for x86_64-unknown-linux-gnu with experimental-intercept. That is a type-check of the Linux code, not a run.
    • cargo test --locked: 121 passed. The new test is Linux-only.
    • RUSTDOCFLAGS='-D warnings' cargo doc --locked --no-deps: clean.

Not verified:

  • Node.js itself under the new defaults. The probes showed this one file was all each Node.js needed to start: they ran Node with --direct for exactly that file, which sets the same read rule on the same file this change does. Node was not run again with this commit.
  • Systems where neither file exists, such as the nixos/nix image. There the test checks only the refusals.

Documentation and release

  • RFC 0008: the default rules table, a fourth decision, the status line, and a note under "Programs that read files in /etc".
  • README: the paragraph on confinement says the worker can read OpenSSL's configuration. The status section says this is implemented and not yet released.
  • Threat model: the runtime-paths row names the single files.
  • CHANGELOG.md: a new Unreleased section with the entry under Changed.
  • Roadmap: the M10 evidence line records the decision.