SonarQube Admin Password on Docker Container with Postgress DB Engine

Viewed 4459

I have lost the Sonarqube Server admin password, want to recover that, any support will be appreciated.

Environment docker images:

  1. sonarqube:7.9.5-community
  2. postgres:12.5-alpine

I have gone through the previously answered block but unfortunately nothing worked out.

Best

1 Answers

The Idea is same as mentioned @ Sonarqube Security Docs under the title "Reinstating Admin Access".

My Solution:

I had to spin up fresh Docker container in order to get the default crypted_password value. If you already know/have the crypted password value then no need to spin up fresh containers, just follow the below steps by replacing the crypted_password accordingly.

Below crypted_password value belongs to admin.

  1. exec to postgres docker container :

    docker exec -it POSTGRES-CONTAINER-NAME bash

  2. Inside Postgres Container, login with the Credentials and follow on screen instructions:

    psql -U sonar -W

  3. Confirm the Database and Users :

    select * from users;

    Output must show a Sonarqube Users Table.

  4. Then Update the password to default i.e. admin :

    update users set crypted_password = '$2a$12$2NA1PhmvfPVwdwq5WeQj.Opb0z4OGYP8s2yPMRRum18bGV5nJK86W', salt=null where login = 'admin';

  5. try login to Sonarqube server with default credentials,

    ID : admin

    Password : admin

To learn more about @ Sonarqube Security Docs.

Related