Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-109015

LDAP user import can be triggered at startup even if not explicitly enabled

Details

    Description

      Reproducing Steps

      1. Startup Liferay
      2. Go to Control Panel > Configuration > Instance Settings > LDAP > Import (or ... > Instance Settings > Configuration > Authentication > LDAP)
      3. Enable LDAP (but do not actually configure one to ensure the problem is readily visible)
        1. Make sure to enable "Import" but not "Enable Import on Startup"
        2. Notice that the default import interval is 10 minutes
        3. Save
      4. Restart Liferay
        Expected: There are no warning or errors in the logs since user import wasn't triggered.
        Observed: User import was triggered and the following warning is displayed at startup
        2020-02-20 09:28:00.579 WARN  [liferay/scheduled_user_ldap_import-1][DefaultPortalLDAP:184] Unable to bind to the LDAP server
        javax.naming.CommunicationException: localhost:10389 [Root exception is java.net.ConnectException: Connection refused (Connection refused)]
        	at com.sun.jndi.ldap.Connection.<init>(Connection.java:226)
        	at com.sun.jndi.ldap.LdapClient.<init>(LdapClient.java:137)
        	at com.sun.jndi.ldap.LdapClientFactory.createPooledConnection(LdapClientFactory.java:64)
        	at com.sun.jndi.ldap.pool.Connections.<init>(Connections.java:114)
        	at com.sun.jndi.ldap.pool.Pool.getPooledConnection(Pool.java:136)
        	at com.sun.jndi.ldap.LdapPoolManager.getLdapClient(LdapPoolManager.java:340)
        	at com.sun.jndi.ldap.LdapClient.getInstance(LdapClient.java:1601)
        	at com.sun.jndi.ldap.LdapCtx.connect(LdapCtx.java:2749)
        	at com.sun.jndi.ldap.LdapCtx.<init>(LdapCtx.java:319)
        	at com.sun.jndi.ldap.LdapCtxFactory.getUsingURL(LdapCtxFactory.java:192)
        	at com.sun.jndi.ldap.LdapCtxFactory.getUsingURLs(LdapCtxFactory.java:210)
        	at com.sun.jndi.ldap.LdapCtxFactory.getLdapCtxInstance(LdapCtxFactory.java:153)
        	at com.sun.jndi.ldap.LdapCtxFactory.getInitialContext(LdapCtxFactory.java:83)
        	at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:684)
        	at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:313)
        	at javax.naming.InitialContext.init(InitialContext.java:244)
        	at javax.naming.ldap.InitialLdapContext.<init>(InitialLdapContext.java:154)
        	at com.liferay.portal.security.ldap.internal.DefaultPortalLDAP.getContext(DefaultPortalLDAP.java:180)
        	at com.liferay.portal.security.ldap.internal.DefaultPortalLDAP.getContext(DefaultPortalLDAP.java:126)
        	at com.liferay.portal.security.ldap.internal.exportimport.LDAPUserImporterImpl.importUsers(LDAPUserImporterImpl.java:433)
        	at com.liferay.portal.security.ldap.internal.exportimport.LDAPUserImporterImpl.importUsers(LDAPUserImporterImpl.java:417)
        	at com.liferay.portal.security.ldap.internal.configuration.persistence.listener.UserImportMessageListener.doReceive(UserImportMessageListener.java:135)
        	at com.liferay.portal.kernel.messaging.BaseMessageListener.receive(BaseMessageListener.java:26)
        	at com.liferay.portal.kernel.scheduler.messaging.SchedulerEventMessageListenerWrapper._processMessage(SchedulerEventMessageListenerWrapper.java:127)
        	at com.liferay.portal.kernel.scheduler.messaging.SchedulerEventMessageListenerWrapper.receive(SchedulerEventMessageListenerWrapper.java:98)
        	at com.liferay.portal.kernel.messaging.InvokerMessageListener.receive(InvokerMessageListener.java:74)
        	at com.liferay.portal.messaging.internal.SerialDestination$1.run(SerialDestination.java:62)
        	at com.liferay.portal.kernel.concurrent.ThreadPoolExecutor$WorkerTask._runTask(ThreadPoolExecutor.java:752)
        	at com.liferay.portal.kernel.concurrent.ThreadPoolExecutor$WorkerTask.run(ThreadPoolExecutor.java:664)
        	at java.lang.Thread.run(Thread.java:748)
        Caused by: java.net.ConnectException: Connection refused (Connection refused)
        	at java.net.PlainSocketImpl.socketConnect(Native Method)
        	at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
        	at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
        	at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
        	at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
        	at java.net.Socket.connect(Socket.java:607)
        	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        	at java.lang.reflect.Method.invoke(Method.java:498)
        	at com.sun.jndi.ldap.Connection.createSocket(Connection.java:360)
        	at com.sun.jndi.ldap.Connection.<init>(Connection.java:213)
        	... 29 more
        

      Note:

      1. The trace is shown because the LDAP connection is not properly configure so it let us see that the import task has been triggered. If we had actually configured the LDAP connection, we wouldn't notice that the task triggered ahead of time.
      2. The observed behavior may not happen every single time, so more than one try may be needed.
      3. The observed behavior is not the expected one because we haven't checked "Enable Import on Startup".

      Attachments

        Activity

          People

            della.wang Della Wang (Inactive)
            ricardo.couso Ricardo Couso
            Kiyoshi Lee Kiyoshi Lee
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              3 years, 14 weeks ago

              Packages

                Version Package
                7.0.10.13 DXP SP13
                7.0.X
                7.1.10 DXP FP17
                7.1.10.4 SP4
                7.1.X
                7.2.10 DXP FP5
                7.2.10.2 DXP SP2
                7.2.X
                7.3.1 CE GA2
                7.3.2 CE GA3
                7.3.10 DXP GA1
                Master