ssl - 如何让 TLS 与 Erlang 21 一起使用?
问题描述
我有以下问题:
灵药
[centos@ip-172-172-3-49 helix]$ env MIX_ENV=prod mix release
Could not find Hex, which is needed to build dependency :plug_cowboy
Shall I install Hex? (if running non-interactively, use "mix local.hex --force") [Yn] Y
18:12:32.462 [info] ['TLS', 32, 'client', 58, 32, 73, 110, 32, 115, 116, 97, 116, 101, 32, 'hello', 32, 'received SERVER ALERT: Fatal - Handshake Failure', 10]
** (Mix) httpc request failed with: {:failed_connect, [{:to_address, {'repo.hex.pm', 443}}, {:inet6, [:inet6], :enetunreach}, {:inet, [:inet], {:tls_alert, 'handshake failure'}}]}
Could not install Hex because Mix could not download metadata at https://repo.hex.pm/installs/hex-1.x.csv.
我想根本原因是 Erlang
Erlang/OTP 21 [erts-10.2.1] [source] [64-bit] [smp:36:36] [ds:36:36:10] [async-threads:1] [hipe]
1> ssl:start().
ok
2> Sock = fun() -> {ok, S} = gen_tcp:connect("google.com", 443, []), S end.
#Fun<erl_eval.20.128620087>
3> ssl:connect(Sock(), []).
=INFO REPORT==== 28-Dec-2018::18:10:30.019612 ===
TLS client: In state hello received SERVER ALERT: Fatal - Handshake Failure
{error,{tls_alert,"handshake failure"}}
有解决方法吗?Os是Centos 7。
更新1
在 MacOS 上它可以工作:
Erlang/OTP 21 [erts-10.2] [source] [64-bit] [smp:6:6] [ds:6:6:10] [async-threads:1] [hipe] [dtrace]
Eshell V10.2 (abort with ^G)
1> ssl:start().
ok
2> Sock = fun() -> {ok, S} = gen_tcp:connect("google.com", 443, []), S end.
#Fun<erl_eval.20.128620087>
3> ssl:connect(Sock(), []).
{ok,{sslsocket,{gen_tcp,#Port<0.6>,tls_connection,undefined},
[<0.100.0>,<0.99.0>]}}
4>
解决方案
事实证明,我使用的 Erlang RPM 不能正确支持 Erlang 中的新 SSL。
使用来自 Erlang Solutions 的不同版本可以正常工作:
推荐阅读
- python - 带有可选条件的 Pandas 数据框过滤
- python - ?: (admin.E403) 必须在 TEMPLATES 中配置“django.template.backends.django.DjangoTemplates”实例才能使用管理应用程序
- c++ - boost::archive::binary_iarchive 构造函数直接崩溃而不会仅在 linux 中引发异常
- html - 从大屏幕隐藏图标
- r - 如何在不泄露原始数据的情况下共享 GAMLSS 模型?
- php - 不推荐使用常量 FILTER_SANITIZE_STRING
- c# - 使用 IComparer 将 2 个 IEnumerables 与 1 个 comp obj 进行比较
- python - Python DataFrame块提取问题
- azure-cosmosdb - CosmosDB - MongoDB API - 20 个并行事务使用 Java Spring @Transactional(readOnly=true) 导致错误(提交失败,事务不活动)
- react-native - 如何在博览会性能屏幕中知道应用程序性能是否良好?