Load more than one ca_cert
ca_certs is plural, but currently does not accept a list of CA certificate paths.
I'm dubious about this PR, I'm no SSL expert though but this seems like this link explains it quite well : pass a directory containing your CAs : https://docs.python.org/3/library/ssl.html#ssl.SSLContext.load_verify_locations Feel free to reopen if that's not the case
You are referring to the 2nd argument of load_verify_locations but the current implementation gives only the 1st positional argument:
The cafile string, if present, is the path to a file of concatenated CA certificates in PEM format.
My PR proposes to allow a list, such that instead of concatenating all CA certs beforehand, you can provide a list of certificate files in different locations. This is arguably more flexible than requiring all of the files to be in a single directory.
@euri10 please re-open if you agree/want to re-consider
Happy to reconsider then effectively, but:
- add tests
- change the positional only arg we currently have to kwargs so that we're clear on what location we use
@euri10 done
@euri10 updated formatting to make the linter happy
@euri10 Would you like me to squash before merging?
No need it's automatic on the repo iirc
@brussee Are you still interested on this PR? If so, would you mind checking @euri10 's comments? 🙏
I switched from the approach in this PR to creating and injecting a fully configured SSLContext directly. Instead of maintaining code that wraps the SSLContext class like now, the alternative seems like a more maintainable approach.