Skip to content
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

Minor changes/fixes #6

Merged
merged 4 commits into from Jul 21, 2017
Merged

Minor changes/fixes #6

merged 4 commits into from Jul 21, 2017

Conversation

tdb
Copy link
Contributor

@tdb tdb commented Jul 18, 2017

Here are a number of changes/fixes that I needed to get ppm working on Ubuntu with the OS slapd. If there's anything useful here please feel free to cherry pick the bits you want, or let me know and I can reshape the pull request.

@davidcoutadeur
Copy link
Collaborator

Thank you for your interest and your work. I'll check it later with consideration.

@davidcoutadeur
Copy link
Collaborator

davidcoutadeur commented Jul 20, 2017

Hi,

Here is my analysis about this pull request.

b52db61

The message was vague on purpose, for security reasons. The aim is to avoid an attacker from understanding all the mechanisms behind the frontend. (the fact that it is an underlying cracklib library for example)

feac7b9

agreed

b6ee9f1

agreed

88c7b78

agreed

318255f

ppm is now compiled by default with cracklib in LTB packages. As it is a new feature, I don't think it is a good idea to activate it by default in the configuration file.

5014f76

Normal users shouldn't see OpenLDAP logs anyway, should they?
As the verbose output is only displayed in case of password change, I suppose it is not a bad idea to activate debug by default.

08646ea

Thank you for reporting this, as it is a bug in the module!
Though, I have different opinions on parts of the patch:

-Wl,-rpath=.

Brilliant

$(CC) $(LDAP_INC) $(LDAP_LIBS) -shared -o ppm.so ppm.o $(LIBS)

The cracklib library is not linked, which indeed results in a bug. However, why also link to libber and libldap? Have you tried without it? For example, with the following:
$(CC) $(LDAP_INC) -shared -o ppm.so ppm.o $(CRACK_LIB)

$(CC) $(LDAP_INC) $(LDAP_LIBS) -Wl,-rpath=. -o ppm_test ppm_test.c ppm.so $(LIBS)

Interesting... Do you have an explanation on why ppm.so and LIBS need to be rejected to the end of the line?

1468620

ppm should stay generic. (as you may have seen, LTB community provides packages both for Debian and Red-Hat)
The default CONFIG and LIBDIR would only be useful on Ubuntu...
Idem for LDAP_LIB / LDAP_INC: the Makefile is supposed to be adapted for the appropriate environment. LTB is packaging passing the correct variables, for example:
make "CONFIG=/usr/local/openldap/etc/openldap/ppm.conf" "LDAP_INC=-I../include -I../servers/slapd"

@tdb would you mind being mentionned in the README as:
2017 - tdb - Tim Bishop - contribution on some compilation improvements

@tdb
Copy link
Contributor Author

tdb commented Jul 20, 2017 via email

@davidcoutadeur
Copy link
Collaborator

ppm_test uses ber_memfree. It could probably just use free instead?

ppm_test has always been using libber. That's why I have linked it in the Makefile.
However, I wanted - and still want - the main program to be as short and efficient as possible.
My point is that I don't think ppm.so needs to be linked to libldap and libber because slapd is in a way already linked to them. Can you confirm it is also working with you without this linking?

I'm not sure what you mean by "rejected to the end of the line", probably just the wrong words? If you mean why did I move them to the end of the line, then it was because the linker requires dependencies to come after the source file.

Yes: why move them to the end of the line.
So you suspect the way I did it was a tolerance in my build environment (especialy gcc actually)?

Noted for 2017 :)

@tdb
Copy link
Contributor Author

tdb commented Jul 20, 2017 via email

tdb added 3 commits July 20, 2017 23:44
This way it can be run outside of the test rig and report whether the
password is good, and include the error if not.
On Ubuntu 16.04 I had trouble making this compile. There was one notable
change required - the libraries to link (ppm.so and LIBS) need to be
given after the file being compiled. It also seems helpful to link
ppm.so against the required libraries, otherwise how will slapd know to
find libcrack?

Finally, I added -Wl,-rpath=. to ppm_test meaning it can be run directly
without needing to set the library path.
@@ -40,13 +40,13 @@ TESTS=./unit_tests.sh
all: ppm ppm_test

ppm_test:
$(CC) $(LDAP_INC) $(LDAP_LIBS) $(LIBS) ppm.so -o ppm_test ppm_test.c
$(CC) $(LDAP_INC) $(LDAP_LIBS) -Wl,-rpath=. -o ppm_test ppm_test.c ppm.so $(LIBS)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wondering if -Wl,rpath=. might be better as -Wl,rpath=.:$(LIBDIR)?

@davidcoutadeur
Copy link
Collaborator

I am not a big fan of having both relative and absolute path, as it could bring confusion between the really loaded libraries.
Anyway, the syntax -Wl,rpath=.:$(LIBDIR) does not seem to be recognized. Maybe we can't set more than one rpath.
I would prefer the static rpath ($(LIBDIR)) but ppm_test should be used both after the compilation and while installed, so relative path will do the job.

@davidcoutadeur davidcoutadeur merged commit 0b46c24 into ltb-project:master Jul 21, 2017
@tdb tdb deleted the minor-fixes branch July 21, 2017 09:11
@tdb
Copy link
Contributor Author

tdb commented Jul 21, 2017

Thanks for the final feedback and the merge!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants