Configure Client Certificate Authentication
How to configure Couchbase Server and the Operator to use client certificate based authentication.
By default a Couchbase Server deployment uses basic authentication, commonly known as username and password. Basic authentication may be used over a plain text network communication where a malicious party can see the password. Basic authentication may also be used over a server-side TLS protected network connection which encrypts the password and prevents a malicious party from acquiring it.
Couchbase Server also supports a mode of authentication using client certificates. It uses the same technology that a client uses to assert the validity of a server certificate, but the server validates the client as well. This is known as mutual TLS (mTLS). Couchbase server does not support basic authentication over mTLS, instead requiring a username to be encoded into the client certificate. This page documents configuration of mTLS.
Secrets are specified in the
CouchbaseCluster resource, therefore they may have any name you choose. The format of individual secrets is discussed below.
Please see the TLS certificate tutorial for a simple guide to creating TLS certificates.
Server secrets need to be mounted as a volume within the Couchbase Server pod with specific names. The certificate chain must be named
tls.crt and the private key
$ kubectl create secret generic couchbase-server-tls \ --from-file example/tls/certs/tls.crt \ --from-file example/tls/certs/tls.key \ --from-file example/tls/certs/ca.crt
The Operator client secrets are read directly from the API. It expects only a single value to be present;
ca.crt is the top-level CA which is used to authenticate all TLS server certificate chains.
When using client certificate authentication you will also need to specify the client certificate chain and key pair with the keys
$ kubectl create secret generic couchbase-operator-tls \ --from-file example/tls/certs/tls.crt \ --from-file example/tls/certs/tls.key
TLS certificate configuration is done in the networking section of the
apiVersion: couchbase/v2 kind: CouchbaseCluster spec: security: adminSecret: my-admin-secret networking: tls: secretSource: serverSecretName: couchbase-server-tls (1) clientSecretName: couchbase-operator-tls (2) clientCertificatePolicy: mandatory (3) clientCertificatePaths: (4) - path: subject.cn - path: san.email delimiter: @
In a more realistic setup users will likely be identified by an email address.
In this illustration it is encoded in a subject alternative name (SAN).
When Couchbase Server looks at a client certificate it will not find a valid user using the first path (but it would match for our