-
Notifications
You must be signed in to change notification settings - Fork 161
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
vdirsyncer 0.19: auth_cert broken #1033
Comments
|
Looks like something like this works fine. diff --git i/vdirsyncer/http.py w/vdirsyncer/http.py
index b35035b..2791433 100644
--- i/vdirsyncer/http.py
+++ w/vdirsyncer/http.py
@@ -127,7 +127,11 @@ async def request(
assert isinstance(kwargs.get("data", b""), bytes)
- kwargs.pop("cert", None) # TODO XXX FIXME!
+ cert = kwargs.pop("cert", None)
+ if cert is not None:
+ ssl_context = create_default_context()
+ ssl_context.load_cert_chain(cert)
+ kwargs['ssl'] = ssl_context
response = await session.request(method, url, **kwargs)
Needs a bit more work obviously (supporting list arg for auth_cert, tests), but it's late where I am. |
|
Whoops, sorry, that |
|
I don't have a server set up with client certificates. Do you have your own server? Is setting up a test user feasible? |
|
Can you confirm if #1037 is sufficient to address this? I believe the previous call to Right now I don't have a test setup where I can log in with client certificates. If you have a public server where you can provide a test account, that would be super useful. I'm currently looking for hosted Dav servers to improve testing. |
|
I found two errors in the patch: It breaks server certificate verificationA new blank SSL context is created. There might already be one with CA certifificate setup. -ssl_context = create_default_context()
+ssl_context = kwargs.pop("ssl", create_default_context())It doesn't support private key in a separate file.From the documentation
The list is converted to a tuple, -ssl_context.load_cert_chain(cert)
+ssl_context.load_cert_chain(*cert) It works for both cases. The complete snippet that works for me: cert = kwargs.pop("cert", None)
if cert is not None:
ssl_context = kwargs.pop("ssl", create_default_context())
ssl_context.load_cert_chain(*cert)
kwargs['ssl'] = ssl_contextTested on version 0.19.1.dev28+gdf14865 |
|
Thanks for digging into this and sharing all the details! |
So I was investigating why my calendar wasn't syncing anymore, with 401 responses. After seeing my client certificate wasn't being received on the server, I realized this was coming from vdirsyncer. A bit of digging and I found these lines in http.py:
So, yeah. A line in the changelog would have saved me a bit of time. 🥲
Since I need this I'll see what I can do.
The text was updated successfully, but these errors were encountered: