Use this file to discover all available pages before exploring further.
Set up CouchDB using self-signed, locally issued certificates and test that it accepts TLS connections, enforces authentication, and allows secure read/write operations from a test client.
For production purposes, we recommend using publicly trusted certificates issued by a Certificate Authority (CA).
.├── certgen.sh # Script to generate CA, server, and client certs├── create-certs.yml # Compose file to generate certs in a dedicated container├── couchdb-local.ini # CouchDB configuration with SSL and authentication└── docker-compose.yml # Compose file for CouchDB and test client
Save the following script to a file named certgen.sh. The script is used to generate the TLS certificates and store them in a certs folder on the host.
Save the following YAML configuration to a file named create-certs.yml. The configuration uses the Minimus minidebug image to generate the certificates with the certgen.sh shell script. Minidebug is a secure Minimus dev toolkit that provides a shell, OpenSSL, and other utilities.The certificates will be persisted in the certs volume on the host.
Save the following configuration to a file named couchdb-local.ini:
couchdb-local.ini
[couchdb] single_node = true[cluster]n = 1q = 8[chttpd_auth_lockout]mode = off[chttpd]; Disable plain HTTP completely by setting an invalid portport = 0bind_address = 0.0.0.0require_valid_user = true[daemons]; Enable only HTTPS daemonhttpsd = {couch_httpd, start_link, ["https"]}; Optionally comment out httpd if not used:; httpd = {couch_httpd, start_link, ["http"]}[ssl]; Now safe to bind to 5984 since HTTP is disabledport = 5984enable = truecert_file = /certs/server-cert.pemkey_file = /certs/server-key.pemcacert_file = /certs/ca.pemverify_ssl_certificates = trueverify_ssl_peer = truefail_if_no_peer_cert = false[admins]admin = admin[authentication]authentication_handlers = {chttpd_auth, proxy_authentication_handler}, {chttpd_auth, default_authentication_handler}# Use TLS 1.2+tls_versions = tlsv1.2,tlsv1.3
2
Save Docker Compose script
Save the following Docker Compose script to docker-compose.yml. This compose file sets up CouchDB using TLS (HTTPS only), with authentication enabled, mounts the generated certificates, uses the configurations in the local INI file, and exposes CouchDB over https://localhost:15984.