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

[fix] Automatically reconnect LDAP authenticator when slapd restarts #185

Merged
merged 2 commits into from Dec 13, 2018

Conversation

Projects
None yet
3 participants
@Josue-T
Copy link
Contributor

Josue-T commented Dec 11, 2018

Problem

When we restart slapd the authenticator object is broken. The result of that is that we need to make some hack like that.

            # Quickfix: the old app_ssowatconf(auth) instruction failed due to
            # ldap restore hooks
            os.system('sudo yunohost app ssowatconf')

This issue also impact all test which are made after the backup test.

Solution

Use an authenticator which are able to make a new connection if the connection is lost.

@Josue-T Josue-T requested review from Psycojoker , JimboJoe , zamentur and alexAubin Dec 11, 2018

@Josue-T Josue-T referenced this pull request Dec 11, 2018

Merged

[fix] Repair tests #595

0 of 4 tasks complete
@alexAubin
Copy link
Member

alexAubin left a comment

Tested and seems to be working 👍 That's a nice trick 👍

@@ -76,7 +76,7 @@ def is_authenticated(self):

def authenticate(self, password):
try:
con = ldap.initialize(self.uri)
con = ldap.ldapobject.ReconnectLDAPObject(self.uri, retry_max=5, retry_delay=0.1)

This comment has been minimized.

@alexAubin

alexAubin Dec 12, 2018

Member

0.1 sec for retry_delay sounds a bit short ? What about 0.5 ?

This comment has been minimized.

@Josue-T

Josue-T Dec 12, 2018

Author Contributor

Well, maybe Yes.

I need to do some more test. I firstly tried with 10 (which is clearly too long). And the test failed because the connection was not re-establish yet.

So this parameter might depends of the processor. If the CPU is really quick it might be not too short.

This comment has been minimized.

@Josue-T

Josue-T Dec 12, 2018

Author Contributor

Tested with 3 sec and it's also OK.

I purpose to put retry_max=10, retry_delay=0.5

@alexAubin alexAubin added this to the 3.4.x milestone Dec 12, 2018

@alexAubin alexAubin changed the title Fix LDAP authenticator when slapd was restarted [fix] Automatically reconnect LDAP authenticator when slapd restarts Dec 12, 2018

@alexAubin alexAubin merged commit a3436d1 into stretch-unstable Dec 13, 2018

@alexAubin alexAubin deleted the fix_ldap_authenticator branch Dec 13, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment