Giter Site home page Giter Site logo

ldap-server's Issues

Avoid initial error

[main] WARN org.apache.directory.server.core.DefaultDirectoryService - You didn't change the admin password of directory service instance 'ds'.  Please update the admin password as soon as possible to prevent a possible security breach.

Use a file:

dn: uid=admin,ou=system
changetype: modify
replace: userPassword
userPassword: new-password
ldapmodify -D "uid=admin,ou=system" -W -f password-modify 

current password is secret

Ldap server on Db

Sorry for writing this request as an issue but I don't know were to write it.

I would want to have the same ldap server but not an in memory one but with the default db (which I think is BerkleyDB)

Thank you
Arvit

Attribute types are in lowercase within searchResEntry

Attribute types in search response have all letters in lowercase. Expecting "memberOf" but got "memberof". Also expecting user defined type "userAthorizationScope" but got "userauthorizationscope". Attribute values have the expected letter cases.

Anonymous bind

Hi,

thanks for your work. I want to use the ldap-server for an integration test. In our scenario the real ldap server allows an anonymous bind. Any ideas how I can tweak the ApacheDS to also allow anonymous binds?

This is what currently happens:
$ ldapsearch -v -x -H ldap://localhost:10389 ldap_initialize( ldap://localhost:10389/??base ) ldap_bind: Invalid credentials (49) additional info: INVALID_CREDENTIALS: Bind failed: ERR_229 Cannot authenticate user

How to log LDAP request query details?

Hi, this project has been very handy in cases where I need a quick LDAP for testing, but I've been trying to enable request query details.

I tried doing it by messing around with the logging configuration without luck:

LOG_LEVEL=DEBUG
java -Dorg.slf4j.simpleLogger.log.org.apache.directory.server.ldap.handlers.SearchHandler=$LOG_LEVEL -Dorg.slf4j.simpleLogger.log.org.apache.directory.server.ldap.handlers.AddHandler=$LOG_LEVEL -Dorg.slf4j.simpleLogger.log.org.apache.directory.server.ldap.handlers.DeleteHandler=$LOG_LEVEL -Dorg.slf4j.simpleLogger.log.org.apache.directory.server.ldap.handlers.ModifyHandler=$LOG_LEVEL -Dorg.slf4j.simpleLogger.log.org.apache.directory.server.ldap.handlers.ModifyDnHandler=$LOG_LEVEL -jar ldap-server.jar users.ldif --port 386

I can make changes to the code, but if there's a way to use your great work as is via configuration, it would be much better. Thanks.

Adding examples

Anonymous access:

ldapsearch -x -b "dc=jboss,dc=org"

Admin access:

ldapsearch -x -b "dc=jboss,dc=org" -D "uid=jduke,ou=Users,dc=jboss,dc=org" -W

Interesting to expose that admin is jduke, and password is theduke

Adding more users to default will be interesting too.

