Configuring secrets encryption in Kubernetes
Black Duck supports encryption at rest of critical data within the system. This encryption is based upon a secret provisioned to the Black Duck installation by the orchestration environment (Docker Swarm or Kubernetes). The process to create and manage this secret, create a backup secret, and rotate the secret based upon your own organization’s security policies is outlined below.
The critical data being encrypted are the following:
-
SCM Integration OAuth tokens
-
SCM Integration provider OAuth application client secrets
-
LDAP credentials
-
SAML private signing certificates
What is an encryption secret?
An encryption secret is a random sequence used to generate an internal cryptographic key in order to unlock resources within the system. The encryption of secrets in Black Duck is controlled by 3 symmetric keys, the root, backup and previous keys. These three keys are generated by seeds passed into Black Duck as Kubernetes and Docker Swarm secrets. The three secrets are named:
-
crypto-root-seed
-
crypto-backup-seed
-
crypto-prev-seed
In normal conditions, all three seeds will not be in active use. Unless a rotation action is in progress, the only seed active will be the root seed.
Securing the root seed
It is important to protect the root seed. A user possessing your root seed along with a copy of the system data could unlock and read the protected contents of the system. Some Docker Swarm or Kubernetes systems do not encrypt their secrets at rest by default. It is strongly advised to configure these orchestration systems to be encrypted internally so that secrets created afterwards in the system remain secure.
The root seed is necessary to recreate the system state from backup as part of a disaster recovery plan. A copy of the root seed file should be stored in a secret location separate from the orchestration system so that the combination of the seed plus the backup can recreate the system. Storing the root seed in the same location as the backup files is not advised. If one set of files is leaked or stolen – both will be, therefore, having separate locations for backup data and seed backups is recommended.
Enabling secrets encryption in Kubernetes
To enable secrets encryption in Kubernetes, you must change the value of
enableApplicationLevelEncryption
to true
in
the values.yaml
orchestration file:
# if true, enables application level encryption
enableApplicationLevelEncryption: true
Key seed administration scripts
You can find sample administration scripts in the Black Duck GitHub public repository:
https://github.com/blackducksoftware/secrets-encryption-scripts
These scripts are not meant to be used for administering Black Duck secrets encryption, but rather to illustrate the use of the low-level Docker and Kubernetes commands documented here. There are two sets of scripts, each in its own sub-directory, corresponding to use on Kubernetes and Docker Swarm platforms. There is a one-to-one correspondence between the individual scripts, where applicable, for Kubernetes and Docker Swarm. For example, both sets of scripts contain a script called:
createInitialSeeds.sh