0

I have this working ldapsearch command for connecting anonymously to an internal ldap server:

$ ldapsearch -h my.host -p 389 -x -LLL -s base -b "" namingContexts
dn:
namingContexts: DC=org,DC=sample

Now I would like to list the same using curl:

$ curl -v "ldap://my.host:389/dc=org,dc=sample namingContexts"
*   Trying ...
* Connected to my.host (....) port 389 (#0)
* LDAP remote: search failed Success 000004DC: LdapErr: DSID-0C090A5C, comment: In order to perform this operation a successful bind must be completed on the connection., data 0, v4563
* Closing connection 0
curl: (39) LDAP remote: search failed Success 000004DC: LdapErr: DSID-0C090A5C, comment: In order to perform this operation a successful bind must be completed on the connection., data 0, v4563

So I get a connection to the server but how do I list the namingContext without providing credentials/anonymously with curl.

u123
  • 247
  • 7
  • 21
  • For starters is your LDAP URI correct? IIRC the attribute must be separated by a question mark `?` rather than a space. If that is not the issue: IIRC an anonymous bind is sometimes described as authentication with an empty username and empty password. Maybe try an empty user string `curl -v -u "" "ldap://host:port/base_dn?attributes?scope?filter"` – Bob Nov 18 '21 at 13:22
  • Yes LDAP URI works fine. If I do -u "" it prompts for password so thats not working – u123 Nov 18 '21 at 14:39

0 Answers0