intoolswetrust / ldap-server Goto Github PK
View Code? Open in Web Editor NEWSimple in-memory LDAP server for testing purposes - single JAR based on ApacheDS
License: Apache License 2.0
Simple in-memory LDAP server for testing purposes - single JAR based on ApacheDS
License: Apache License 2.0
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.
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.
The project cannot support the test of LDAP injection.
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.
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.
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?
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
Is there a way to set this test server with ldaps (ssl) connection with some command line options?
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
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:
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:
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)?
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.
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
Do you have suggestion how to fix it?
[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
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.
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.