-
Notifications
You must be signed in to change notification settings - Fork 0
feat(contrib): Add a helper script for ldapsearch debugging #139
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| #!/bin/sh | ||
| # | ||
| # A small script to convert famedly-sync configuration into its | ||
| # equivalent `ldapsearch` command; this can help find out what | ||
| # `famedly-sync` sees in practice when performing a sync. | ||
| # | ||
| # Usage: | ||
| # | ||
| # ./extract-ldapsearch-command.sh CONFIG | ||
|
|
||
tlater-famedly marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| config="$1" | ||
|
|
||
| if ! [ -e "$config" ]; then | ||
| echo "Please give the famedly-sync configuration file as the first argument" | ||
| exit 1 | ||
| fi | ||
|
|
||
| grep_from_yaml() { | ||
| grep "$1" "$config" | cut -f 2 -d ':' | tr -d '" ' | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sadly the simple approach doesn't work very well in practice; various attributes used in DNs and filters often contain spaces and We'd need to do a more thorough yaml parse to not run into this, sadly non-greedy matches are hard to do with just POSIX utilities. |
||
| } | ||
|
|
||
| base_dn="$(grep_from_yaml base_dn)" | ||
| bind_dn="$(grep_from_yaml bind_dn)" | ||
| user_filter="$(grep_from_yaml user_filter)" | ||
| start_tls="" | ||
| if [ "$(grep_from_yaml danger_use_start_tls)" = "true" ]; then | ||
| start_tls="-Z " | ||
| fi | ||
| if [ "$(grep_from_yaml use_attribute_filter)" = "true" ]; then | ||
| echo "This command will not include the attribute filter" | ||
| echo "To reproduce the search exactly, add every attribute name space-separated to the end of the command" | ||
| echo | ||
| fi | ||
|
|
||
| echo "Please read the password from the config file yourself :)" | ||
| echo "ldapsearch $start_tls-W -b '$base_dn' -D '$bind_dn' '$user_filter'" | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is
./contrib/?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a directory with some random bonus scripts that are useful. It's pretty common in FOSS projects; often plugins and other related things not part of the main codebase make it in there, too.