Last active
April 5, 2022 23:26
-
-
Save shollingsworth/76c177c420840af3c097a823280b9e25 to your computer and use it in GitHub Desktop.
LDAP search example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| set -euo pipefail | |
| IFS=$'\n\t' | |
| # Filter cheatsheet | |
| # https://gist.github.com/jonlabelle/0f8ec20c2474084325a89bc5362008a7 | |
| PASSWORD="password" | |
| BN="dc=acme,dc=com" | |
| DN="CN=Joe Smith,OU=Fabrication,OU=Los Angeles,OU=CA,OU=Users,${BN}" | |
| SERVER=ldaps://ldap.acme.com | |
| SEARCH="(&(objectClass=group)(cn=*AWS*))" | |
| ldapsearch -x \ | |
| -o ldif-wrap=no `# do not wrap long lines` \ | |
| -L `# ldif format` \ | |
| -H ${SERVER} \ | |
| -D "${DN}" `# user DN` \ | |
| -w "${PASSWORD}" \ | |
| -b "${BN}" `# CN Basename` \ | |
| ${SEARCH} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment