Skip to content

TLS & Certificates

TLS encrypts all network traffic to prevent eavesdropping and tampering. A single set of certificate files is used across all broker services.

ConnectionTLS ModeDefault Port
Client gRPC (producers/consumers)Server TLS6650
Admin gRPCServer TLS (opt-in)50051
Inter-broker replicationMutual TLS (mTLS)6650
Raft consensusMutual TLS (mTLS)7650
  • Server TLS (client-facing): the broker presents its certificate to clients. Clients verify it against the CA
  • Mutual TLS (inter-broker): both sides present certificates and verify each other. This is how brokers authenticate to each other for replication and Raft consensus

danube_broker.yml
auth:
mode: tls
tls:
cert_file: "./cert/server-cert.pem" # Server certificate
key_file: "./cert/server-key.pem" # Server private key
ca_file: "./cert/ca-cert.pem" # CA certificate (for verifying peers)

All three files are required when mode: tls is set.


Danube ships with a convenience script that generates a CA, server certificate, and client certificate:

Generate certificates
cd cert/
bash gen_certs.sh

This produces:

FilePurpose
ca-cert.pem / ca-key.pemCertificate Authority (signs both server and client certs)
server-cert.pem / server-key.pemBroker TLS identity — used in auth.tls config
client-cert.pem / client-key.pemClient mTLS identity — used by inter-broker and mTLS clients

The generated server certificate includes Subject Alternative Names for localhost, 127.0.0.1, and 0.0.0.0, making it ready for local development.


For multi-broker deployments:

  • All brokers must share the same CA certificate (ca-cert.pem)
  • Each broker can use the same or different server certificates, as long as they are signed by the shared CA
  • Server certificates should include SANs matching the broker’s hostname or IP address

By default, the admin API (port 50051) runs without TLS even when auth.mode: tls is set. This is convenient for local management but insecure for remote access.

To enable TLS on the admin API:

danube_broker.yml
admin_tls: true

When enabled, the admin API uses the same certificate from auth.tls. This is recommended for any deployment where the admin API is accessed over untrusted networks.


For how to connect clients with TLS and mTLS, see the Client Setup & Connection guide.