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

Added tls certs and keys settings #87

Closed
wants to merge 2 commits into from

Conversation

capgadsx
Copy link

@capgadsx capgadsx commented Jun 19, 2018

This changes will allow us to use ldaps:// endpoints.

Closes #49

@capgadsx capgadsx closed this Jun 19, 2018
@capgadsx capgadsx deleted the ssl branch June 19, 2018 21:58
@capgadsx capgadsx restored the ssl branch June 19, 2018 21:58
@capgadsx
Copy link
Author

capgadsx commented Jun 19, 2018

Wrong repo! 🙃, feel free to delete.

@dhirschfeld
Copy link
Collaborator

Where did you mean to open this PR??

It seems this might solve #49?

@capgadsx capgadsx reopened this Jun 20, 2018
@capgadsx
Copy link
Author

Yes, it should, i was in a similar situation that OP of #49 is (our LDAP server uses self signed certificates and client keys/certs). However i should add some validation to the inputs before this is merged.

PS: Initially i was trying to merge this in the master branch of my fork but i pressed the wrong button (lol).

ca_certs_file=ca_cert, validate=ssl.CERT_REQUIRED)
server = ldap3.Server(self.server_address, port=self.server_port, use_ssl=True, tls=tlsSettings)
else:
server = ldap3.Server(self.server_address, port=self.server_port, use_ssl=False)
Copy link
Author

Choose a reason for hiding this comment

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

With the last changes it should be now possible to only supply certain options, before that, it was needed to use all the three new settings to work with tls endpoints.

If you're receiving `SSLV3_ALERT_HANDSHAKE_FAILURE` errors, you have to use this setting.
"""
)

Copy link
Author

Choose a reason for hiding this comment

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

I'm still not satisfied with the documentation that i wrote, but i think this could be left for another moment.

@dhirschfeld
Copy link
Collaborator

Thanks for posting @capgadsx! I'm currently slammed at work so it'll likely be a week or so before I get around to properly reviewing. I am keen to get it in though if it resolves #49.

@rayburgemeestre
Copy link

Hey it would have been really nice if you guys merged this back in 2018 :)
I just patched this file in a similar way for our ldaps.

Any chance this PR might be reconsidered/updated for merge?

@consideRatio
Copy link
Member

This PR seem to solve a relevant issue for users! Thanks for your work on this @capgadsx and others commenting in to verify the case!

I'm not knowledgeable enough to review this =/

@dmpe
Copy link

dmpe commented Jun 1, 2020

My company is going to force LDAPs as well and this would be great to have in master ;). I vouch to help if necessary

@manics manics closed this Jul 21, 2020
@manics manics reopened this Jul 21, 2020
Copy link
Member

@manics manics left a comment

Choose a reason for hiding this comment

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

If anyone would like to take this on its probably best to open a new PR with these changes and any other fixes. In addition tests would be good, ldaps is supported in the LDAP Docker image used for testing https://github.com/rroemhild/docker-test-openldap

@capgadsx
Copy link
Author

Hi, I see that the PR has attracted more interest, so I want to make some changes and write the integration tests that @manics mentions. I'll pick this up when I have some free time.

@capgadsx capgadsx marked this pull request as draft July 27, 2020 18:42
Copy link

@serverwentdown serverwentdown left a comment

Choose a reason for hiding this comment

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

I have not tested it personally, but I do not see anything wrong in this PR

@serverwentdown
Copy link

@capgadsx I might take a look at writing integration tests.

Copy link

@Enrice Enrice left a comment

Choose a reason for hiding this comment

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

desperately needed...

@Enrice Enrice mentioned this pull request Jan 18, 2022
@meeseeksmachine
Copy link

This pull request has been mentioned on Jupyter Community Forum. There might be relevant details there:

https://discourse.jupyter.org/t/jupyterhub-ldap-auth-using-certificate-how-to/13604/4

@consideRatio consideRatio mentioned this pull request Jun 4, 2023
12 tasks
Comment on lines +298 to +307
if self.use_ssl:
ca_cert = None
client_cert = None
client_key = None
if self.server_ca_file != '':
ca_cert = self.server_ca_file
if self.client_certificate_file != '':
client_cert = self.client_certificate_file
if self.client_key_file != '':
client_key = self.client_key_file
Copy link
Member

Choose a reason for hiding this comment

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

Assuming we go for a merge of this PR, we should also simplify this logic to by letting the new traitlets based config have allow_none=True and letting the default value be None.

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

Successfully merging this pull request may close these issues.

Allow configuring ldap3's TLSObject/SSLContext
9 participants