Delegate authentication to GitLab with a custom SSL certificate

Hello. I’m meeting similar problem, but not reasons you guys talked above.

I have a self-host Gitlab(version 12.9) and a self-host sonaruqbe(8.2-community), both are serving in https, self sign cert. I want to delegate Authentication with Gitlab.

  • First, I created sonarqube app on gitlab.
  • Second, put application id and secret in sonarqube, allow user sign-up, disable group sync.Set the right Server base URL .

Then I can see “Log in with GitLab” icon in login page, and get this response:

and web log:

2020.04.13 14:16:18 WARN  web[AXFzahyz3CdktahgAAaD][o.s.s.a.AuthenticationError] Fail to callback authentication with 'gitlab'
java.lang.IllegalStateException: PKIX path building failed:
ception: unable to find valid certification path to requested target
        at org.sonar.auth.gitlab.GitLabIdentityProvider.callback(
        at org.sonar.server.authentication.OAuth2CallbackFilter.handleOAuth2Provider(
        at org.sonar.server.authentication.OAuth2CallbackFilter.handleProvider(
        at org.sonar.server.authentication.OAuth2CallbackFilter.doFilter(
        at org.sonar.server.platform.web.MasterServletFilter$GodFilterChain.doFilter(
        at org.sonar.server.platform.web.MasterServletFilter.doFilter(

I seems problem with cert. But I can’t figure it out. Anyone can help?

This is my nginx conf for sonarqube. Does it right?

server {

    listen 80;

    return 301 https://$host$request_uri;


server {

    listen 443 ssl;

    ssl_certificate   /etc/nginx/certs/server.crt;

    ssl_certificate_key  /etc/nginx/certs/server.key;


    ssl_session_timeout 5m;


    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;

    ssl_prefer_server_ciphers on;

    location / {

        proxy_pass http://sonarqube:9000/;

        # proxy_redirect off;

        # proxy_set_header Host $host;

        # proxy_set_header X-Real-IP $remote_addr;

        # proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

        proxy_set_header X-Forwarded-Proto https;



Hi, welcome to the community!

Did you added the GitLab SSL certificate on the jre running SonarQube truststore ? What exact java version is SonarQube using ?

I ran into it and was able to resolve it after I better understood the requirements for using custom cacerts with the Oteemo Helm Chart. I had an entire bundle as a single file with all my certs. What ended up having to do was put all the certs into a directory and create the kubernetes secret based on the path, not the single file. After the redeploy it was able pickup the certs and get past this error message (GitLab fully integrated now too)