Cratis Chronicle local TLS certificate setup
Supply your own TLS certificate to Cratis Chronicle when you need to test certificate trust or connect through a custom local hostname. The development image already generates a self-signed certificate for its service port, so skip this setup if you only need the default local server.
Overview
Section titled “Overview”Chronicle loads TLS certificates from PFX (PKCS#12) files containing a private key. Use the .NET CLI for a localhost certificate, or OpenSSL when you need to choose the hostnames yourself. The paths in the configuration must be readable by the Chronicle process; for Docker, mount the file as shown in Docker Development.
Option 1: Using .NET CLI (Recommended for .NET Developers)
Section titled “Option 1: Using .NET CLI (Recommended for .NET Developers)”Export a localhost development certificate with the .NET CLI. Exporting does not establish trust: run the separate --trust command on the machine that will connect to Chronicle. Applications in other machines or containers need their own trust configuration.
Generate a Development Certificate
Section titled “Generate a Development Certificate”# Generate a development certificatedotnet dev-certs https -ep ./chronicle-dev.pfx -p YourPassword123
# Trust the certificate (optional, for client applications)dotnet dev-certs https --trustConfigure Chronicle to Use the Certificate
Section titled “Configure Chronicle to Use the Certificate”Update your chronicle.json configuration:
{ "tls": { "certificatePath": "./chronicle-dev.pfx", "certificatePassword": "YourPassword123" }}Or use environment variables:
export Cratis__Chronicle__Tls__CertificatePath=./chronicle-dev.pfxexport Cratis__Chronicle__Tls__CertificatePassword=YourPassword123Option 2: Using OpenSSL
Section titled “Option 2: Using OpenSSL”Use OpenSSL to create a self-signed certificate and export its private key in a PFX. The first example sets a common name only. For browser or client hostname validation, use the following SAN example, which lists the names and IP address the certificate covers.
Generate a Self-Signed Certificate
Section titled “Generate a Self-Signed Certificate”# Generate a private keyopenssl genrsa -out chronicle-dev.key 2048
# Create a certificate signing requestopenssl req -new -key chronicle-dev.key -out chronicle-dev.csr \ -subj "/CN=localhost/O=Development/C=US"
# Generate a self-signed certificateopenssl x509 -req -days 365 -in chronicle-dev.csr \ -signkey chronicle-dev.key -out chronicle-dev.crt
# Convert to PFX format (required by Chronicle)openssl pkcs12 -export -out chronicle-dev.pfx \ -inkey chronicle-dev.key -in chronicle-dev.crt \ -password pass:YourPassword123Generate a Certificate with Subject Alternative Names (SAN)
Section titled “Generate a Certificate with Subject Alternative Names (SAN)”Subject Alternative Names (SANs) identify the DNS names and IP addresses a certificate covers. This example covers localhost, chronicle.local, and 127.0.0.1. Your machine must resolve any custom name, such as chronicle.local, to the server; the certificate does not configure DNS.
# Create a configuration file for SANcat > san.cnf << EOF[req]default_bits = 2048prompt = nodefault_md = sha256distinguished_name = dnreq_extensions = req_ext
[dn]CN = localhostO = DevelopmentC = US
[req_ext]subjectAltName = @alt_names
[alt_names]DNS.1 = localhostDNS.2 = chronicle.localIP.1 = 127.0.0.1EOF
# Generate the certificate with SANopenssl req -x509 -nodes -days 365 -newkey rsa:2048 \ -keyout chronicle-dev.key -out chronicle-dev.crt \ -config san.cnf -extensions req_ext
# Convert to PFXopenssl pkcs12 -export -out chronicle-dev.pfx \ -inkey chronicle-dev.key -in chronicle-dev.crt \ -password pass:YourPassword123Configure Chronicle
Section titled “Configure Chronicle”Update your chronicle.json:
{ "tls": { "certificatePath": "./chronicle-dev.pfx", "certificatePassword": "YourPassword123" }}Trusting Self-Signed Certificates
Section titled “Trusting Self-Signed Certificates”Trust the certificate on each machine whose clients need to validate it. These commands change the operating system’s trust store and may require administrator privileges. Only import certificates you generated or otherwise trust. A matching hostname is still required, and some clients use a separate trust store.
Windows
Section titled “Windows”# Import the certificateImport-PfxCertificate -FilePath chronicle-dev.pfx ` -CertStoreLocation Cert:\LocalMachine\Root ` -Password (ConvertTo-SecureString -String "YourPassword123" -AsPlainText -Force)# Extract the certificate from PFXopenssl pkcs12 -in chronicle-dev.pfx -clcerts -nokeys -out chronicle-dev.crt \ -password pass:YourPassword123
# Add to system keychainsudo security add-trusted-cert -d -r trustRoot \ -k /Library/Keychains/System.keychain chronicle-dev.crtLinux (Ubuntu/Debian)
Section titled “Linux (Ubuntu/Debian)”# Extract the certificate from PFXopenssl pkcs12 -in chronicle-dev.pfx -clcerts -nokeys -out chronicle-dev.crt \ -password pass:YourPassword123
# Copy to the trusted certificates directorysudo cp chronicle-dev.crt /usr/local/share/ca-certificates/
# Update the certificate storesudo update-ca-certificatesLinux (Fedora/RHEL/CentOS)
Section titled “Linux (Fedora/RHEL/CentOS)”# Extract the certificate from PFXopenssl pkcs12 -in chronicle-dev.pfx -clcerts -nokeys -out chronicle-dev.crt \ -password pass:YourPassword123
# Copy to the trusted certificates directorysudo cp chronicle-dev.crt /etc/pki/ca-trust/source/anchors/
# Update the certificate storesudo update-ca-trustDocker Development
Section titled “Docker Development”Mount the certificate file read-only and set CertificatePath to its path inside the container. The excerpt below uses the production image and shows only TLS configuration; it also needs external storage and, by default, an encryption certificate before it can start. For a complete deployment, use Production Hosting.
version: '3.8'
services: chronicle: image: cratis/chronicle:latest ports: - "35000:35000" volumes: - ./chronicle.json:/app/chronicle.json:ro - ./chronicle-dev.pfx:/app/chronicle-dev.pfx:ro environment: - Cratis__Chronicle__Tls__CertificatePath=/app/chronicle-dev.pfx - Cratis__Chronicle__Tls__CertificatePassword=YourPassword123Client Configuration
Section titled “Client Configuration”For a local server with a self-signed certificate, the client configuration is shown below. The development images generate an untrusted certificate on every start when none is configured, with SANs localhost, chronicle, 127.0.0.1, and ::1. A pin must match the current certificate.
The .NET client still skips validation when both settings are omitted in this release; the next major release will enable it by default. We recommend explicitly setting skipTlsValidation=false after configuring trust or a matching pin. For development only, explicitly opt out with chronicle://localhost:35000?skipTlsValidation=true. An explicit Tls.SkipCertificateValidation=false still requires validation. Before connecting to a production server, configure certificate validation as described in Client TLS configuration and Production Hosting.
public static class HostingLocalCertificatesClientConfiguration{ public static ChronicleClient Create() { var options = new ChronicleOptions { ConnectionString = "chronicle://localhost:35000", Tls = new Tls { CertificatePath = "./chronicle-dev.pfx", CertificatePassword = "YourPassword123" } };
return new ChronicleClient(options); }}import io.cratis.chronicle.ChronicleClientimport io.cratis.chronicle.ChronicleOptions
// The client always connects over TLS. Chronicle Server's auto-generated self-signed development// certificate is never written to disk or added to a trust store, so there is nothing to validate// it against - skipTlsValidation accepts it. This is already Kotlin's default, spelled out here// explicitly for a server started with a certificate generated the way this guide describes.fun createClientForLocalCertificate(): ChronicleClient { val options = ChronicleOptions.fromConnectionString("chronicle://localhost:35000?skipTlsValidation=true") return ChronicleClient(options)}import io.cratis.chronicle.ChronicleOptions;import io.cratis.chronicle.java.BlockingChronicleClient;
// The client always connects over TLS. Chronicle Server's auto-generated self-signed development// certificate is never written to disk or added to a trust store, so there is nothing to validate// it against - skipTlsValidation accepts it. This is already Java's default, spelled out here// explicitly for a server started with a certificate generated the way this guide describes.class HostingLocalCertificatesClientConfiguration { BlockingChronicleClient create() { ChronicleOptions options = ChronicleOptions.fromConnectionString( "chronicle://localhost:35000?skipTlsValidation=true"); return BlockingChronicleClient.connect(options); }}defmodule MyApp.HostingLocalCertificatesClientConfiguration do @moduledoc false
def start_link do children = [ {Cratis.Chronicle.Client, connection_string: "chronicle://localhost:35000?certificatePath=./chronicle-dev.pfx&certificatePassword=YourPassword123"} ]
Supervisor.start_link(children, strategy: :one_for_one) endendTypeScript does not support this workflow yet.Security Considerations
Section titled “Security Considerations”Use these generated certificates only for development. Keep PFX files, private keys, and passwords out of source control, and replace the example passwords before use. For production TLS, obtain a certificate from a certificate authority your clients trust and plan for renewal.
Troubleshooting
Section titled “Troubleshooting”Certificate Errors
Section titled “Certificate Errors”If Chronicle cannot load the certificate, check that the configured path exists from the server process’s working directory. In Docker, use the mounted container path. Verify that the password matches the PFX export and that the file includes the private key.
If the server starts but a client reports a validation error, check the certificate’s validity dates, the hostname in its SANs, and the client’s trust store. Converting a file to PFX does not fix a hostname or trust mismatch.
Connection Errors
Section titled “Connection Errors”Confirm that the server is listening on the expected HTTPS address and that the client uses the same host and port. Check Docker port mappings and firewall rules before changing certificate settings. Once the address is reachable, verify that the client trusts the certificate and validates the hostname.
Next Steps
Section titled “Next Steps”Use Production Hosting when you need durable storage, production certificates, and health probes. The Configuration reference covers the remaining server settings.