Reputation: 63
I am using ldapsearch
for getting radius secret, but it is giving truncated result
Command I am using is :
./ldapsearch -p 1545 -Z -X -D "cn=Directory Manager" -w passwd -b "o=platform" "(objectClass=*)" | grep -i secret
result produced is :
ss-secret=ahksdf6fakh7fajkfhaffjkfjfhafajkfh234578fajf171jkh25/525jhsfasjh8jjk7
where as actual value in LDAP is
ss-secret=ahksdf6fakh7fajkfhaffjkfjfhafajkfh234578fajf171jkh25/525jhsfasjh8jjk7afjfh8/gSqtulkjfa8lfjakl3
I am using OpenDJ LDAP.
Upvotes: 6
Views: 7812
Reputation: 3102
I've been using this Perl alias for a while:
$ cat wrap-example.ldif
MyLineA: 123456789,123456789,123456789,123456789,123456789,123456789,12345678
MyLineB: 123456789,123456789,123456789,123456789,123456789,123456789,12345678
9,123456789,123456789
MyLineC: 123456789,123456789,123456789,123456789,123456789,123456789,12345678
✓
$ alias remove-ldif-linebreaks="dos2unix | perl -p0e 's/\n //g'"
✓
$ cat wrap-example.ldif | remove-ldif-linebreaks
MyLineA: 123456789,123456789,123456789,123456789,123456789,123456789,12345678
MyLineB: 123456789,123456789,123456789,123456789,123456789,123456789,123456789,123456789,123456789
MyLineC: 123456789,123456789,123456789,123456789,123456789,123456789,12345678
✓
As you can see: MyLineB has been un-wrapped
Upvotes: 0
Reputation: 11
Unfortunately, none of those options worked for me. I went to trusty sed and awk and solved the problem.
ldapsearch options > outfile
## sed to remove the space at the beginning of wrapped lines.
sed -i 's/^ //g' outfile
## Awk to join the lines if 78
awk '{if(length($0) == 78) {printf $0} else {print $0} }' outfile > outfile.nowrap
Upvotes: 1
Reputation: 3
Going to try the wrap thing but this has been my go-to for years:
ldapsearch -xLLL cn=WHATEVER | perl -p00e 's/\n /g'
It’s ugly, which is why I landed here looking for a better way, but it works without fail.
Upvotes: -1
Reputation: 21
for Debian based system you have to add "-o ldif-wrap=no "
example: ldapsearch -xLLL -o ldif-wrap=no -H ldap://hostname:port/
from the man page of ldapsearch ubuntu 16.04:
-T path
Write temporary files to directory specified by path (default: /var/tmp/)
so it has no relation with formatting the output
Upvotes: 2
Reputation: 7319
Try "ldapsearch -o ldif-wrap=no ...".
Search the man page for "wrap".
I am using OpenLDAP in the ldap-utils package on debian.
Upvotes: 19
Reputation: 8653
Use -T argument like
./ldapsearch -p 1545 -T -Z -X -D "cn=Directory Manager" -w passwd -b "o=platform" "(objectClass=*)" | grep -i secret
This will give you complete output.
Upvotes: 0