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

bad_cert ssl error for google site #664

Closed
gregors opened this issue Nov 24, 2020 · 19 comments
Closed

bad_cert ssl error for google site #664

gregors opened this issue Nov 24, 2020 · 19 comments
Assignees
Labels

Comments

@gregors
Copy link

gregors commented Nov 24, 2020

This google seems to blow up consistently, works when I ignore ssl

https://www.googleapis.com/robot/v1/metadata/x509/[email protected]

OTP 23 hackney 1.16.0

@gregors
Copy link
Author

gregors commented Nov 24, 2020

More information. I have access to a second laptop, where everything works fine btw. So this seems to be specific.

The system that fails:
Brand New Big Sur OSX

Erlang/OTP 23 [erts-11.1.3] [source] [64-bit] [smp:16:16] [ds:16:16:10] [async-threads:1] [hipe] [dtrace]

Interactive Elixir (1.11.2) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> HTTPoison.get("https://www.googleapis.com/robot/v1/metadata/x509/[email protected]")

07:52:35.311 [info]  TLS :client: In state :wait_cert_cr at ssl_handshake.erl:1952 generated CLIENT ALERT: Fatal - Handshake Failure
 - {:bad_cert, :hostname_check_failed}
{:error,
 %HTTPoison.Error{
   id: nil,
   reason: {:tls_alert,
    {:handshake_failure,
     'TLS client: In state wait_cert_cr at ssl_handshake.erl:1952 generated CLIENT ALERT: Fatal - Handshake Failure\n {bad_cert,hostname_check_failed}'}}
 }}

The system that passes has the same Elixir/Erlang versions with OS Catalina. I have tried completely removing and reinstalling elixir, erlang (via brew btw). So this might be a OS or environment specific bug, but anything I can do to help report this better please let me know.

@tomwilsonmerkle
Copy link

I have the same issue

@benoitc benoitc added the ssl label Nov 25, 2020
@benoitc benoitc self-assigned this Nov 25, 2020
@connorjacobsen
Copy link

Are you running on Apple M1 or Intel? I am getting this error with M1 (Elixir 1.11, OTP 23, Hackney 1.16). Everything works fine on the Intel-based Mac on OSX 10. Wondering if is an M1 issue or an OSX 11 issue (or both). I'm hitting this through ueberauth_google.

@Fudoshiki
Copy link

Fudoshiki commented Nov 29, 2020

Same issue

iex(1)>
HTTPoison.get("https://www.googleapis.com/robot/v1/metadata/x509/40example%40example.iam.gserviceaccount.com")
[info] TLS :client: In state :wait_cert_cr at ssl_handshake.erl:1952 generated CLIENT ALERT: Fatal - Handshake Failure
 - {:bad_cert, :hostname_check_failed}
{:error,
 %HTTPoison.Error{
   id: nil,
   reason: {:tls_alert,
    {:handshake_failure,
     'TLS client: In state wait_cert_cr at ssl_handshake.erl:1952 generated CLIENT ALERT: Fatal - Handshake Failure\n {bad_cert,hostname_check_failed}'}}
 }}

With [ssl: [{:versions, [:'tlsv1.2']}]]working is fine

iex(2)>zsh
HTTPoison.get("https://www.googleapis.com/robot/v1/metadata/x509/40example%40example.iam.gserviceaccount.com", [], [ssl: [{:versions, [:'tlsv1.2']}]])
{:ok,
 %HTTPoison.Response{
   body: "{\n  \"937a5067379c98c07a7ca2d10609a7b28c28262d\": \"-----BEGIN CERTIFICATE----- ....

@drewrey
Copy link

drewrey commented Nov 29, 2020

@connorjacobsen: I'm reproducing this error on an Intel Mac running OSX 11, with Elixir 1.11, OTP 23, Hackney 1.16.

I'm encountering this issue when using auth0_jwks, which is using httpoison.

@connorjacobsen
Copy link

connorjacobsen commented Nov 29, 2020

@Fudoshiki I'm not able to get it working when passing in those ssl options. Though I do get exactly the error you list.

Edit: properly passing the options gets this working for me as well.

@chriserik
Copy link

chriserik commented Dec 1, 2020

I can confirm this issue with OSX 11, Elixir 1.11, OTP 23 and Hackney 1.16. Same issue also occurs within Alpine - based Docker images built via Github Actions, and I also tested on another Notebook running Catalina with the same Elixir / OTP versions as above. Other https calls work fine. Setting the ssl version to tlsv1.2 "solves" the issue.

@benoitc
Copy link
Owner

benoitc commented Dec 7, 2020

It may be relevant to erlang/otp@addc42d. Did anyone tested with an older version of Erlang ?

@connorjacobsen
Copy link

I have not, but I can later today. OSX 10.X, Elixir 1.11, OTP 23, and Hackney 1.16 had previously worked just fine so I hadn't tried downgrading OTP.

@supercodepoet
Copy link

I have run into this issue as well trying to call the Stripe API. I am running:

macOS 11.0.1
Erlang 23.1.5
Elixir 1.11.2
hackney 1.16.0

I tried Erlang 23.0.4 and it still failed. I tried Erlang 22.3.4.13 and it succeeded. We use Docker to build our production images and it uses Ubuntu. Using Erlang 23.1.5 works correctly. Seems it might be an issue with OTP 23 and Big Sur.

@evancloutier
Copy link

+1 on running into this!

MacOS 11.0.1
Elixir 1.11.2 (OTP 23)
Hackney 1.16.0

I wasn't able to trial and error with different versions of Elixir/Erlang to see what succeeded – this is only happening to me locally, but I'll be docker-composing to avoid this for the time being.

@keithpitty
Copy link

I would appear to be encountering the same issue. In my case the error occurs via OAuth2.Client. I originally encountered it on Elixir 1.11.2 (OTP 23) but then also 1.10.4 (OTP 23). Only then did I realise that the common denominator was that I had recently upgraded to MacOS 11.0.1. Uninstalling and reinstalling Erlang and Elixir has had no effect.

@benoitc
Copy link
Owner

benoitc commented Dec 8, 2020

should be fixed in latest master via 1c4afad . This change is similar to g-andrade/tls_certificate_check@bae3696

Please test and let me know.

@supercodepoet
Copy link

Pulled the latest from GitHub and ran our entire test suite and our dev environment on:

macOS 11.0.1
Elixir 1.11.2
Erlang 23.1.5

I did not get any errors and everything behaved normally. Thanks!

@moomerman
Copy link

moomerman commented Dec 8, 2020

Can confirm the same:

Static:

  • macOS 11.0.1
  • elixir 1.11.2

Variable (with hackney 1.16.0)

  • erlang 23.1.5 (via homebrew) ❌
  • erlang 23.0.4 (via kerl) ❌
  • erlang 22.3.4.13 (via kerl) ✅

Using erlang 23.1.5 (via homebrew) with hackney 1c4afad works fine 🥳

@connorjacobsen
Copy link

@benoitc Fixes for me. Thank you!

@benoitc
Copy link
Owner

benoitc commented Dec 9, 2020

ok i will make a release it asap today. Thanks all for the feedback!

@benoitc benoitc closed this as completed Dec 9, 2020
@supercodepoet
Copy link

I was wondering if we would be getting a release soon? Thanks.

@benoitc
Copy link
Owner

benoitc commented Dec 12, 2020 via email

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

No branches or pull requests