TransportContext.java:352|Fatal (HANDSHAKE_FAILURE): no cipher suites in common ( "throwable"

Tried to run ldaps on Ubuntu but it does not work, ldap - ok.

Environment:
oc: Ubuntu 22.04.1
OS name: "linux", version: "6.5.0-28-generic", arch: "amd64", family: "unix"
ldap-server version: v.1.0.0
openjdk 11.0.22
Apache Maven 3.6.3

Steps:

  1. Create key store:
    keytool -validity 365 -genkey -alias lda-example -keyalg RSA -keystore ../ldap-ad-it/keystore/ldap.example.keystore -storepass 1Q2w3e4r -keypass 1Q2w3e4r -dname cn=ldap.example
  2. Run server:
    java -Djavax.net.debug=all -jar target/ldap-server.jar -sp 10636 -skf ../ldap-ad-it/keystore/ldap.example.keystore -skp 1Q2w3e4r
  3. Run client
    LDAPTLS_REQCERT=never ldapsearch -H ldaps://ldap.example:10636 -x -b "ou=users,dc=ldap,dc=example" -D "uid=admin,ou=system" -w secret

Expected result:
some data from ldap request

Actual Result:
ldap_sasl_bind(SIMPLE): Can't contact LDAP server (-1)

Attached you can find ldap server log:

HANDSHAKE_FAILURE.txt

Ldaps?

Is there a way to set this test server with ldaps (ssl) connection with some command line options?

How can I make the data persistent on the disk?

Hello,
Thanks for this ldap server,

I'm working on an ldap server than can be used as plugin based on your ldap server, I would like to know how can I store the data on disk permanently (not in-memory)?

groupOfUniqueMembers does not exist

Hi, first thanks for the util, it is very helpfull.

When I try to supply a ldif with groupOfUniqueMembers objetcClass it give me this exception:

dn: ou=System, ou=Groups, ou=cpt, dc=ccc, dc=net, dc=br
ou: System
objectclass: organizationalUnit
objectclass: top
objectclass: groupOfMembers

Exception in thread "main" org.apache.directory.api.ldap.model.exception.LdapException: ERR_04269 OBJECT_CLASS for OID g
roupofmembers does not exist!

Went to ApacheDS project page and it is supported, what am I missing?

Best regards.

Error E04269

Hi,
thanks for your work. I've installed this project as jar on Win7 and run (with JDK 1.7 64 bit) as
java -jar ldap-server.jar -b 0.0.0.0 -p 389 conf.ldif
and It works perfectly: the Ldap server start in a few second

I've installed same jar on Centos 6.5 64 bit and run it with JDK 1.7 using the same command, but Ldap Server not start and the output is:

[main] WARN org.apache.directory.api.ldap.model.entry.DefaultEntry - The attribute 'samaaccountname' cannot be stored
Exception in thread "main" org.apache.directory.api.ldap.model.exception.LdapNoSuchAttributeException: ERR_04269 ATTRIBUTE_TYPE for OID samaaccountname does not exist!
        at org.apache.directory.api.ldap.model.schema.registries.DefaultAttributeTypeRegistry.lookup(DefaultAttributeTypeRegistry.java:293)
        at org.apache.directory.api.ldap.model.schema.registries.DefaultAttributeTypeRegistry.lookup(DefaultAttributeTypeRegistry.java:47)
        at org.apache.directory.api.ldap.schema.manager.impl.DefaultSchemaManager.lookupAttributeTypeRegistry(DefaultSchemaManager.java:1604)
        at org.apache.directory.api.ldap.model.entry.DefaultEntry.<init>(DefaultEntry.java:311)
        at org.jboss.test.ldap.LdapServer.importLdif(LdapServer.java:142)
        at org.jboss.test.ldap.LdapServer.importLdif(LdapServer.java:132)
        at org.jboss.test.ldap.LdapServer.<init>(LdapServer.java:88)
        at org.jboss.test.ldap.LdapServer.main(LdapServer.java:69)
Caused by: org.apache.directory.api.ldap.model.exception.LdapException: ERR_04269 ATTRIBUTE_TYPE for OID samaaccountname does not exist!
        at org.apache.directory.api.ldap.model.schema.registries.DefaultSchemaObjectRegistry.lookup(DefaultSchemaObjectRegistry.java:176)
        at org.apache.directory.api.ldap.model.schema.registries.DefaultAttributeTypeRegistry.lookup(DefaultAttributeTypeRegistry.java:289)
        ... 7 more

The jar and conf.ldif are the same on Win7 and Centos 6.5, so I don't know why the jar do not work on Linux.
I don't know if I've forgotten some configuration/requirements needed for installation on Linux.

Thanks in advance for help.

Apache Directory Studio refuses connection Docker

Hi there,

first of all thanks for your work. I have a problem, when running the jar i can connect to localhost:10389 with Apache Directory Studio, but when running the docker container it says:

  • ERR_04110_CANNOT_CONNECT_TO_SERVER Cannot connect to the server: Connection refused: no further information
    org.apache.directory.ldap.client.api.exception.InvalidConnectionException: ERR_04110_CANNOT_CONNECT_TO_SERVER Cannot connect to the server: Connection refused: no further information
    at org.apache.directory.ldap.client.api.LdapNetworkConnection.close(LdapNetworkConnection.java:756)
    at org.apache.directory.ldap.client.api.LdapNetworkConnection.connect(LdapNetworkConnection.java:951)
    at org.apache.directory.studio.connection.core.io.api.DirectoryApiConnectionWrapper$1.run(DirectoryApiConnectionWrapper.java:234)
    at org.apache.directory.studio.connection.core.io.api.DirectoryApiConnectionWrapper.runAndMonitor(DirectoryApiConnectionWrapper.java:1277)
    at org.apache.directory.studio.connection.core.io.api.DirectoryApiConnectionWrapper.doConnect(DirectoryApiConnectionWrapper.java:268)
    at org.apache.directory.studio.connection.core.io.api.DirectoryApiConnectionWrapper.connect(DirectoryApiConnectionWrapper.java:159)
    at org.apache.directory.studio.connection.core.jobs.OpenConnectionsRunnable.run(OpenConnectionsRunnable.java:111)
    at org.apache.directory.studio.connection.core.jobs.StudioConnectionJob.run(StudioConnectionJob.java:109)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
    Caused by: java.net.ConnectException: Connection refused: no further information
    at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
    at sun.nio.ch.SocketChannelImpl.finishConnect(Unknown Source)
    at org.apache.mina.transport.socket.nio.NioSocketConnector.finishConnect(NioSocketConnector.java:223)
    at org.apache.mina.transport.socket.nio.NioSocketConnector.finishConnect(NioSocketConnector.java:47)
    at org.apache.mina.core.polling.AbstractPollingIoConnector$Connector.processConnections(AbstractPollingIoConnector.java:571)
    at org.apache.mina.core.polling.AbstractPollingIoConnector$Connector.run(AbstractPollingIoConnector.java:456)
    at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:64)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

ERR_04110_CANNOT_CONNECT_TO_SERVER Cannot connect to the server: Connection refused: no further information

Do you have suggestion how to fix it?

Docker README has inaccurate instructions for how to load a custom LDIF on startup

Hey there, thanks for making this available ๐Ÿ™ Very useful for unit testing ๐Ÿ‘

I wanted to load my custom LDIF, and followed the instructions from the Docker README:

docker run -it --rm \
    -p 10389:10389 \
    -v `pwd`:/mnt \
    kwart/ldap-server \
    java -jar ldap-server.jar /mnt/custom.ldif

However, this does seem to re-use the command when running it from source, but inside the container the java -jar ldap-server.jar is already happening, so to load a custom LDIF you do:

docker run -it --rm \
    -p 10389:10389 \
    -v `pwd`:/mnt \
    kwart/ldap-server \
    /mnt/custom.ldif

Not the end of the world obviously, but a small docs improvement, and perhaps this issue can help others who face a similar problem.

Thanks again.

Can SearchResultEntryHandler be used to intercept and change results?

Hi, congratulations for this project!

In the ServerLdap class I've added several handlers, after the .start(), line ~113:
-> ldapServer.start();
-> ldapServer.setAddHandlers(new UCAddRequestHandler(), new AddResponseHandler()); <- NEW
-> ldapServer.setSearchHandlers(new UCSearchRequestHandler(), new UCSearchResultEntryHandler(), new SearchResultReferenceHandler(), new SearchResultDoneHandler()); <- NEW

The add request work fine, I can change the request before adding to the "DB"! Same for the search request.
public class UCAddRequestHandler extends AddRequestHandler {
@OverRide
public void handle(LdapSession session, AddRequest req) {
Entry entry = req.getEntry();
entry.setDn(UCUtils.replaceDn(entry.getDn())); //some change in the Dn
super.handle(session, req);
}
}

But the I was no able to change the result from the search before sending it to the application:
public class UCSearchResultEntryHandler extends SearchResultEntryHandler {
@OverRide
public void handle(LdapSession session, SearchResultEntry result) throws Exception {
Entry entry = result.getEntry();
entry.setDn(UCUtils.revertDn(entry.getDn())); //for example, reverting the change made in the AddRequest.
super.handle(session, result);
}
}
The application receives allways the data that is stored in the DB, the "revert" is ignored.
Could you help?

Best Regards,
Nuno Ferreira.

Change LDAP Credential

Hello thank you for develop this app. It very useful to me. I have question, how to change security credential? As i read your code, the default SECURITY_CREDENTIALS is 'secret', how to change this ldap server security credential?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.