Score:0

Replace anonymous ldapsearch command with curl command?

cl flag

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.

cn flag
Bob
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"`
cl flag
Yes LDAP URI works fine. If I do -u "" it prompts for password so thats not working
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.