Latest | Instance administration | Settings encryption
Encrypting sensitive settings
You can encrypt any sonar property stored in <sonarqubeHome>/conf/sonar.properties
(in case of a ZIP installation) or defined in SonarQube Server UI. The encryption algorithm used is AES with 256-bit keys.
The procedure below explains how to perform this in the case of a ZIP installation. See also Encrypting Helm chart sensitive data.
You must have the Administer System permission in SonarQube Server.
Prerequisites
SonarQube Server must be up and running.
Step 1: Create the encryption key
- In SonarQube Server UI, go to Administration > Configuration > Encryption.
- Select Generate Secret Key. An encryption key is generated.
Step 2: Store the encryption key in a secured file on disk
- Copy the generated encryption key to a file on the machine hosting the SonarQube Server. The default location is
~/.sonar/sonar-secret.txt
. If you want to store it somewhere else, set its path through thesonar.secretKeyPath
property in<sonarqubeHome>/conf/sonar.properties
. - Restrict file permissions to the account running the SonarQube Server (ownership and read-access only).
- Restart your SonarQube Server.
Step 3: Encrypt the sensitive settings
To encrypt a property or setting:
1. In SonarQube Server UI, go to Administration > Configuration > Encryption.
2. Enter the value of the property.
3. Select the Encrypt button. The encrypted value of the property is generated.
4. Select the copy tool to copy this value.
5. You can now:
- In
<sonarqubeHome>/conf/sonar.properties
, replace the value of the property with the copied encrypted value.
- Or set the encrypted value in the corresponding SonarQube Server's UI field.
Was this page helpful?