Hi All,
I am trying to implement Kerberos authentication using ApacheDS 1.5.5. I went through several web resources and found [1] as most appropriate for 1.5.5.

[1] https://cwiki.apache.org/DIRxSRVx11/543-kerberos-in-apacheds-155.html

I configured directory server according to [1] and i was able to successfully retrieve TGTs using "kinit". But the problem comes when i try to access directory using GSSAPI mechanism. The complete error is as follows,

a...@aj-laptop:~/development/Tools/LDAP$ ldapsearch -H ldap://localhost:10389 -b "dc=example,dc=com" "(uid=hnelson)" -Y GSSAPI
SASL/GSSAPI authentication started
ldap_sasl_interactive_bind_s: Local error (-2)

I adjust ApacheDS logging parameters to log INFO messages and got to know that none of the messages are printed when executing above command. (But there were messages printed when i access Directory Server using some anonymous mechanism. Also i was not able to configure server to print DEBUG messages as it crashes at startup.). But I analyze messages through WireShark and got to know that some number of messages are exchanged between server and client when executing above command.

From web resources i found usual cause for above error is not having the ticket. But i am certain, that i was able to retrieve ticket using kinit. The klist output is as follows,

a...@aj-laptop:~/development/Tools/LDAP$ klist
Ticket cache: FILE:/tmp/krb5cc_1000
Default principal: [email protected]

Valid starting     Expires            Service principal
08/25/10 15:48:27  08/26/10 15:48:23  krbtgt/[email protected]

Also my ApacheDS server supports GSSAPI authentication. See below.

a...@aj-laptop:~/development/Tools/LDAP$ ldapsearch -H ldap://localhost:10389 -s base -LLL supportedSASLMechanisms -x
dn:
supportedSASLMechanisms: SIMPLE
supportedSASLMechanisms: CRAM-MD5
supportedSASLMechanisms: DIGEST-MD5
supportedSASLMechanisms: GSSAPI
supportedSASLMechanisms: NTLM
supportedSASLMechanisms: GSS-SPNEGO


Also i have installed all relevant sasl client libraries.

a...@aj-laptop:~/development/Tools/LDAP$ saslpluginviewer | grep -i gssapi
ANONYMOUS LOGIN CRAM-MD5 DIGEST-MD5 GSSAPI PLAIN NTLM EXTERNAL
Plugin "gssapiv2" [loaded],     API version: 4
  SASL mechanism: GSSAPI, best SSF: 56, supports setpass: no
ANONYMOUS LOGIN CRAM-MD5 DIGEST-MD5 GSSAPI PLAIN NTLM EXTERNAL
Plugin "gssapiv2" [loaded],     API version: 4
  SASL mechanism: GSSAPI, best SSF: 56

So now i couldnt fathom a possible reason for above error.
I have been stuck with this for about 2 days. I am really grateful if one of you can help me.

I am attaching server.xml with this email. My /etc/krb5.conf is as follows,

[libdefaults]
      default_realm = EXAMPLE.COM

[realms]
      EXAMPLE.COM = {
              kdc = localhost:60088
      }

[domain_realm]
      .example.com = EXAMPLE.COM
      example.com = EXAMPLE.COM

[login]
      krb4_convert = true
      krb4_get_tickets = false



Thanks.
Regards,
Amila Jayasekara
<?xml version="1.0" encoding="UTF-8"?>

<!--
  Licensed to the Apache Software Foundation (ASF) under one
  or more contributor license agreements.  See the NOTICE file
  distributed with this work for additional information
  regarding copyright ownership.  The ASF licenses this file
  to you under the Apache License, Version 2.0 (the
  "License"); you may not use this file except in compliance
  with the License.  You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing,
  software distributed under the License is distributed on an
  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  KIND, either express or implied.  See the License for the
  specific language governing permissions and limitations
  under the License.
-->


<spring:beans xmlns="http://apacheds.org/config/1.5.7";
       xmlns:spring="http://xbean.apache.org/schemas/spring/1.0";
       xmlns:s="http://www.springframework.org/schema/beans";>

  <defaultDirectoryService id="directoryService" instanceId="default"
                           replicaId="1"
                           workingDirectory="example.com"
                           allowAnonymousAccess="true"
                           accessControlEnabled="false"
                           denormalizeOpAttrsEnabled="false"
                           syncPeriodMillis="15000"
                           maxPDUSize="2000000">
    <systemPartition>
      <!-- use the following partitionConfiguration to override defaults for -->
      <!-- the system partition                                              -->
      <jdbmPartition id="system" cacheSize="100" suffix="ou=system" optimizerEnabled="true" syncOnWrite="true">
        <indexedAttributes>
          <jdbmIndex attributeId="1.3.6.1.4.1.18060.0.4.1.2.1" cacheSize="100"/>
          <jdbmIndex attributeId="1.3.6.1.4.1.18060.0.4.1.2.2" cacheSize="100"/>
          <jdbmIndex attributeId="1.3.6.1.4.1.18060.0.4.1.2.3" cacheSize="100"/>
          <jdbmIndex attributeId="1.3.6.1.4.1.18060.0.4.1.2.4" cacheSize="100"/>
          <jdbmIndex attributeId="1.3.6.1.4.1.18060.0.4.1.2.5" cacheSize="10"/>
          <jdbmIndex attributeId="1.3.6.1.4.1.18060.0.4.1.2.6" cacheSize="10"/>
          <jdbmIndex attributeId="1.3.6.1.4.1.18060.0.4.1.2.7" cacheSize="10"/>
          <jdbmIndex attributeId="ou" cacheSize="100"/>
          <jdbmIndex attributeId="uid" cacheSize="100"/>
          <jdbmIndex attributeId="objectClass" cacheSize="100"/>
        </indexedAttributes>
      </jdbmPartition>
    </systemPartition>

    <partitions>
      <!-- NOTE: when specifying new partitions you need not include those   -->
      <!-- attributes below with OID's which are the system indices, if left -->
      <!-- out they will be automatically configured for you with defaults.  -->
      <jdbmPartition id="example" cacheSize="100" suffix="dc=example,dc=com" optimizerEnabled="true"
                     syncOnWrite="true">
        <indexedAttributes>
          <jdbmIndex attributeId="1.3.6.1.4.1.18060.0.4.1.2.1" cacheSize="100"/>
          <jdbmIndex attributeId="1.3.6.1.4.1.18060.0.4.1.2.2" cacheSize="100"/>
          <jdbmIndex attributeId="1.3.6.1.4.1.18060.0.4.1.2.3" cacheSize="100"/>
          <jdbmIndex attributeId="1.3.6.1.4.1.18060.0.4.1.2.4" cacheSize="100"/>
          <jdbmIndex attributeId="1.3.6.1.4.1.18060.0.4.1.2.5" cacheSize="10"/>
          <jdbmIndex attributeId="1.3.6.1.4.1.18060.0.4.1.2.6" cacheSize="10"/>
          <jdbmIndex attributeId="1.3.6.1.4.1.18060.0.4.1.2.7" cacheSize="10"/>
          <jdbmIndex attributeId="dc" cacheSize="100"/>
          <jdbmIndex attributeId="ou" cacheSize="100"/>
          <jdbmIndex attributeId="krb5PrincipalName" cacheSize="100"/>
          <jdbmIndex attributeId="uid" cacheSize="100"/>
          <jdbmIndex attributeId="objectClass" cacheSize="100"/>
        </indexedAttributes>
      </jdbmPartition>
    </partitions>

    <interceptors>
      <normalizationInterceptor/>
      <authenticationInterceptor/>
      <referralInterceptor/>
      <aciAuthorizationInterceptor/>
      <defaultAuthorizationInterceptor/>
      <exceptionInterceptor/>
      <operationalAttributeInterceptor/>

      <!-- Uncomment to enable the password policy interceptor
      <passwordPolicyInterceptor/>
      -->
      <keyDerivationInterceptor/>

      <schemaInterceptor/>
      <subentryInterceptor/>
      <collectiveAttributeInterceptor/>
      <eventInterceptor/>
      <triggerInterceptor/>

      <!-- Uncomment to enable replication interceptor
      <replicationInterceptor>
        <configuration>
          <replicationConfiguration serverPort="10390" peerReplicas="instanc...@localhost:10392">
            <replicaId>
              <replicaId id="instance_a"/>
            </replicaId>
          </replicationConfiguration>
        </configuration>
      </replicationInterceptor>
      -->
    </interceptors>

    <!-- Uncomment to enable replication configuration -->
    <!--replicationConfiguration>
      <providers>
        <provider id="1 type="refreshAndPersist" timeLimit="1000" sizeLimit="1000">
          <url>
            ldap://ldap1.acme.com:10389/ou=data,dc=acme,dc=com?*, +?sub?(objectClass=*)
          </url>
          <connection bindMethod="simple">
            <principal> 
              uid=admin,ou=system 
            </principal> 
            <credentials>secret</credentials>
          </bind>
        </provider>
        <provider id="2 type="refreshAndPersist" timeLimit="1000" sizeLimit="1000">
          <url>
            ldaps://ldap2.acme.com:10389/ou=data,dc=acme,dc=com?*, +?sub?(objectClass=*)
          </url>
          <connection bindMethod="simple">
            <principal> 
              uid=admin,ou=system 
            </principal> 
            <credentials>secret</credentials>
          </bind>
        </provider>
      </providers>
    </replicationConfiguration-->

  </defaultDirectoryService>


  <!-- 
  +============================================================+
  | ChangePassword server configuration                        |
  +============================================================+
  -->
  <!--  missing  atou=users,dc=example,dc=com
  <changePasswordServer id="changePasswordServer">
    <transports>
      <tcpTransport port="60464" nbThreads="2" backLog="50"/>
      <udpTransport port="60464" nbThreads="2" backLog="50"/>
    </transports>
    <directoryService>#directoryService</directoryService>
  </changePasswordServer>
  -->

  <!-- 
  +============================================================+
  | Kerberos server configuration                              |
  +============================================================+
  -->
  <!--  missing atou=users,dc=example,dc=com -->
  <kdcServer id="kdcServer" searchBaseDn="ou=Users,dc=example,dc=com">
    <transports>
      <tcpTransport port="60088" nbThreads="4" backLog="50"/>
      <udpTransport port="60088" nbThreads="4" backLog="50"/>
    </transports>
    <directoryService>#directoryService</directoryService>
  </kdcServer>

  <!-- 
  +============================================================+
  | NtpServer configuration                                    |
  +============================================================+
  -->
  <!--ntpServer>
    <transports>
      <tcpTransport port="60123"/>
      <udpTransport port="60123" nbThreads="1"/>
    </transports>
  </ntpServer-->

  <!-- 
  +============================================================+
  | DnsServer configuration                                    |
  +============================================================+
  -->
  <!--  missing atou=users,dc=example,dc=com
  <dnsServer>
    <transports>
      <tcpTransport port="8053"/>
      <udpTransport port="8053"/>
    </transports>
    <directoryService>#directoryService</directoryService>
  </dnsServer>
