title: Trouble setting up LDAPS for login in Sonarqube Docker container
body: <p>I am running Sonarqube in a docker container using the default image from docker hub.  Sonarqube is working fine.  I am now working on using LDAPS for system login and can't seem to get it to work.  I created a centos:latest container and have sonarqube running there.  I did this so I could have ldapsearch, vim, telnet, update-ca, etc.  I used openssl to add the server certificate.  I tested with ldapsearch and the following is successful:</p>
  
  <pre><code>[root@bf9accb5647d linux-x86-64]# ldapsearch -x -LLL -H ldaps://dir.example.com -b "dc=example,dc=com" -D "uid=svcSonar,ou=SvcAccts,ou=People,dc=example,dc=com" -W '(uid=usernamehere)' cn
  Enter LDAP Password: ******
  dn: uid=usernamehere,ou=Users,ou=People,dc=example,dc=com
  cn: User Name
  </code></pre>
  
  <p>Here is my relevant ldap configuration in sonar.properties:</p>
  
  <pre><code>sonar.security.realm=LDAP
  ldap.url=ldaps://dir.example.com
  ldap.bindDN=uid=svcSonar,ou=SvcAccts,ou=People,dc=example,dc=com
  ldap.bindPassword=mypassword
  ldap.user.baseDn=ou=Users,ou=People,dc=example,dc=com
  ldap.user.request=(uid={login})
  </code></pre>
  
  <p>Here is the relevant sonar.log entries with TRACE and DEBUG on:</p>
  
  <pre><code>2016.04.15 16:32:35 INFO  web[o.s.s.p.ServerPluginRepository] Deploy plugin LDAP / 1.5.1 / 8960e08512a3d3ec4d9cf16c4c2c95017b5b7ec5
  2016.04.15 20:19:07 INFO  web[org.sonar.INFO] Security realm: LDAP
  2016.04.15 20:19:07 INFO  web[o.s.p.l.LdapSettingsManager] User mapping: LdapUserMapping{baseDn=ou=Users,ou=People,dc=example,dc=com, request=(uid={0}), realNameAttribute=cn, emailAttribute=mail}
  2016.04.15 20:19:07 DEBUG web[o.s.p.l.LdapContextFactory] Initializing LDAP context {java.naming.provider.url=ldaps://dir.example.com, java.naming.factory.initial=com.sun.jndi.ldap.LdapCtxFactory, com.sun.jndi.ldap.connect.pool=true, java.naming.security.authentication=simple, java.naming.referral=follow}
  2016.04.15 20:19:07 INFO  web[o.s.p.l.LdapContextFactory] Test LDAP connection on ldaps://dir.example.com: OK
  2016.04.15 20:19:07 INFO  web[org.sonar.INFO] Security realm started
  .
  .
  .
  2016.04.15 20:26:55 DEBUG web[o.s.p.l.LdapUsersProvider] Requesting details for user usernamehere
  2016.04.15 20:26:55 DEBUG web[o.s.p.l.LdapSearch] Search: LdapSearch{baseDn=ou=Users,ou=People,dc=example,dc=com, scope=s
  ubtree, request=(uid={0}), parameters=[usernamehere], attributes=[mail, cn]}
  2016.04.15 20:26:55 DEBUG web[o.s.p.l.LdapContextFactory] Initializing LDAP context {java.naming.provider.url=ldaps://di
  r.example.com, java.naming.factory.initial=com.sun.jndi.ldap.LdapCtxFactory, com.sun.jndi.ldap.connect.pool=true, java.na
  ming.security.authentication=simple, java.naming.referral=follow}
  2016.04.15 20:26:55 DEBUG web[o.s.p.l.LdapUsersProvider] User usernamehere not found in &lt;default&gt;
  </code></pre>
  
  <p>I did the following for the certificate:</p>
  
  <pre><code>echo "" | openssl s_client -connect server:port -prexit 2&gt;/dev/null | sed -n -e '/BEGIN\ CERTIFICATE/,/END\ CERTIFICATE/ p' &gt; ldap.pem
  update-ca-trust force-enable
  cp ldap.pem /etc/pki/ca-trust/source/anchors/
  update-ca-trust extract
  </code></pre>
  
  <p>I also used the keytool to add the ldap.pem to the java cacerts for the jre being using by Sonarqube.</p>
  
  <p>Any ideas?</p>