You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
v1.6.7 (ghcr.io/tracemachina/nativelink:v1.6.7) and main at 76392b5. Cargo.lock: hyper-rustls 0.27.7, rustls-platform-verifier 0.6.2, rustls-native-certs 0.8.2.
Client
Buck2 (not client-specific; happens before any client connects)
If no CA roots can be loaded, S3Store::new (and the GCS/R2/OCI constructors) should return a nativelink_error::Error that names the store and the remedy (mount a CA bundle and point SSL_CERT_FILE/SSL_CERT_DIR at it), the same way the ONTAP store already does via with_native_roots()?. Ideally CommonObjectSpec should also accept a root_certificates path like OntapS3Spec does, so the bundle can be configured in-file rather than only through an undocumented environment variable.
Actual behavior
The process aborts with a panic from a third-party expect during store construction, before serving anything.
TlsClient::new_with_http_support builds the connector with the panicking HttpsConnectorBuilder::new().with_platform_verifier():
let connector_with_roots = HttpsConnectorBuilder::new().with_platform_verifier();
In hyper-rustls 0.27.7 that method is self.try_with_platform_verifier().expect("failure to initialize platform verifier") (src/connector/builder.rs#L76-L79). On Linux rustls-platform-verifier loads roots with rustls-native-certs and returns Err(rustls::Error::General("No CA certificates were loaded from the system")) when the resulting store is empty (rustls-platform-verifier/src/verification/others.rs#L94-L110), so the expect fires.
The official image is built by nativelinkImageFor in flake.nix with copyToRoot containing only the nativelink /bin (pkgs.cacert appears only as a build-time buildInputs entry, not in the image):
So any experimental_cloud_object_store with provider: "aws" | "gcs" | "r2" panics on first start in the stock image unless the operator already knows to mount a CA bundle and set SSL_CERT_FILE. The same TlsClient::new is used by s3_store.rs#L112-L113, r2_store.rs#L49, oci_store.rs#L58 and ontap_s3_existence_cache_store.rs#L418, all of which are already inside Result-returning constructors.
Why this is a defect rather than "bring your own certs":
Bundle Certificate Authorities #708 / Re-add cacerts to nativelink image #810 settled on not bundling CAs in the image, which is fine. But the failure mode should be a config error, not a panic. The ONTAP path already gets this right: ontap_s3_store.rs#L133-L139 uses ClientConfig::builder().with_native_roots()? and propagates the error.
CommonObjectSpec (nativelink-config/src/stores.rs#L1322) has no root_certificates field, while OntapS3Spec has one (stores.rs#L861). For aws/gcs/r2 the only knob is the SSL_CERT_FILE/SSL_CERT_DIR env var honoured by rustls-native-certs, which is not mentioned anywhere in the repo (no hits for SSL_CERT_FILE in code, docs, or kubernetes/).
web/apps/docs/content/docs/how-to/stores/s3-and-compatible.mdx#L123-L125 says "Without it, the system roots are used" (in the ONTAP section) without noting that the published image has no system roots, and the aws/gcs/r2 sections do not mention trust roots at all.
Logs / error output
Expected form of the panic (message from hyper-rustls expect, error is Debug-formatted):
thread '...' panicked at .../hyper-rustls-0.27.7/src/connector/builder.rs:...:
failure to initialize platform verifier: General("No CA certificates were loaded from the system")
Reproduce with the stock image and any config containing an aws store (credentials via env; the panic happens before credentials are used):
docker run --rm -v "$PWD/cas.json5:/cfg.json5" ghcr.io/tracemachina/nativelink:v1.6.7 /cfg.json5
Mounting a PEM bundle into the container and setting SSL_CERT_FILE=/path/to/ca-certificates.crt makes it start.
Additional context
Proposed fix (small):
nativelink-store/src/common_s3_utils.rs: replace with_platform_verifier() with try_with_platform_verifier() and make TlsClient::new / new_for_credentials / new_with_http_support return Result<Self, Error> (Code::InvalidArgument, message along the lines of "no CA certificates could be loaded for the TLS client; mount a CA bundle and set SSL_CERT_FILE, or set root_certificates"). Update the five call sites above plus nativelink-store/tests/common_s3_utils_test.rs#L49,L65 (all already in Result contexts). Roughly <80 lines; unit-testable by constructing TlsClient with SSL_CERT_FILE pointing at an empty file and SSL_CERT_DIR at an empty directory.
Optionally add root_certificates: Option<String> to CommonObjectSpec, mirroring OntapS3Spec, and build the connector with with_tls_config + with_root_certificates when set (the ONTAP store already has load_custom_certs to reuse).
Docs: one sentence in s3-and-compatible.mdx and the container/Kubernetes deploy pages stating that the image carries no CA store and showing the SSL_CERT_FILE mount.
Related: #441 (open; "we unintentionally depend on existing CAs during testtime and runtime" — this issue is the concrete user-facing failure mode for the S3-family stores), #708 / #810 (decision not to bundle CAs), #1785 (switched S3 stores to the platform verifier).
Found while operating this in production; happy to send a PR if maintainers agree with the analysis.
Version
v1.6.7 (
ghcr.io/tracemachina/nativelink:v1.6.7) andmainat 76392b5.Cargo.lock: hyper-rustls 0.27.7, rustls-platform-verifier 0.6.2, rustls-native-certs 0.8.2.Client
Buck2 (not client-specific; happens before any client connects)
OS / Architecture
Linux x86_64 (container)
Deployment method
Docker / Kubernetes (stock
ghcr.io/tracemachina/nativelinkimage)Storage backend
S3 (also applies to
gcsandr2, which shareTlsClient)Configuration
Expected behavior
If no CA roots can be loaded,
S3Store::new(and the GCS/R2/OCI constructors) should return anativelink_error::Errorthat names the store and the remedy (mount a CA bundle and pointSSL_CERT_FILE/SSL_CERT_DIRat it), the same way the ONTAP store already does viawith_native_roots()?. IdeallyCommonObjectSpecshould also accept aroot_certificatespath likeOntapS3Specdoes, so the bundle can be configured in-file rather than only through an undocumented environment variable.Actual behavior
The process aborts with a panic from a third-party
expectduring store construction, before serving anything.TlsClient::new_with_http_supportbuilds the connector with the panickingHttpsConnectorBuilder::new().with_platform_verifier():nativelink/nativelink-store/src/common_s3_utils.rs
Lines 75 to 79 in 76392b5
In hyper-rustls 0.27.7 that method is
self.try_with_platform_verifier().expect("failure to initialize platform verifier")(src/connector/builder.rs#L76-L79). On Linuxrustls-platform-verifierloads roots withrustls-native-certsand returnsErr(rustls::Error::General("No CA certificates were loaded from the system"))when the resulting store is empty (rustls-platform-verifier/src/verification/others.rs#L94-L110), so theexpectfires.The official image is built by
nativelinkImageForinflake.nixwithcopyToRootcontaining only the nativelink/bin(pkgs.cacertappears only as a build-timebuildInputsentry, not in the image):nativelink/flake.nix
Lines 272 to 296 in 76392b5
So any
experimental_cloud_object_storewithprovider: "aws" | "gcs" | "r2"panics on first start in the stock image unless the operator already knows to mount a CA bundle and setSSL_CERT_FILE. The sameTlsClient::newis used bys3_store.rs#L112-L113,r2_store.rs#L49,oci_store.rs#L58andontap_s3_existence_cache_store.rs#L418, all of which are already insideResult-returning constructors.Why this is a defect rather than "bring your own certs":
ontap_s3_store.rs#L133-L139usesClientConfig::builder().with_native_roots()?and propagates the error.CommonObjectSpec(nativelink-config/src/stores.rs#L1322) has noroot_certificatesfield, whileOntapS3Spechas one (stores.rs#L861). Foraws/gcs/r2the only knob is theSSL_CERT_FILE/SSL_CERT_DIRenv var honoured byrustls-native-certs, which is not mentioned anywhere in the repo (no hits forSSL_CERT_FILEin code, docs, orkubernetes/).web/apps/docs/content/docs/how-to/stores/s3-and-compatible.mdx#L123-L125says "Without it, the system roots are used" (in the ONTAP section) without noting that the published image has no system roots, and theaws/gcs/r2sections do not mention trust roots at all.Logs / error output
Expected form of the panic (message from hyper-rustls
expect, error is Debug-formatted):Reproduce with the stock image and any config containing an
awsstore (credentials via env; the panic happens before credentials are used):docker run --rm -v "$PWD/cas.json5:/cfg.json5" ghcr.io/tracemachina/nativelink:v1.6.7 /cfg.json5Mounting a PEM bundle into the container and setting
SSL_CERT_FILE=/path/to/ca-certificates.crtmakes it start.Additional context
Proposed fix (small):
nativelink-store/src/common_s3_utils.rs: replacewith_platform_verifier()withtry_with_platform_verifier()and makeTlsClient::new/new_for_credentials/new_with_http_supportreturnResult<Self, Error>(Code::InvalidArgument, message along the lines of "no CA certificates could be loaded for the TLS client; mount a CA bundle and set SSL_CERT_FILE, or set root_certificates"). Update the five call sites above plusnativelink-store/tests/common_s3_utils_test.rs#L49,L65(all already inResultcontexts). Roughly <80 lines; unit-testable by constructingTlsClientwithSSL_CERT_FILEpointing at an empty file andSSL_CERT_DIRat an empty directory.root_certificates: Option<String>toCommonObjectSpec, mirroringOntapS3Spec, and build the connector withwith_tls_config+with_root_certificateswhen set (the ONTAP store already hasload_custom_certsto reuse).s3-and-compatible.mdxand the container/Kubernetes deploy pages stating that the image carries no CA store and showing theSSL_CERT_FILEmount.Related: #441 (open; "we unintentionally depend on existing CAs during testtime and runtime" — this issue is the concrete user-facing failure mode for the S3-family stores), #708 / #810 (decision not to bundle CAs), #1785 (switched S3 stores to the platform verifier).
Found while operating this in production; happy to send a PR if maintainers agree with the analysis.