-->

  <!-- 
  +============================================================+
  | LDAP Service configuration                                 |
  +============================================================+
  -->
  
  <ldapServer id="ldapServer"
            allowAnonymousAccess="false"
            saslHost="localhost"
            saslPrincipal="ldap/[email protected]"
            searchBaseDn="ou=users,dc=example,dc=com"
            maxTimeLimit="15000"
            maxSizeLimit="1000">
    <transports>
      <tcpTransport address="0.0.0.0" port="10389" nbThreads="8" backLog="50" enableSSL="false"/>
      <tcpTransport address="localhost" port="10686" enableSSL="true"/>
    </transports>

    <directoryService>#directoryService</directoryService>

    <!-- The list of supported authentication mechanisms.                   -->
    <saslMechanismHandlers>
      <simpleMechanismHandler mech-name="SIMPLE"/>
      <cramMd5MechanismHandler mech-name="CRAM-MD5" />
      <digestMd5MechanismHandler mech-name="DIGEST-MD5" />
      <gssapiMechanismHandler mech-name="GSSAPI" />
      <ntlmMechanismHandler mech-name="NTLM" ntlmProviderFqcn="com.foo.Bar"/>
      <ntlmMechanismHandler mech-name="GSS-SPNEGO" ntlmProviderFqcn="com.foo.Bar"/>
    </saslMechanismHandlers>

    <!-- The realms serviced by this SASL host, used by DIGEST-MD5 and GSSAPI. -->
    <saslRealms>
      <s:value>example.com</s:value>
      <s:value>apache.org</s:value>
    </saslRealms>

    <!-- the collection of extended operation handlers to install           -->
    <extendedOperationHandlers>
      <startTlsHandler/>
      <gracefulShutdownHandler/>
      <launchDiagnosticUiHandler/>
      <!-- The Stored Procedure Extended Operation is not stable yet and it may cause security risks.-->
      <!--storedProcedureExtendedOperationHandler/-->
    </extendedOperationHandlers>
  </ldapServer>

  <apacheDS id="apacheDS">
    <ldapServer>#ldapServer</ldapServer>
  </apacheDS>
</spring:beans>

Reply via email to