Uploaded image for project: 'Apache Knox'
  1. Apache Knox
  2. KNOX-437

KnoxLdapContextFactory should be configured by default in all topology files and docs

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Blocker
    • Resolution: Fixed
    • 0.4.0
    • 0.5.0
    • Server, Site
    • None

    Description

      In some cases the KnoxLdapRealm will not work unless the KnoxLdapContextFactory is also configured. In particular the use of an ${ALIAS=...} in the >main.ldapRealm.contextFactory.systemPassword param. As this is such a common and important use cases the KnoxLdapContextFactory should be included in all default topology files, all sample topology files and all documented topology files.

      The snippet below shows what needs to be added to the topology files.

      <topology>
          <gateway>
              <provider>
                  <role>authentication</role>
                  <name>ShiroProvider</name>
                  <enabled>true</enabled>
                  ...
                  <param>
                      <name>main.ldapRealm</name>
                      <value>org.apache.hadoop.gateway.shirorealm.KnoxLdapRealm</value>
                  </param>
                  <param>
                      <name>main.ldapContextFactory</name>
                      <value>org.apache.hadoop.gateway.shirorealm.KnoxLdapContextFactory</value>
                  </param>
                  <param>
                      <name>main.ldapRealm.contextFactory</name>
                      <value>$ldapContextFactory</value>
                  </param>
                  ...
          </gateway>
          ...
      </topology>
      

      Without this in particular there were exceptions in the gateway.log file at startup when password indirection was used in the ShiroProvider section like this.

                  <param>
                      <name>main.ldapRealm.contextFactory.systemPassword</name>
                      <value>${ALIAS=adSysPwd}</value>
                  </param>
      

      Those exceptions look like this. Indicating that the wrong LdapContextFactory was being used. Specifically the default one that does not have a setClusterName method.

      2014-10-02 13:25:09,888 ERROR env.EnvironmentLoader (EnvironmentLoader.java:initEnvironment(146)) - Shiro environment in
      itialization failed
      org.apache.shiro.config.ConfigurationException: Property 'contextFactory.clusterName' does not exist for object of type
      org.apache.hadoop.gateway.shirorealm.KnoxLdapRealm.
             at org.apache.shiro.config.ReflectionBuilder.isTypedProperty(ReflectionBuilder.java:255)
             at org.apache.shiro.config.ReflectionBuilder.applyProperty(ReflectionBuilder.java:544)
             at org.apache.shiro.config.ReflectionBuilder.applySingleProperty(ReflectionBuilder.java:206)
             at org.apache.shiro.config.ReflectionBuilder.applyProperty(ReflectionBuilder.java:167)
             at org.apache.shiro.config.ReflectionBuilder.buildObjects(ReflectionBuilder.java:124)
      

      Attachments

        1. KNOX-437.patch
          8 kB
          Kevin Minder

        Activity

          People

            kminder Kevin Minder
            kminder Kevin Minder
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: