hex icon indicating copy to clipboard operation
hex copied to clipboard

Allow a custom CA file to be specified for retrieving dependencies

Open mkchandler opened this issue 11 years ago • 7 comments

I receive the following error when attempting to install dependencies:

[error] SSL: :certify: ssl_handshake.erl:1490:Fatal error: unknown ca

{:failed_connect, [{:to_address, {'s3.amazonaws.com', 443}}, {:inet, [:inet], {:tls_alert, 'unknown ca'}}]}
** (Mix) Failed to fetch registry

This is caused by the fact that we rewrite all the certs (a whole other issue that I unfortunately don't have any control over). This was also discussed briefly in #137.

Instead of ignoring SSL like discussed in #137, is there a way we could possibly specify a custom CA file? That is how we workaround the issue with Git and Node.

It ends up looking like this in a .gitconfig:

[http]
    sslCAInfo = C:/Users/[username]/ca-bundle.crt

Or this in a .npmrc file:

cafile = C:\Users\[username]\some_cert.cer

Just want to get your thoughts on this. Right now we are stuck as far as I can tell. I can specify a git repo as the dependency and that works fine (over https since we have the above setting in our .gitconfig), but that only works for the dependencies we specify in our mix.exs. I'm not sure how to override all of the defaults for a project.

mkchandler avatar Oct 20 '15 22:10 mkchandler

First off, I would be OK with this addition. But I also want to understand this issue and your proposed solution. Do you maintain a custom CA bundle that has a changed certificates for all major CAs? Why are you doing this?

Would you also need this changed in Mix? Mix uses https for fetching Hex for example.

ericmj avatar Oct 21 '15 01:10 ericmj

Would it be possible to have other certificates merged with the existing chain, rather than completely replacing the bundled chain?

--  James Spencer Sent with Airmail

On 21 October 2015 at 12:47:12 pm, Eric Meadows-Jönsson ([email protected]) wrote:

First off, I would be OK with this addition. But I also want to understand this issue and your proposed solution. Do you maintain a custom CA bundle that has a changed certificates for all major CAs? Why are you doing this?

Would you also need this changed in Mix? Mix uses https for fetching Hex for example.

— Reply to this email directly or view it on GitHub.

jcspencer avatar Oct 21 '15 01:10 jcspencer

Mix uses https for fetching Hex for example.

No longer in 1.1. :)

josevalim avatar Oct 21 '15 09:10 josevalim

I should clarify: in 1.1, Mix ships with public keys and we check hex/rebar checksum because getting SSL to work reliably with different CAs was notoriously hard.

josevalim avatar Oct 21 '15 09:10 josevalim

Do you maintain a custom CA bundle that has a changed certificates for all major CAs? Why are you doing this?

I'm not an expert in this area, but if I understand correctly they are essentially MITM-attacking our external traffic so that they can monitor it (this is all inside our corporate network). So in the instance of Git, we just append our cert to the end of their CA bundle that they check against.

Git ships with essentially the same bundle that hex uses (https://github.com/hexpm/hex/blob/master/lib/hex/api/ca-bundle.crt) and we just append ours to the end.

mkchandler avatar Oct 21 '15 14:10 mkchandler

Okay. This issue is up for grabs.

ericmj avatar Oct 21 '15 17:10 ericmj

If anyone needs this it is still up for grabs. I am closing because there hasn't been updates on this. In the future we will rely on server side signing and checksums to remove the https dependency.

ericmj avatar Feb 23 '16 01:02 ericmj