On Sat, Feb 6, 2010 at 2:29 PM, Stefan Seelmann <[email protected]> wrote:

> Amila Suriarachchi schrieb:
>
>  that works. Thansks.
>>
>> How can I start the KDCServer programatically? I start ldap server as
>> follows,
>>
>
> Sure you can, see the following test case [1].
>

thanks it worked.

All these samples uses EXAMPLE.COM as the domain. on the dc=example,dc=com
partition.

Can I configure more the one domain in one kerborse server?

I tried to add a different partition and same set of user by editing the
lidf file. please see the attachments.

but get this exception when try to log with [email protected].



[14:49:47] DEBUG
[org.apache.directory.server.kerberos.protocol.KerberosProtocolHandler] - /
127.0.0.1:51219 CREATED:  datagram
[14:49:47] DEBUG
[org.apache.directory.server.kerberos.protocol.KerberosProtocolHandler] - /
127.0.0.1:51219 OPENED
[14:49:47] DEBUG
[org.apache.directory.server.kerberos.protocol.KerberosProtocolHandler] - /
127.0.0.1:51219 RCVD:
org.apache.directory.server.kerberos.shared.messages.kdcrequ...@2f49f041
[14:49:47] DEBUG
[org.apache.directory.server.kerberos.kdc.authentication.AuthenticationService]
- Received Authentication Service (AS) request:
    messageType:           AS_REQ
    protocolVersionNumber: 5
    clientAddress:         127.0.0.1
    nonce:                 1265534387
    kdcOptions:
    clientPrincipal:       [email protected]
    serverPrincipal:       krbtgt/[email protected]
    encryptionType:        des-cbc-md5 (3), aes256-cts-hmac-sha1-96 (18),
des3-cbc-sha1-kd (16), des-cbc-crc (1), aes128-cts-hmac-sha1-96 (17),
rc4-hmac (23)
    realm:                 WSO2.COM
    from time:             null
    till time:             19700101000000Z
    renew-till time:       null
    hostAddresses:         null
[14:49:47] DEBUG
[org.apache.directory.server.kerberos.kdc.authentication.AuthenticationService]
- Session will use encryption type des-cbc-md5 (3).
[14:49:47] WARN
[org.apache.directory.server.kerberos.shared.store.operations.StoreUtils] -
No server entry found for kerberos principal name [email protected]
[14:49:47] WARN
[org.apache.directory.server.kerberos.protocol.KerberosProtocolHandler] -
Client not found in Kerberos database (6)
org.apache.directory.server.kerberos.shared.exceptions.KerberosException:
Client not found in Kerberos database
    at
org.apache.directory.server.kerberos.kdc.authentication.AuthenticationService.getEntry(AuthenticationService.java:747)
    at
org.apache.directory.server.kerberos.kdc.authentication.AuthenticationService.getClientEntry(AuthenticationService.java:152)
    at
org.apache.directory.server.kerberos.kdc.authentication.AuthenticationService.execute(AuthenticationService.java:103)
    at
org.apache.directory.server.kerberos.protocol.KerberosProtocolHandler.messageReceived(KerberosProtocolHandler.java:145)
    at
org.apache.mina.core.filterchain.DefaultIoFilterChain$TailFilter.messageReceived(DefaultIoFilterChain.java:721)
    at
org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:433)
    at
org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1200(DefaultIoFilterChain.java:47)
    at
org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:801)
    at
org.apache.mina.filter.codec.ProtocolCodecFilter$ProtocolDecoderOutputImpl.flush(ProtocolCodecFilter.java:375)
    at
org.apache.mina.filter.codec.ProtocolCodecFilter.messageReceived(ProtocolCodecFilter.java:229)
    at
org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:433)
    at
org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1200(DefaultIoFilterChain.java:47)
    at
org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:801)
    at
org.apache.mina.core.filterchain.IoFilterAdapter.messageReceived(IoFilterAdapter.java:119)
    at
org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:433)
    at
org.apache.mina.core.filterchain.DefaultIoFilterChain.fireMessageReceived(DefaultIoFilterChain.java:425)
    at
org.apache.mina.core.polling.AbstractPollingConnectionlessIoAcceptor.readHandle(AbstractPollingConnectionlessIoAcceptor.java:436)
    at
org.apache.mina.core.polling.AbstractPollingConnectionlessIoAcceptor.processReadySessions(AbstractPollingConnectionlessIoAcceptor.java:407)
    at
org.apache.mina.core.polling.AbstractPollingConnectionlessIoAcceptor.access$600(AbstractPollingConnectionlessIoAcceptor.java:56)
    at
org.apache.mina.core.polling.AbstractPollingConnectionlessIoAcceptor$Acceptor.run(AbstractPollingConnectionlessIoAcceptor.java:360)
    at
org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:64)
    at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.NullPointerException
    at
org.apache.directory.server.kerberos.shared.store.operations.GetPrincipal.getEntry(GetPrincipal.java:97)
    at
org.apache.directory.server.kerberos.shared.store.operations.GetPrincipal.execute(GetPrincipal.java:81)
    at
org.apache.directory.server.kerberos.shared.store.SingleBaseSearch.getPrincipal(SingleBaseSearch.java:63)
    at
org.apache.directory.server.kerberos.shared.store.DirectoryPrincipalStore.getPrincipal(DirectoryPrincipalStore.java:71)
    at
org.apache.directory.server.kerberos.kdc.authentication.AuthenticationService.getEntry(AuthenticationService.java:743)
    ... 23 more
[14:49:47] DEBUG
[org.apache.directory.server.kerberos.protocol.KerberosProtocolHandler] -
Responding to request with error:
    explanatory text:      Client not found in Kerberos database
    error code:            6
    clientPrincipal:       null
    client time:           null
    serverPrincipal:       krbtgt/[email protected]
    server time:           20100207091947Z
[14:49:47] DEBUG
[org.apache.directory.server.kerberos.protocol.KerberosProtocolHandler] - /
127.0.0.1:51219 SENT:
org.apache.directory.server.kerberos.shared.messages.errormess...@67de0c09
[14:50:47] DEBUG
[org.apache.directory.server.kerberos.protocol.KerberosProtocolHandler] - /
127.0.0.1:51219 CLOSED

thanks,
Amila.




>
> Kind Regards,
> Stefan
>
>
>
> [1]
> http://svn.apache.org/repos/asf/directory/apacheds/tags/1.5.5/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/kdc/SaslGssapiBindITest.java
>
>
>


-- 
Amila Suriarachchi
WSO2 Inc.
blog: http://amilachinthaka.blogspot.com/
dn: dc=wso2,dc=com
objectClass: dcObject
objectClass: organization
objectClass: top
dc: wso2
o: wso2.com

dn: ou=Users,dc=wso2,dc=com
objectClass: organizationalUnit
objectClass: top
ou: Users

dn: uid=hnelson,ou=Users,dc=wso2,dc=com
objectClass: top
objectClass: person
objectClass: inetOrgPerson
objectClass: krb5principal
objectClass: krb5kdcentry
cn: Horatio Nelson
sn: Nelson
uid: hnelson
userPassword: secret
krb5PrincipalName: [email protected]
krb5KeyVersionNumber: 0

dn: uid=krbtgt,ou=Users,dc=wso2,dc=com
objectClass: top
objectClass: person
objectClass: inetOrgPerson
objectClass: krb5principal
objectClass: krb5kdcentry
cn: KDC Service
sn: Service
uid: krbtgt
userPassword: secret
krb5PrincipalName: krbtgt/[email protected]
krb5KeyVersionNumber: 0

dn: uid=ldap,ou=Users,dc=wso2,dc=com
objectClass: top
objectClass: person
objectClass: inetOrgPerson
objectClass: krb5principal
objectClass: krb5kdcentry
cn: LDAP
sn: Service
uid: ldap
userPassword: randall
krb5PrincipalName: ldap/[email protected]
krb5KeyVersionNumber: 0

<?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.5"; 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>
      <jdbmPartition id="wso2" cacheSize="100" suffix="dc=wso2,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" >
    <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>
      <s:value>wso2.com</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>

Attachment: krb5.conf
Description: Binary data

Reply via email to