---
title: Manage System Secrets
description: System secrets can be managed with a special degree of security.
pubDate: 2026-08-17T09:53:44.266Z
antora:
  editUrl: https://github.com/couchbase/docs-server/edit/release/7.2/modules/manage/pages/manage-security/manage-system-secrets.adoc
  xref: xref:7.2@server:manage:manage-security/manage-system-secrets.adoc[]
---

[Consult the llms.txt file for a full list of contents](/llms.txt)
[View original HTML](/server/7.2/manage/manage-security/manage-system-secrets.html)

# Manage System Secrets

> System secrets can be managed with a special degree of security. 

## [](#understanding-system-secrets)Understanding System Secrets

_Secret-Management_ (which is an Enterprise Edition feature of Couchbase Server) allows system secrets to be written to disk in encrypted format. _Secrets_ are Couchbase Server-defined, and include system-essential passwords and certificates. Couchbase uses an AES 256-bit algorithm in GCM mode, to encrypt secrets using an encryption hierarchy.

## [](#setting-the-master-password)Setting the Master Password

Secret-Management is an optional feature that only works when the _master password_ is set for each Couchbase Server node. This can be specified by means of the [master-password](../../cli/cbcli/couchbase-cli-master-password.md) CLI command; the REST API [POST /node/controller/changeMasterPassword](../../rest-api/rest-secret-mgmt.md) method; and (on all supported operating systems other than Mac OS X) by explicitly setting the `CB_MASTER_PASSWORD` environment variable, at the command-prompt.

Note that since the `CB_MASTER_PASSWORD` does not work with Couchbase Server on Mac OS X, Mac developers should open the `/Applications/Couchbase Server.app/Contents/Resources/start-server.sh` script, and add the export variable to that file.

When you specify the master password, Couchbase Server derives a _master key_ from that password, using the strong _Key Derivation Function_ PBKDF2\. Couchbase Server also creates a random _data key_, which is then encrypted with the master key. The data key will be used to encrypt all secrets on disk, using an AES 256-bit algorithm, in GCM mode. To bootstrap the system, the master key is used to open the encrypted data key; the data key is then used to open the encrypted secrets; and the secrets are then used to start Couchbase Server.

If you establish the master password by setting the environment variable for the current node while Couchbase Server is running, Couchbase Server performs encryption on secrets from that point. However, by default, the _decryption_ of secrets relies on Couchbase Server having read the environment variable on startup. Therefore, if Couchbase Server has already been started as a service at the time you set the environment variable, you must explicitly make the newly established variable available to the service. If Couchbase Server has already been started as a script, you must use the `export` command, to make it available to the script.

At start-up, Couchbase Server waits for the master password to be entered. Enter the password by means of the `master-password` CLI command, with the `--send-password` option:

couchbase-cli master-password --send-password

The following prompt now appears:

Enter master password:

Enter the master password against this prompt. You are permitted _three attempts_ to enter the master password correctly.

Note that the `master-password` CLI command must be run on the same host on which Couchbase Server is running.

## [](#password%5Frotation)Performing Rotation

The Couchbase Server Secret-Management system allows you to _rotate_ (periodically change, to reduce the risk of illicit discovery or deciphering) the different elements of the system:

* **Master-password rotation**: This _first level of rotation_ is achieved by setting a new password, using the [CLI command](../../cli/cbcli/couchbase-cli-master-password.md), the [REST API method](../../rest-api/rest-secret-mgmt.md), or (other than on Mac OS X) the environment variable, as indicated above. One master password per node needs to be set.
* **Data-key rotation**: This _second level of rotation_ is achieved by changing the data-key, using the [CLI command](../../cli/cbcli/couchbase-cli-master-password.md) with the `--rotate-data-key` option, or the REST API [POST /node/controller/rotateDataKey](../../rest-api/rest-secret-mgmt.md) method.
* **Secret rotation**: This _third level of rotation_ is achieved by changing the values of the secrets themselves. For example, to reset the secret that is an administrator password, use the [couchbase-cli reset-admin-password](../../cli/cbcli/couchbase-cli-reset-admin-password.md) command.

Note that if the auditing option is enabled, all rotation-requests are audited by Couchbase Server.