diff --git a/cfg/xrpld-example.cfg b/cfg/xrpld-example.cfg index 81a7cec2c1..5dcd149dbc 100644 --- a/cfg/xrpld-example.cfg +++ b/cfg/xrpld-example.cfg @@ -1744,8 +1744,10 @@ validators.txt # use_tls=0 # # Whether to hand tls_ca_cert to the exporter as its CA bundle. TLS is -# selected by the scheme of traces_endpoint, not by this key; setting it -# to 1 only supplies a custom CA file for verifying the collector. +# selected by the scheme of traces_endpoint, not by this key. So with +# enabled=1, use_tls=1 requires traces_endpoint to start with https:// +# (lower case). Any other URL, including the default, makes xrpld fail +# to start with a message that names traces_endpoint. # Default: 0 (no CA file is passed, so the exporter keeps its own # default trust store). # diff --git a/src/tests/libxrpl/telemetry/TelemetryConfig.cpp b/src/tests/libxrpl/telemetry/TelemetryConfig.cpp index 50c6cba4de..dab9b8b47e 100644 --- a/src/tests/libxrpl/telemetry/TelemetryConfig.cpp +++ b/src/tests/libxrpl/telemetry/TelemetryConfig.cpp @@ -863,6 +863,21 @@ TEST(TelemetryConfig, mtls_scheme_check_is_case_sensitive_like_the_exporter) ThrowsMessage(HasSubstr(mtls::schemeError))); } +TEST(TelemetryConfig, one_way_tls_on_an_https_scheme_without_slashes_throws) +{ + // The guard requires the whole "https://" prefix. This URL has "https:" + // but no slashes, so a guard cut down to "https:" or "https" accepts it + // and this test fails. No client certificate or CA is set, so the scheme + // guard is the only check that can throw here. + EXPECT_EQ( + batchRejection( + {{"enabled", "1"}, + {"use_tls", "1"}, + {mtls::keyEndpoint, "https:collector:4318/v1/traces"}}), + "Invalid value 'traces_endpoint' in [telemetry]: must start with 'https://' when " + "use_tls=1, but is 'https:collector:4318/v1/traces'."); +} + TEST(TelemetryConfig, one_way_tls_on_a_plain_http_endpoint_throws) { // use_tls=1 with no client certificate, on an http:// endpoint. The