Skip to content

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.

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.

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.

Terminal window
# Generate a development certificate
dotnet dev-certs https -ep ./chronicle-dev.pfx -p YourPassword123
# Trust the certificate (optional, for client applications)
dotnet dev-certs https --trust

Configure 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:

Terminal window
export Cratis__Chronicle__Tls__CertificatePath=./chronicle-dev.pfx
export Cratis__Chronicle__Tls__CertificatePassword=YourPassword123

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.

Terminal window
# Generate a private key
openssl genrsa -out chronicle-dev.key 2048
# Create a certificate signing request
openssl req -new -key chronicle-dev.key -out chronicle-dev.csr \
-subj "/CN=localhost/O=Development/C=US"
# Generate a self-signed certificate
openssl 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:YourPassword123

Generate 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.

Terminal window
# Create a configuration file for SAN
cat > san.cnf << EOF
[req]
default_bits = 2048
prompt = no
default_md = sha256
distinguished_name = dn
req_extensions = req_ext
[dn]
CN = localhost
O = Development
C = US
[req_ext]
subjectAltName = @alt_names
[alt_names]
DNS.1 = localhost
DNS.2 = chronicle.local
IP.1 = 127.0.0.1
EOF
# Generate the certificate with SAN
openssl req -x509 -nodes -days 365 -newkey rsa:2048 \
-keyout chronicle-dev.key -out chronicle-dev.crt \
-config san.cnf -extensions req_ext
# Convert to PFX
openssl pkcs12 -export -out chronicle-dev.pfx \
-inkey chronicle-dev.key -in chronicle-dev.crt \
-password pass:YourPassword123

Update your chronicle.json:

{
"tls": {
"certificatePath": "./chronicle-dev.pfx",
"certificatePassword": "YourPassword123"
}
}

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.

Terminal window
# Import the certificate
Import-PfxCertificate -FilePath chronicle-dev.pfx `
-CertStoreLocation Cert:\LocalMachine\Root `
-Password (ConvertTo-SecureString -String "YourPassword123" -AsPlainText -Force)
Terminal window
# Extract the certificate from PFX
openssl pkcs12 -in chronicle-dev.pfx -clcerts -nokeys -out chronicle-dev.crt \
-password pass:YourPassword123
# Add to system keychain
sudo security add-trusted-cert -d -r trustRoot \
-k /Library/Keychains/System.keychain chronicle-dev.crt
Terminal window
# Extract the certificate from PFX
openssl pkcs12 -in chronicle-dev.pfx -clcerts -nokeys -out chronicle-dev.crt \
-password pass:YourPassword123
# Copy to the trusted certificates directory
sudo cp chronicle-dev.crt /usr/local/share/ca-certificates/
# Update the certificate store
sudo update-ca-certificates
Terminal window
# Extract the certificate from PFX
openssl pkcs12 -in chronicle-dev.pfx -clcerts -nokeys -out chronicle-dev.crt \
-password pass:YourPassword123
# Copy to the trusted certificates directory
sudo cp chronicle-dev.crt /etc/pki/ca-trust/source/anchors/
# Update the certificate store
sudo update-ca-trust

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=YourPassword123

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);
}
}

View C# snippet source on GitHub

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.

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.

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.

Use Production Hosting when you need durable storage, production certificates, and health probes. The Configuration reference covers the remaining server settings.