Skip to content

Chronicle .NET client TLS configuration

The Chronicle .NET client uses TLS by default but still skips server certificate validation in this release. We recommend explicitly setting skipTlsValidation=false after preparing certificate trust or a matching pin. The next major release will enable validation by default.

TLS on the kernel listener is configured separately. Development builds can generate a self-signed certificate when none is supplied; production deployments need a configured server certificate. See TLS Configuration (Server).

In a hosted .NET application, put certificate file settings under Cratis:Chronicle:Tls. A configured certificate can supply a pin for validating the server, but setting its path alone does not enable validation. Set SkipCertificateValidation to false as described below.

{
"Cratis": {
"Chronicle": {
"ConnectionString": "chronicle://localhost:35000",
"Tls": {
"CertificatePath": "/path/to/certificate.pfx",
"CertificatePassword": "your-password"
}
}
}
}

For direct ChronicleClient construction, supply the same values through ChronicleOptions.Tls before creating the client:

public static class TlsClientOptions
{
public static ChronicleClient Create()
{
var options = new ChronicleOptions
{
ConnectionString = "chronicle://localhost:35000",
Tls = new Tls
{
CertificatePath = "/path/to/certificate.pfx",
CertificatePassword = "your-password"
}
};
return new ChronicleClient(options);
}
}

View C# snippet source on GitHub

Property Type Default Description
CertificatePath string null Path to a certificate file, such as a PFX; its certificate hash can pin the server certificate
CertificatePassword string null Password for the certificate file
CaCertificatePath string null Path to a PEM or PKCS#7 file with the certificate authorities that the server certificate must chain to; see Trusting a private certificate authority. Takes precedence over the connection string’s caCertificatePath
SkipCertificateValidation boolean true Allows any server certificate when the connection string also permits skipping validation

With both settings omitted, this release continues to accept any server certificate, including a self-signed one. Configure validation explicitly rather than relying on that default.

Prepare certificate trust or a matching pin using Enabling validation, then turn validation on with skipTlsValidation=false in the connection string:

public static class ConfigurationTlsValidationEnabled
{
public static ChronicleOptions Create() =>
ChronicleOptions.FromConnectionString(
"chronicle://my-server:35000?skipTlsValidation=false");
}

View C# snippet source on GitHub

Alternatively, set Tls:SkipCertificateValidation=false in configuration or SkipCertificateValidation = false on the TLS options. Either explicit false requires validation, even on localhost and even if the other setting is explicitly true. Otherwise, either explicit true skips validation. If both settings are omitted, the release default applies: skipping validation, unchanged in this release. Builder round-trips and credential helpers preserve whether the connection-string option was omitted or explicitly set.

Keep validation enabled outside a trusted development environment. The following connection-string setting explicitly permits skipping validation, but takes effect only if the TLS options also permit it:

public static class TlsConnectionStringSkipValidation
{
public static ChronicleOptions Create() =>
ChronicleOptions.FromConnectionString("chronicle://localhost:35000?skipTlsValidation=true");
}

View C# snippet source on GitHub

Skipping validation is not the same as disabling TLS. The separate disableTls=true connection-string option uses cleartext HTTP/2 and must match a kernel listener configured for cleartext. It is not a fix for certificate validation failures; see TLS Configuration (Server).

Trust the server’s certificate authority (CA) on each client machine. In an application container, mount the CA certificate and add it to the container’s trust store. With validation enabled, a certificate that passes standard TLS checks needs no client-side pin. To trust a private CA without changing the machine’s trust store, see Trusting a private certificate authority.

Alternatively, configure certificatePath with the matching server certificate to pin it. With validation enabled, a matching pin can allow a certificate whose chain is not trusted, including a self-signed certificate. The pin does not override a host-name mismatch or a missing server certificate.

After preparing trust, a CA file, or pinning, set skipTlsValidation=false or Tls:SkipCertificateValidation=false. The client logs a startup warning when validation is skipped for a remote host or an SRV lookup, including with omitted settings. Loopback targets do not log it. With disableTls=true, certificate validation does not apply and that warning is suppressed.

Set caCertificatePath to a file with the certificate authorities that issued the server certificate, and enable validation:

public static class ConfigurationTlsCertificateAuthority
{
public static ChronicleOptions Create() =>
ChronicleOptions.FromConnectionString(
"chronicle://my-server:35000?skipTlsValidation=false&caCertificatePath=/certs/ca.pem");
}

View C# snippet source on GitHub

In a hosted .NET application, set Cratis:Chronicle:Tls:CaCertificatePath (environment variable Cratis__Chronicle__Tls__CaCertificatePath) or CaCertificatePath on ChronicleOptions.Tls instead. That value takes precedence over the connection-string option.

The file holds one or more CA certificates, either PEM-encoded CERTIFICATE blocks or a PKCS#7 bundle (PEM or DER). OpenSSL TRUSTED CERTIFICATE blocks are not supported and fail client creation. Include the root CA, and any intermediate CAs that the server does not send. With validation enabled, the client then accepts a server certificate only when its chain builds to one of these root CAs. The machine’s trust store is not consulted, and revocation is not checked against these CAs. The other checks still apply: a host-name mismatch or a missing server certificate is rejected. A matching certificatePath pin continues to work as described above.

The client reads the file once, when the connection is created, and uses it for the gRPC connection, the load-balancer probes, and token requests to the Chronicle server. Token requests to an external authority keep using the machine’s trust store. If the file does not exist, cannot be read, or contains no certificates, creating the client fails with an error that names the problem. The client never falls back to the machine’s trust store or to skipping validation. With skipTlsValidation=true in effect, or with disableTls=true, the file is still read, and a missing or invalid file still fails client creation, but it is not used for validation.

The development images (latest-development and latest-development-slim) generate an untrusted, self-signed certificate on every start when none is configured. Its subject alternative names (SANs) are localhost, chronicle, 127.0.0.1, and ::1. The default client accepts it without trust-store setup in this release. For development only, make that choice explicit with chronicle://localhost:35000?skipTlsValidation=true; an explicit false in TLS options still requires validation.

To test the validation path, configure a server certificate issued by a CA the client trusts, or supply a matching certificate pin, and enable validation. A pin for an automatically generated certificate must match the certificate from the current server run.

For a local development kernel, generated certificates and skipped validation let you connect without certificate setup. For production, configure the kernel’s server certificate and enable validation on every client. Use the host name covered by that certificate in the connection string.

Certificate validation does not supply application credentials or grant access to an event store. Configure those separately through Connection Strings, and follow Production deployment for the kernel-side setup.

Error: “The remote certificate is invalid”

Validation is enabled through the connection string or TLS options. Check the certificate rather than disabling validation:

  1. Confirm that the connection-string host name matches the server certificate.
  2. Check the certificate’s validity dates and that the client trusts its issuing CA. With caCertificatePath, confirm that the file contains the root CA of the server certificate’s chain, plus any intermediate CAs that the server does not send.
  3. If using a pin, confirm that it matches the current server certificate. A pin still cannot allow a host-name mismatch.

For containers, check trust inside the application container, not only on the host. Return to Enabling validation to choose trust-store configuration or pinning.