Search code examples
sonarqubesonarqube-web

Error - while encrypting the jdbc password in sonarqube 4.3.3


I followed the below link (http://docs.sonarqube.org/display/SONAR/Settings+Encryption ) and try to encrypt the sonar jdbc password and I set the password and key path in maven project as below

<sonar.jdbc.url>jdbc:h2:tcp://localhost:9093/sonar</sonar.jdbc.url><sonar.jdbc.username>sonar</sonar.jdbc.username>
<sonar.jdbc.password>{aes}LUc8lslPKL7YBxBSobm3XA==</sonar.jdbc.password>
<sonar.secretKeyPath>/apps1/Sonar/Sonar secret.txt</sonar.secretKeyPath>

But while building the project i'm getting the below issues.

" Fail to decrypt the property sonar.jdbc.password. Please check your secret key. The property sonar.secretKeyPath does not link to a valid file"

I'm using Linux in which SonarQube 4.3.3 has been installed and I'm running the maven project in windows.

Please help me to solve the issues.


Solution

  • The secret key must be copied wherever you use encrypted properties. Here you're using encryption on the scanner side, so you must first copy the key on that machine and set sonar.secretKeyPath accordingly. As per Settings Encryption documentation:

    To use an encrypted value on the scanner side,

    • Copy the secret key file to the machine running the analysis
    • Use the encrypted values where needed
    • Configure the scanner with the location of the secret key file.