From ded3e4df95897fd2c72f673385608d665af11780 Mon Sep 17 00:00:00 2001 From: Juan Bono Date: Tue, 1 Dec 2026 18:48:25 -0300 Subject: [PATCH] fix: add a private CA to the system store, not SSL_CERT_FILE alone; cache the CA layer `SSL_CERT_FILE` and `SSL_CERT_DIR` replace the system store rather than add to it, and in the default image embedded ethrex's native-tls clients read them too, with no compiled-in roots to fall back on. The docs and the Dockerfile suggested naming a private CA with `SSL_CERT_FILE`, which, with a file holding that CA alone, leaves ethrex unable to reach any public endpoint: #944 again. They now say to add the CA to the system store (`update-ca-certificates`), or to name a copy of the whole bundle with it appended. The `ca-certificates` RUN came after `ARG GIT_COMMIT`, `GIT_BRANCH` and `VERSION`, which Docker passes to every later RUN as environment, so every new commit invalidated the layer and ran apt-get again. It now comes before them. --- Dockerfile | 21 +++++++++++++++------ docs/cli.md | 10 ++++++++-- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index db8329cd8..03d31f54e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -69,20 +69,29 @@ LABEL org.opencontainers.image.source=https://github.com/lambdaclass/ethlambda LABEL org.opencontainers.image.description="A minimalist and fast Beacon Chain and Lean Chain client written in Rust by LambdaClass" LABEL org.opencontainers.image.licenses="MIT" -ARG GIT_COMMIT=unknown -ARG GIT_BRANCH=unknown -ARG VERSION=dev - # A CA store. ethlambda's own HTTP clients use rustls and trust it next to the -# roots compiled into the binary, so they work without one, and a private CA -# added to it (or named by `SSL_CERT_FILE`) is trusted. The `include-ethrex` +# roots compiled into the binary, so they work without one. The `include-ethrex` # build also compiles reqwest's native-tls backend in (ethrex keeps reqwest's # default features), and embedded ethrex's clients read the system store alone: # without one, every HTTPS request they make fails (#944). +# +# A private CA goes into this store: a derived image that adds it under +# /usr/local/share/ca-certificates and runs `update-ca-certificates`, or a copy +# of /etc/ssl/certs/ca-certificates.crt with the CA appended, named by +# `SSL_CERT_FILE`. Never a file holding the CA alone: `SSL_CERT_FILE` replaces +# the store for ethrex's OpenSSL clients too, and they have no compiled-in roots +# to fall back on, so every public request they make would fail. +# +# Above the ARGs: a RUN after an ARG gets it in its environment, so a new +# commit would invalidate this layer and run apt-get again. RUN apt-get update \ && apt-get install -y --no-install-recommends ca-certificates \ && rm -rf /var/lib/apt/lists/* +ARG GIT_COMMIT=unknown +ARG GIT_BRANCH=unknown +ARG VERSION=dev + LABEL org.opencontainers.image.revision=$GIT_COMMIT LABEL org.opencontainers.image.ref.name=$GIT_BRANCH LABEL org.opencontainers.image.version=$VERSION diff --git a/docs/cli.md b/docs/cli.md index ad8a06079..ea8ad8672 100644 --- a/docs/cli.md +++ b/docs/cli.md @@ -1212,8 +1212,14 @@ binary (`webpki-roots`), as is every HTTPS request ethlambda itself makes (checkpoint sync, the Engine API, a builder relay, the beacon node API, ClickHouse telemetry; embedded ethrex's own requests read the system store alone). A signer behind an internal CA is therefore reached once -that CA is in the system store, or in a PEM file named by `SSL_CERT_FILE` (or a -directory named by `SSL_CERT_DIR`), which then stands in for the system store. +that CA is in the system store: on Debian or Ubuntu (the image included), a +certificate under `/usr/local/share/ca-certificates/` and a run of +`update-ca-certificates`. `SSL_CERT_FILE` (a PEM file) or `SSL_CERT_DIR` (a +directory) replaces the system store rather than adding to it, and embedded +ethrex reads them too, with no compiled-in roots to fall back on. One of them +must therefore name a copy of the whole store with the CA added (say +`/etc/ssl/certs/ca-certificates.crt` with the CA appended), never the CA alone, +which would leave ethrex unable to reach any public endpoint. The store is read when a client is built, which for all but a signer added through the keymanager API is at startup, so a CA added later takes a restart. There is no per-signer CA option (Lighthouse's