Sensitive settings
Encrypting SonarQube system properties.
Last updated
Was this helpful?
Encrypting SonarQube system properties.
You can encrypt any system property stored in <sonarqubeHome>/conf/sonar.properties or defined in SonarQube Server UI. The encryption algorithm used is AES with 256-bit keys.
In case of a Kubernetes deployment, see also Encrypting sensitive data.
You must have the Administer System permission in SonarQube Server.
SonarQube Server must be up and running.
In SonarQube Server UI, go to Administration > Configuration > Encryption.
Select Generate Secret Key. An encryption key is generated.
You can use any other tool to generate the encryption key. It should be a Base64 Encoded AES-256 Key.
1. Copy the generated encryption key to a file on the machine hosting the SonarQube Server. The file location is defined through the sonar.secretKeyPath property which can be set in <sonarqubeHome>/conf/sonar.properties (see also Configuration methods).
sonar.secretKeyPath
Path to the file containing the key used to encrypt⁴⁾ sensitive system properties in the UI or in sonar.properties.
Warning: The slashes have to be escaped.
Default value: ${user.home}/.sonar/sonar-secret.txt
where user.home refers to the user directory.
For example, if using the default value, sonar-secret.text may be stored in C:\Users\User1\.sonar or, if the service is registered and runs as the local system, in C:\Windows\System32\Config\systemprofile\.sonar
2. Restrict file permissions to the account running the SonarQube Server (ownership and read-access only).
3. Restart your SonarQube Server.
To encrypt a property or setting:
In SonarQube Server UI, go to Administration > Configuration > Encryption.

Enter the value of the property.
Select the Encrypt button. The encrypted value of the property is generated.
Select the copy tool to copy this value.
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 SonarQuber Server UI’s field.
Last updated
Was this helpful?
Was this helpful?
sonar.jdbc.password={aes-gcm}CCGCFg4Xpm6r+PiJb1Swfg== # Encrypted DB password
...
sonar.secretKeyPath=C:/path/to/my/secure/location/my_encryption_key.txt
