SonarQube 6.2,sonar-ldap-plugin-2.1.0.507和Active Directory的问题

时间:2017-01-12 18:14:07

标签: sonarqube

尝试使用SonarQube 6.2和LDAP 2.1进行LDAP。我已经通过各种工具等验证了我可以连接到服务器上的LDAP。这些包括LDAPExplorerTool2。我确实在V6之前使用SonarQube在同一台服务器上运行旧的Active Directory插件,但由于Active Directory插件不再有效,我被迫转移到LDAP插件。这是sonar.properties

中的配置部分

Sonar.Properties

sonar.security.realm=LDAP
ldap.realm=mydomain.com
ldap.bindDn=mydomain.com/Service Accounts/username username
ldap.bindpassword=password
ldap.user.baseDn=OU=Global-Users,DC=mydomain,DC=com
ldap.user.request=(&(objectCategory=user)(sAMAccountName={login}))
sonar.authenticator.downcase = true
ldap.user.realNameAttribute=cn

注意:所使用的LDAP信息目前用于与Crucible,SVN,JIRA等的LDAP集成。

sonar.log

Wrapper Started as Service
Launching a JVM...
Wrapper (Version 3.2.3) http://wrapper.tanukisoftware.org
Copyright 1999-2006 Tanuki Software, Inc.  All Rights Reserved.

2017.01.12 12:16:07 INFO  app[][o.s.a.AppFileSystem] Cleaning or creating temp directory F:\SonarQubeServer\sonarqube-6.2\temp
2017.01.12 12:16:07 INFO  app[][o.s.p.m.JavaProcessLauncher] Launch process[es]: F:\Program Files\Java\bin\java -Djava.awt.headless=true -Xmx1G -Xms256m -Xss256k -Djna.nosys=true -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+HeapDumpOnOutOfMemoryError -Djava.io.tmpdir=F:\SonarQubeServer\sonarqube-6.2\temp -javaagent:F:\Program Files\Java\lib\management-agent.jar -cp ./lib/common/*;./lib/search/* org.sonar.search.SearchServer F:\SonarQubeServer\sonarqube-6.2\temp\sq-process30466285842436995properties
2017.01.12 12:16:30 INFO  app[][o.s.p.m.Monitor] Process[es] is up
2017.01.12 12:16:30 INFO  app[][o.s.p.m.JavaProcessLauncher] Launch process[web]: F:\Program Files\Java\bin\java -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djruby.management.enabled=false -Djruby.compile.invokedynamic=false -server -Djava.io.tmpdir=F:\SonarQubeServer\sonarqube-6.2\temp -javaagent:F:\Program Files\Java\lib\management-agent.jar -cp ./lib/common/*;./lib/server/*;F:\SonarQubeServer\sonarqube-6.2\lib\jdbc\mssql\sqljdbc42.jar org.sonar.server.app.WebServer F:\SonarQubeServer\sonarqube-6.2\temp\sq-process7120673276189616218properties
2017.01.12 12:17:23 INFO  app[][o.s.p.m.Monitor] Process[web] is up
2017.01.12 12:17:23 INFO  app[][o.s.p.m.JavaProcessLauncher] Launch process[ce]: F:\Program Files\Java\bin\java -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Xmx512m -Xms128m -XX:+HeapDumpOnOutOfMemoryError -Djava.io.tmpdir=F:\SonarQubeServer\sonarqube-6.2\temp -javaagent:F:\Program Files\Java\lib\management-agent.jar -cp ./lib/common/*;./lib/server/*;./lib/ce/*;F:\SonarQubeServer\sonarqube-6.2\lib\jdbc\mssql\sqljdbc42.jar org.sonar.ce.app.CeServer F:\SonarQubeServer\sonarqube-6.2\temp\sq-process4410592849159288958properties
2017.01.12 12:17:36 INFO  app[][o.s.p.m.Monitor] Process[ce] is up
2017.01.12 12:17:36 INFO  app[][o.s.application.App] SonarQube is up

web.log

2017.01.12 12:16:33 INFO  web[][o.s.p.ProcessEntryPoint] Starting web
2017.01.12 12:16:34 INFO  web[][o.s.s.a.TomcatContexts] Webapp directory: F:\SonarQubeServer\sonarqube-6.2\web
2017.01.12 12:16:35 INFO  web[][o.a.c.h.Http11NioProtocol] Initializing ProtocolHandler ["http-nio-0.0.0.0-80"]
2017.01.12 12:16:35 INFO  web[][o.a.t.u.n.NioSelectorPool] Using a shared selector for servlet write/read
2017.01.12 12:16:38 INFO  web[][o.e.plugins] [Aliyah Bishop] modules [], plugins [], sites []
2017.01.12 12:16:40 INFO  web[][o.s.s.e.EsClientProvider] Connected to local Elasticsearch: [127.0.0.1:9001]
2017.01.12 12:16:40 INFO  web[][o.s.s.p.LogServerVersion] SonarQube Server / 6.2 / 4a28f29f95254b58f3cf0a0871bc632e998403f5
2017.01.12 12:16:40 INFO  web[][o.sonar.db.Database] Create JDBC data source for jdbc:sqlserver://localhost;databaseName=SonarQube
2017.01.12 12:16:46 INFO  web[][o.s.s.p.ServerFileSystemImpl] SonarQube home: F:\SonarQubeServer\sonarqube-6.2
2017.01.12 12:16:46 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin C# / 5.5.2.537 / a4f663cf02cdcc88c221aaae7e7156fa4d176c07
2017.01.12 12:16:46 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin CSS / Less / 2.4 / 5ac876d69f61a2c5fce597f3243bae45b8cd8f5f
2017.01.12 12:16:46 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin Code Smells / 3.0.0
2017.01.12 12:16:46 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin JSON / 2.2 / 0
2017.01.12 12:16:46 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin Java / 4.4.0.8066 / 2703cce280bb210cffe8f8ac918df5f2c4d770f2
2017.01.12 12:16:46 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin JavaScript / 2.19.0.3866 / 97832288f366dae27584956414242e18dc96bca3
2017.01.12 12:16:46 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin LDAP / 2.1.0.507 / 60b4a72c2042d0cad5233be63d0456815c9691e2
2017.01.12 12:16:46 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin Motion Chart / 1.7 / e9c4a5c95c75564b3c3b5a887b63ef50fc59a156
2017.01.12 12:16:46 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin SVN / 1.3 / aff503d48bc77b07c2b62abf93249d0a20bd355c
2017.01.12 12:16:46 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin Web / 2.5.0.476 / 636872f5d37fa7a440fe07d08d504e1a881225e5
2017.01.12 12:16:46 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin XML / 1.4.1 / d2c0388961fcbe78ac597ca3fb3e262d3e733988
2017.01.12 12:16:47 DEBUG web[][o.s.c.p.PluginLoader] API compatibility mode is enabled on plugin XML [xml] (built with API lower than 5.2)
2017.01.12 12:16:47 DEBUG web[][o.s.c.p.PluginLoader] API compatibility mode is enabled on plugin Motion Chart [motionchart] (built with API lower than 5.2)
2017.01.12 12:16:47 DEBUG web[][o.s.c.p.PluginLoader] API compatibility mode is enabled on plugin SVN [scmsvn] (built with API lower than 5.2)
2017.01.12 12:16:48 INFO  web[][o.s.s.p.w.RailsAppsDeployer] Deploying Ruby on Rails applications
2017.01.12 12:16:48 INFO  web[][o.s.s.p.w.RailsAppsDeployer] Deploying app: motionchart
2017.01.12 12:16:48 DEBUG web[][o.s.c.i.DefaultI18n] Loaded 2159 properties from l10n bundles
2017.01.12 12:16:48 INFO  web[][o.s.d.c.MssqlCharsetHandler] Verify that database collation is case-sensitive and accent-sensitive
2017.01.12 12:16:51 INFO  web[][o.s.s.p.UpdateCenterClient] Update center: https://update.sonarsource.org/update-center.properties (no proxy)
2017.01.12 12:16:51 DEBUG web[][o.s.a.r.Languages] Available languages:
2017.01.12 12:16:51 DEBUG web[][o.s.a.r.Languages]   * C# => "cs"
2017.01.12 12:16:51 DEBUG web[][o.s.a.r.Languages]   * CSS => "css"
2017.01.12 12:16:51 DEBUG web[][o.s.a.r.Languages]   * Less => "less"
2017.01.12 12:16:51 DEBUG web[][o.s.a.r.Languages]   * Java => "java"
2017.01.12 12:16:51 DEBUG web[][o.s.a.r.Languages]   * Web => "web"
2017.01.12 12:16:51 DEBUG web[][o.s.a.r.Languages]   * XML => "xml"
2017.01.12 12:16:51 DEBUG web[][o.s.a.r.Languages]   * JSON => "json"
2017.01.12 12:16:51 DEBUG web[][o.s.a.r.Languages]   * JavaScript => "js"
2017.01.12 12:16:51 INFO  web[][org.sonar.INFO] Security realm: LDAP
2017.01.12 12:16:51 INFO  web[][o.s.p.l.LdapSettingsManager] Auto discovery mode
2017.01.12 12:16:51 INFO  web[][o.s.p.l.LdapSettingsManager] Detected server: ldap://myserver.mydomain.com:389
2017.01.12 12:16:51 INFO  web[][o.s.p.l.LdapSettingsManager] User mapping: LdapUserMapping{baseDn=OU=Global-Users,DC=mydomain,DC=com, request=(&(objectCategory=user)(sAMAccountName={0})), realNameAttribute=cn, emailAttribute=mail}
2017.01.12 12:16:51 INFO  web[][o.s.p.l.LdapSettingsManager] Groups will not be synchronized, because property 'ldap.group.baseDn' is empty.
2017.01.12 12:16:51 DEBUG web[][o.s.p.l.LdapContextFactory] Initializing LDAP context {java.naming.provider.url=ldap://myserver.mydomain.com:389, java.naming.factory.initial=com.sun.jndi.ldap.LdapCtxFactory, java.naming.security.principal=mydomain.com/Service Accounts/username username, com.sun.jndi.ldap.connect.pool=true, java.naming.security.authentication=simple, java.naming.security.sasl.realm=mydomain.com, java.naming.referral=follow}
2017.01.12 12:16:53 INFO  web[][o.s.p.l.LdapContextFactory] Test LDAP connection on ldap://myserver.mydomain.com:389: OK
2017.01.12 12:16:53 INFO  web[][org.sonar.INFO] Security realm started
2017.01.12 12:16:53 INFO  web[][o.s.s.n.NotificationDaemon] Notification service started (delay 60 sec.)
2017.01.12 12:16:54 INFO  web[][o.s.s.s.RegisterMetrics] Register metrics
2017.01.12 12:16:54 DEBUG web[][o.s.s.s.RegisterMetrics] Register metrics (done) | time=189ms
2017.01.12 12:16:54 INFO  web[][o.s.s.r.RegisterRules] Register rules
2017.01.12 12:17:02 DEBUG web[][o.s.s.r.RegisterRules] Register rules (done) | time=7631ms
2017.01.12 12:17:02 INFO  web[][o.s.s.q.RegisterQualityProfiles] Register quality profiles
2017.01.12 12:17:05 DEBUG web[][o.s.s.q.RegisterQualityProfiles] Register quality profiles (done) | time=2804ms
2017.01.12 12:17:05 INFO  web[][o.s.s.s.RegisterPermissionTemplates] Register permission templates
2017.01.12 12:17:05 DEBUG web[][o.s.s.s.RegisterPermissionTemplates] Register permission templates (done) | time=7ms
2017.01.12 12:17:05 INFO  web[][o.s.s.s.RenameDeprecatedPropertyKeys] Rename deprecated property keys
2017.01.12 12:17:05 INFO  web[][o.s.s.e.IndexerStartupTask] Index authorization
2017.01.12 12:17:05 INFO  web[][o.s.s.e.IndexerStartupTask] Index issues
2017.01.12 12:17:05 INFO  web[][o.s.s.e.IndexerStartupTask] Index tests
2017.01.12 12:17:05 INFO  web[][o.s.s.e.IndexerStartupTask] Index users
2017.01.12 12:17:05 INFO  web[][o.s.s.e.IndexerStartupTask] Index views
2017.01.12 12:17:05 INFO  web[][o.s.s.e.IndexerStartupTask] Index project measures
2017.01.12 12:17:05 DEBUG web[][o.s.s.p.ServerLifecycleNotifier] Notify ServerStartHandler handlers...
2017.01.12 12:17:05 DEBUG web[][o.s.s.p.ServerLifecycleNotifier] Notify ServerStopHandler handlers...
2017.01.12 12:17:05 INFO  web[][jruby.rack] jruby 1.7.9 (ruby-1.8.7p370) 2013-12-06 87b108a on Java HotSpot(TM) 64-Bit Server VM 1.8.0_92-b14 [Windows Server 2008 R2-amd64]
2017.01.12 12:17:05 INFO  web[][jruby.rack] using a shared (threadsafe!) runtime
2017.01.12 12:17:23 INFO  web[][jruby.rack] keeping custom (config.logger) Rails logger instance
2017.01.12 12:17:23 INFO  web[][o.s.s.p.w.MasterServletFilter] Initializing servlet filter org.sonar.server.ws.WebServiceFilter@7a466ac8 [pattern=org.sonar.api.web.ServletFilter$UrlPattern@2032ab0]
2017.01.12 12:17:23 INFO  web[][o.s.s.p.w.MasterServletFilter] Initializing servlet filter org.sonar.server.authentication.InitFilter@3c2de9ba [pattern=org.sonar.api.web.ServletFilter$UrlPattern@7574d4dd]
2017.01.12 12:17:23 INFO  web[][o.s.s.p.w.MasterServletFilter] Initializing servlet filter org.sonar.server.authentication.OAuth2CallbackFilter@56dc8673 [pattern=org.sonar.api.web.ServletFilter$UrlPattern@5efc52b]
2017.01.12 12:17:23 INFO  web[][o.s.s.p.w.MasterServletFilter] Initializing servlet filter org.sonar.server.authentication.ws.LoginAction@439ebae8 [pattern=org.sonar.api.web.ServletFilter$UrlPattern@38a3f92d]
2017.01.12 12:17:23 INFO  web[][o.s.s.p.w.MasterServletFilter] Initializing servlet filter org.sonar.server.authentication.ws.ValidateAction@74b498ab [pattern=org.sonar.api.web.ServletFilter$UrlPattern@42cb352f]
2017.01.12 12:17:23 INFO  web[][o.a.c.h.Http11NioProtocol] Starting ProtocolHandler ["http-nio-0.0.0.0-80"]
2017.01.12 12:17:23 INFO  web[][o.s.s.a.TomcatAccessLog] Web server is started
2017.01.12 12:17:23 INFO  web[][o.s.s.a.EmbeddedTomcat] HTTP connector enabled on port 80
2017.01.12 12:34:53 DEBUG web[AVmTvuWHWxcly44dAAAJ][o.s.p.l.LdapUsersProvider] Requesting details for user myuser
2017.01.12 12:34:53 DEBUG web[AVmTvuWHWxcly44dAAAJ][o.s.p.l.LdapSearch] Search: LdapSearch{baseDn=OU=Global-Users,DC=mydomain,DC=com, scope=subtree, request=(&(objectCategory=user)(sAMAccountName={0})), parameters=[myuser], attributes=[mail, cn]}
2017.01.12 12:34:53 ERROR web[AVmTvuWHWxcly44dAAAJ][o.s.s.a.RealmAuthenticator] Error during authentication
java.lang.NullPointerException: null
at org.sonar.plugins.ldap.LdapSearch.find(LdapSearch.java:125)
at org.sonar.plugins.ldap.LdapSearch.findUnique(LdapSearch.java:142)
at org.sonar.plugins.ldap.LdapUsersProvider.getUserDetails(LdapUsersProvider.java:80)
at org.sonar.plugins.ldap.LdapUsersProvider.doGetUserDetails(LdapUsersProvider.java:58)
at org.sonar.server.authentication.RealmAuthenticator.doAuthenticate(RealmAuthenticator.java:89)
at org.sonar.server.authentication.RealmAuthenticator.authenticate(RealmAuthenticator.java:83)
at org.sonar.server.authentication.CredentialsAuthenticator.authenticate(CredentialsAuthenticator.java:56)
at org.sonar.server.authentication.CredentialsAuthenticator.authenticate(CredentialsAuthenticator.java:45)
at org.sonar.server.authentication.ws.LoginAction.authenticate(LoginAction.java:91)
at org.sonar.server.authentication.ws.LoginAction.doFilter(LoginAction.java:76)
at org.sonar.server.platform.web.MasterServletFilter$GodFilterChain.doFilter(MasterServletFilter.java:126)
at org.sonar.server.platform.web.MasterServletFilter.doFilter(MasterServletFilter.java:95)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.sonar.server.user.UserSessionFilter.doFilter(UserSessionFilter.java:83)
at org.sonar.server.user.UserSessionFilter.doFilter(UserSessionFilter.java:66)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.sonar.server.platform.web.SecurityServletFilter.doHttpFilter(SecurityServletFilter.java:73)
at org.sonar.server.platform.web.SecurityServletFilter.doFilter(SecurityServletFilter.java:49)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.sonar.server.platform.web.RoutesFilter.doFilter(RoutesFilter.java:55)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.sonar.server.platform.web.requestid.RequestIdFilter.doFilter(RequestIdFilter.java:63)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.sonar.server.platform.web.RootFilter.doFilter(RootFilter.java:62)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at ch.qos.logback.access.tomcat.LogbackValve.invoke(LogbackValve.java:256)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:522)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1095)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:672)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1500)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1456)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Unknown Source)

我尝试了一些不同的方法,包括指定已知LDAP服务器(自动发现的服务器之一)的LDAP URL。我尝试为这些服务器指定端口为3268和389,但它没有任何区别。

我还尝试在LDAP Explorer上运行LDAP查询(&(objectCategory = user)(sAMAccountName = myuser))并返回数据。

java.lang.NullPointerException: null
  at org.sonar.plugins.ldap.LdapSearch.find(LdapSearch.java:125)

查看LDAPSearch的源代码行

context = contextFactory.createBindContext();

完整的代码段是

public NamingEnumeration<SearchResult> find() throws NamingException {
  LOG.debug("Search: {}", this);
  NamingEnumeration<SearchResult> result;
  InitialDirContext context = null;
  boolean threw = false;
  try {
    context = contextFactory.createBindContext();
    SearchControls controls = new SearchControls();
    controls.setSearchScope(scope);
    controls.setReturningAttributes(returningAttributes);
    result = context.search(baseDn, request, parameters, controls);
    threw = true;
  } finally {
    ContextHelper.close(context, threw);
  }
  return result;
}

任何帮助都将不胜感激。

0 个答案:

没有答案