Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-74001

LDAP user details search checks TLS certificate for wrong hostname

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • None

      I want to use an Active Directory domain for user metadata (display name and e-mail address) and group memberships. as such I configured the “Server” field to ldaps://dc2.id.mycompany.com, the “root DN” field to dc=id,dc=mycompany,dc=com, and the other fields as appropriate. This included a manager DN (generic-ldap@id.mycompany.com) and manager password, along with all three filters and both attributes.

      When a user tries to load a page, an error occurs with the stack trace shown below. As you can see, for some reason it is expecting the TLS certificate to contain a SubjectAltName of “id.mycompany.com”. In reality it only contains “dc2.id.mycompany.com”, because that’s its hostname; thus validation fails. But I told it to use the hostname “dc2.id.mycompany.com” in the configuration!

      Oct 22, 2024 3:15:25 P.M. WARNING org.jenkinsci.plugins.reverse_proxy_auth.service.ProxyLDAPUserDetailsService loadUserByUsername

      Failed to search LDAP for username myusername, will retry after waiting for 2000 milliseconds
      java.security.cert.CertificateException: No subject alternative DNS name matching id.mycompany.com found.
      at java.base/sun.security.util.HostnameChecker.matchDNS(HostnameChecker.java:207)
      at java.base/sun.security.util.HostnameChecker.match(HostnameChecker.java:103)
      at java.base/sun.security.ssl.X509TrustManagerImpl.checkIdentity(X509TrustManagerImpl.java:461)
      at java.base/sun.security.ssl.X509TrustManagerImpl.checkIdentity(X509TrustManagerImpl.java:417)
      at java.base/sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:237)
      at java.base/sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:132)
      at java.base/sun.security.ssl.CertificateMessage$T12CertificateConsumer.checkServerCerts(CertificateMessage.java:631)
      Caused: javax.net.ssl.SSLHandshakeException: No subject alternative DNS name matching id.mycompany.com found.
      at java.base/sun.security.ssl.Alert.createSSLException(Alert.java:130)
      at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:378)
      at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:321)
      at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:316)
      at java.base/sun.security.ssl.CertificateMessage$T12CertificateConsumer.checkServerCerts(CertificateMessage.java:647)
      at java.base/sun.security.ssl.CertificateStatus$CertificateStatusConsumer.consume(CertificateStatus.java:296)
      at java.base/sun.security.ssl.SSLHandshake.consume(SSLHandshake.java:393)
      at java.base/sun.security.ssl.HandshakeContext.dispatch(HandshakeContext.java:476)
      at java.base/sun.security.ssl.HandshakeContext.dispatch(HandshakeContext.java:447)
      at java.base/sun.security.ssl.TransportContext.dispatch(TransportContext.java:201)
      at java.base/sun.security.ssl.SSLTransport.decode(SSLTransport.java:172)
      at java.base/sun.security.ssl.SSLSocketImpl.decode(SSLSocketImpl.java:1506)
      at java.base/sun.security.ssl.SSLSocketImpl.readHandshakeRecord(SSLSocketImpl.java:1421)
      at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:455)
      at java.base/sun.security.ssl.SSLSocketImpl.ensureNegotiated(SSLSocketImpl.java:922)
      at java.base/sun.security.ssl.SSLSocketImpl$AppOutputStream.write(SSLSocketImpl.java:1291)
      at java.base/java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:125)
      at java.base/java.io.BufferedOutputStream.implFlush(BufferedOutputStream.java:252)
      at java.base/java.io.BufferedOutputStream.flush(BufferedOutputStream.java:240)
      at java.naming/com.sun.jndi.ldap.Connection.writeRequest(Connection.java:418)
      at java.naming/com.sun.jndi.ldap.Connection.writeRequest(Connection.java:391)
      at java.naming/com.sun.jndi.ldap.LdapClient.ldapBind(LdapClient.java:363)
      at java.naming/com.sun.jndi.ldap.LdapClient.authenticate(LdapClient.java:218)
      at java.naming/com.sun.jndi.ldap.LdapCtx.connect(LdapCtx.java:2896)
      at java.naming/com.sun.jndi.ldap.LdapCtx.<init>(LdapCtx.java:349)
      at java.naming/com.sun.jndi.ldap.LdapCtxFactory.getLdapCtxFromUrl(LdapCtxFactory.java:229)
      at java.naming/com.sun.jndi.ldap.LdapCtxFactory.getUsingURL(LdapCtxFactory.java:189)
      at java.naming/com.sun.jndi.ldap.LdapCtxFactory.getLdapCtxInstance(LdapCtxFactory.java:152)
      at java.naming/com.sun.jndi.url.ldap.ldapURLContextFactory.getObjectInstance(ldapURLContextFactory.java:52)
      at java.naming/com.sun.naming.internal.NamingManagerHelper.getURLObject(NamingManagerHelper.java:364)
      at java.naming/com.sun.naming.internal.NamingManagerHelper.processURL(NamingManagerHelper.java:288)
      at java.naming/com.sun.naming.internal.NamingManagerHelper.processURLAddrs(NamingManagerHelper.java:268)
      at java.naming/com.sun.naming.internal.NamingManagerHelper.getObjectInstance(NamingManagerHelper.java:91)
      at java.naming/com.sun.jndi.ldap.LdapReferralContext.<init>(LdapReferralContext.java:120)
      Caused: javax.naming.CommunicationException: simple bind failed: id.mycompany.com:636 [Root exception is javax.net.ssl.SSLHandshakeException: No subject alternative DNS name matching id.mycompany.com found.]
      at java.naming/com.sun.jndi.ldap.LdapReferralContext.<init>(LdapReferralContext.java:97)
      at java.naming/com.sun.jndi.ldap.LdapReferralException.getReferralContext(LdapReferralException.java:151)
      at java.naming/com.sun.jndi.ldap.AbstractLdapNamingEnumeration.hasMoreReferrals(AbstractLdapNamingEnumeration.java:324)
      at java.naming/com.sun.jndi.ldap.AbstractLdapNamingEnumeration.hasMoreImpl(AbstractLdapNamingEnumeration.java:227)
      Caused: javax.naming.PartialResultException [Root exception is javax.naming.CommunicationException: simple bind failed: id.mycompany.com:636 [Root exception is javax.net.ssl.SSLHandshakeException: No subject alternative DNS name matching id.mycompany.com found.]]
      at java.naming/com.sun.jndi.ldap.AbstractLdapNamingEnumeration.hasMoreImpl(AbstractLdapNamingEnumeration.java:237)
      at java.naming/com.sun.jndi.ldap.AbstractLdapNamingEnumeration.hasMore(AbstractLdapNamingEnumeration.java:189)
      at PluginClassLoader for reverse-proxy-auth-plugin//org.acegisecurity.ldap.LdapTemplate$3.doInDirContext(LdapTemplate.java:257)
      at PluginClassLoader for reverse-proxy-auth-plugin//org.acegisecurity.ldap.LdapTemplate.execute(LdapTemplate.java:126)
      Caused: org.acegisecurity.ldap.LdapDataAccessException: LdapCallback;null; nested exception is javax.naming.PartialResultException [Root exception is javax.naming.CommunicationException: simple bind failed: id.mycompany.com:636 [Root exception is javax.net.ssl.SSLHandshakeException: No subject alternative DNS name matching id.mycompany.com found.]]
      at PluginClassLoader for reverse-proxy-auth-plugin//org.acegisecurity.ldap.LdapTemplate$LdapExceptionTranslator.translate(LdapTemplate.java:295)
      at PluginClassLoader for reverse-proxy-auth-plugin//org.acegisecurity.ldap.LdapTemplate.execute(LdapTemplate.java:128)
      at PluginClassLoader for reverse-proxy-auth-plugin//org.acegisecurity.ldap.LdapTemplate.searchForSingleEntry(LdapTemplate.java:246)
      at PluginClassLoader for reverse-proxy-auth-plugin//org.acegisecurity.ldap.search.FilterBasedLdapUserSearch.searchForUser(FilterBasedLdapUserSearch.java:119)
      at PluginClassLoader for reverse-proxy-auth-plugin//org.jenkinsci.plugins.reverse_proxy_auth.service.ProxyLDAPUserDetailsService.loadUserByUsername(ProxyLDAPUserDetailsService.java:52)
      at PluginClassLoader for reverse-proxy-auth-plugin//org.jenkinsci.plugins.reverse_proxy_auth.service.ProxyLDAPUserDetailsService.loadUserByUsername(ProxyLDAPUserDetailsService.java:19)
      at org.acegisecurity.userdetails.UserDetailsService.lambda$toSpring$1(UserDetailsService.java:52)
      at org.acegisecurity.userdetails.UserDetailsService.lambda$fromSpring$0(UserDetailsService.java:42)
      at PluginClassLoader for reverse-proxy-auth-plugin//org.jenkinsci.plugins.reverse_proxy_auth.ReverseProxySecurityRealm.loadUserByUsername(ReverseProxySecurityRealm.java:701)
      at PluginClassLoader for reverse-proxy-auth-plugin//org.jenkinsci.plugins.reverse_proxy_auth.ReverseProxySecurityRealm$1.doFilter(ReverseProxySecurityRealm.java:529)
      at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:99)
      at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:94)
      at jenkins.security.AcegiSecurityExceptionFilter.doFilter(AcegiSecurityExceptionFilter.java:52)
      at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:99)
      at hudson.security.UnwrapSecurityExceptionFilter.doFilter(UnwrapSecurityExceptionFilter.java:54)
      at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:99)
      at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:126)
      at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:120)
      at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:99)
      at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:100)
      at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:99)
      at org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter.doFilter(RememberMeAuthenticationFilter.java:145)
      at org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter.doFilter(RememberMeAuthenticationFilter.java:101)
      at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:99)
      at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:227)
      at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:221)
      at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:99)
      at jenkins.security.BasicHeaderProcessor.doFilter(BasicHeaderProcessor.java:97)
      at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:99)
      at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:117)
      at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
      at hudson.security.HttpSessionContextIntegrationFilter2.doFilter(HttpSessionContextIntegrationFilter2.java:63)
      at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:99)
      at hudson.security.ChainedServletFilter.doFilter(ChainedServletFilter.java:111)
      at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:99)
      at hudson.security.ChainedServletFilter.doFilter(ChainedServletFilter.java:111)
      at hudson.security.HudsonFilter.doFilter(HudsonFilter.java:172)
      at Jenkins Main ClassLoader//org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:202)
      at Jenkins Main ClassLoader//org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1635)
      at org.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.java:53)
      at Jenkins Main ClassLoader//org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:202)
      at Jenkins Main ClassLoader//org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1635)
      at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:86)
      at Jenkins Main ClassLoader//org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:202)
      at Jenkins Main ClassLoader//org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1635)
      at org.kohsuke.stapler.DiagnosticThreadNameFilter.doFilter(DiagnosticThreadNameFilter.java:31)
      at Jenkins Main ClassLoader//org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:202)
      at Jenkins Main ClassLoader//org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1635)
      at jenkins.security.SuspiciousRequestFilter.doFilter(SuspiciousRequestFilter.java:38)
      at Jenkins Main ClassLoader//org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:202)
      at Jenkins Main ClassLoader//org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1635)
      at Jenkins Main ClassLoader//org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:527)
      at Jenkins Main ClassLoader//org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:131)
      at Jenkins Main ClassLoader//org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:569)
      at Jenkins Main ClassLoader//org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:122)
      at Jenkins Main ClassLoader//org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:223)
      at Jenkins Main ClassLoader//org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1580)
      at Jenkins Main ClassLoader//org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:221)
      at Jenkins Main ClassLoader//org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1384)
      at Jenkins Main ClassLoader//org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:176)
      at Jenkins Main ClassLoader//org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:484)
      at Jenkins Main ClassLoader//org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1553)
      at Jenkins Main ClassLoader//org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:174)
      at Jenkins Main ClassLoader//org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1306)
      at Jenkins Main ClassLoader//org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:129)
      at Jenkins Main ClassLoader//org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:122)
      at Jenkins Main ClassLoader//org.eclipse.jetty.server.handler.gzip.GzipHandler.handle(GzipHandler.java:822)
      at Jenkins Main ClassLoader//org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:122)
      at Jenkins Main ClassLoader//org.eclipse.jetty.server.Server.handle(Server.java:563)
      at Jenkins Main ClassLoader//org.eclipse.jetty.server.HttpChannel$RequestDispatchable.dispatch(HttpChannel.java:1598)
      at Jenkins Main ClassLoader//org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:753)
      at Jenkins Main ClassLoader//org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:501)
      at Jenkins Main ClassLoader//org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:287)
      at Jenkins Main ClassLoader//org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:314)
      at Jenkins Main ClassLoader//org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:100)
      at Jenkins Main ClassLoader//org.eclipse.jetty.io.SelectableChannelEndPoint$1.run(SelectableChannelEndPoint.java:53)
      at Jenkins Main ClassLoader//org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.runTask(AdaptiveExecutionStrategy.java:421)
      at Jenkins Main ClassLoader//org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.consumeTask(AdaptiveExecutionStrategy.java:390)
      at Jenkins Main ClassLoader//org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.tryProduce(AdaptiveExecutionStrategy.java:277)
      at Jenkins Main ClassLoader//org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.run(AdaptiveExecutionStrategy.java:199)
      at Jenkins Main ClassLoader//org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:411)
      at Jenkins Main ClassLoader//org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:969)
      at Jenkins Main ClassLoader//org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.doRunJob(QueuedThreadPool.java:1194)
      at Jenkins Main ClassLoader//org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1149)
      at java.base/java.lang.Thread.run(Thread.java:1583)

            rdalton Richard Dalton
            haw777 Christopher Head
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: