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

Initial support for Radicale 3 #13

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nebulade
Copy link

Fixes #11

@nebulade
Copy link
Author

This is still a bit of a work in progress and I would like to first receive some feedback.
For a start I am not sure how to run the tests from the repo. Any hint would be nice, I am not a python programmer....

@mario
Copy link

mario commented Jun 23, 2020

You should be able to do "python test/integration_tests.py" judging by the code.

@mario
Copy link

mario commented Jun 23, 2020

For the rest:

python -m unittest test/basic_tests.py

Copy link
Owner

@marcoh00 marcoh00 left a comment

Choose a reason for hiding this comment

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

Hi! Thanks a lot again! All in all I guess this looks fine, I only found some small things I don't understand. Especially the query string escaping should be addressed before merging though.

This is an authentication plugin for Radicale 2. It adds an LDAP authentication backend which can be used for authenticating users against an LDAP server.
This is an authentication plugin for Radicale 3. It adds an LDAP authentication backend which can be used for authenticating users against an LDAP server.

Use the `2-final` git tag for Radicale 2 support.
Copy link
Owner

Choose a reason for hiding this comment

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

Maybe we should reference the 2 branch as there has been an unexpected additional contribution to the Radicale 2 plugin since the creation of the 2-final tag :) Maybe there are more to come

conn = ldap3.Connection(server=server, user=self.ldap_binddn,
password=self.ldap_password, check_names=True,
lazy=False, raise_exceptions=False)
conn.open()
Copy link
Owner

Choose a reason for hiding this comment

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

Is this actually needed? The old code didn't open the connection and worked just fine. I just had a quick look at ldap3's connection.py and it seems like open is called automatically whenever the connection isn't open when it should be. I don't know a lot about ldap and ldap3 though, so I could be wrong! Could you check whether we need this?

conn = ldap3.Connection(server=server, user=final_user_dn,
password=password, check_names=True,
lazy=False, raise_exceptions=False)
conn.open()
Copy link
Owner

Choose a reason for hiding this comment

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

Same as above

logger.error(conn.result)
return ""

final_search_filter = self.ldap_filter.replace("%username", login)
Copy link
Owner

Choose a reason for hiding this comment

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

As I understand it, login is user-specified, right (I don't know a lot about radicale 3's plugin interface either 😆 )? In case my assumption is right, this looks very dangerous. I'm not so sure about escaping ldap-queries but I'm almost sure submitting user-controlled content directly inside the query string is a bad idea. Could you have a look at #4 ? According to ldap3's documentation it seems like escape_filter_chars() from ldap3.utils.conv would be the right tool for this.

version="0.1",
description="LDAP Authentication Plugin for Radicale 2",
version="0.2",
description="LDAP Authentication Plugin for Radicale 3",
author="Raoul Thill",
Copy link
Owner

Choose a reason for hiding this comment

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

In case you wrote this all by yourself feel free to take the credits ;-)

@marcoh00
Copy link
Owner

Regarding the tests, I'm afraid they were never really useful anyway. You would probably either have to rewrite them to support the new API (which shouldn't be a lot of work) or remove them altogether.

The only useful test is the integration test and this needs a running ldap server and valid credentials to work (see configuration.py). As I don't really use this plugin anymore, I'm not seeing myself setting up continuous integration and an automatic test environment for it to be honest... In case anyone else wants to try I would be happy to merge that of course.

@pvagner
Copy link

pvagner commented Jul 11, 2020

Ooops, anonymous bind is not supported when using this.

@nebulade
Copy link
Author

I will add that then. Sorry I had no time yet to further work on this. I hope this coming week works.

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.

Radicale 3 support
4 participants