Facilitate the use of extra CA certificates#30
Conversation
|
thanka for your pr. would you mind to move the decode_pem_multiple_log_error (or similar) to x509 (best on top of the string pr) -- then we can have that included in the upcoming x509 release. OCAML_EXTRA_CA_CERTS - I'm pretty unsure about that, esp. since SSL_CERT_FILE / NIX_SSL_CERT_FILE is already supported - and I find these environment variable escape hatches very ugly. Would/should the SSL_CERT_FILE take a list of files, and/or have a way to specify "also add the system certs" (using sth like the path "+system") be sufficient for your use case? |
|
maybe @dinosaure or @reynir, would you mind to open a PR for x509 which has an improved version of decode_pem_multiple (more like a fold, the signature I have in mind: what do you think? (of course @art-w , feel free to jump in and open a pr to x509) |
|
maybe a new function |
|
Yes a fold makes sense in x509, I'll get at it right away! Changing the behavior of |
|
I added two commits, one for compatibility with the latest X509 library and one to use its |
|
there's #29 already which removes cstruct. |
|
I'm still puzzled about this PR. So, what is the interoperability story, in terms of macOS/windows/Unix? Also, in the documentation you write "Additional CAs can be enabled by setting the environment variable [OCAML_EXTRA_CA_CERTS] to a file path containing more trust anchors" - so that file is supposed to contain a list of certificates? PEM encoded? Maybe worth specifying? Why is What is the information and error paths? Shouldn't there be specific messages about "using OCAML_EXTRA_CA_CERTS from %s" (path) [to inform the user] and as questioned, what should the failure behaviour be (if the file does not exist or has invalid data)? |
|
the second commit slurps the previous log messages - I don't understand why (but please don't bother, I'll have that as a separate PR anyways). |
|
in case you like to have this merged (also addressing #25 (comment)), it would be great if you could:
|
|
I'll cut a release without the OCAML_EXTRA_CA_CERTS, but I'm happy to merge and release it once the semantics is more clear. |
|
The PR was rebased 👍. |
53fac6c to
82c1fae
Compare
|
Thanks! (sorry for the late reply, I was on holidays without internet for a long time) I still think this is useful, and tried to address your feedback (log reports, PS: May I suggest a patch for |
|
thanks |
CHANGES: * Add OCAML_EXTRA_CA_CERTS env variable (mirage/ca-certs#30 @art-w) * macOS: add additional keychain path `/Library/Keychains/System.keychain` (mirage/ca-certs#28 @ajbt200128) * Demote log levels of trust anchor parsing failures (now on the debug level), log a single warning message how many failures occured (mirage/ca-certs#36 @Julow)
I found the following changes useful to quickly enable exceptional CA certificates when experimenting with Cohttp HTTPS requests to the (untrustworthy)
mitmproxyfor debugging, and to various localhost test servers (with locally generated CA certificates). I'm not entirely sure that this PR behavior is desirable, so I've broken it in two commits:ctx=> This could also be done through the existingX509.Certificate.decode_pem_multiple, with some caveats (perhaps I should propose a fix to x509 instead, to handle failures more gracefully?)OCAML_EXTRA_CA_CERTSfile. This has some precedent on other platform, egNODE_EXTRA_CA_CERTSin nodejs, because users can't always install certificates... but it could also be argued that it's a security risk to provide an escape hatch! (but installing amitmproxyCA isn't great either ^^')I can always configure Cohttp authenticator manually with extra CAs, so feel free to reject this PR!