Configuring Erlang to work with SSL

2019-03-25 23:36发布

Erlang version: R13B01

Currently I'm struggling trying to make Erlang work with SSL. The programming part was easy, but now starting the system SSL-enabled is not.

Following the Erlang SSL documentation:

1 - Made the start_ssl.rel file

{release, {"OTP  APN 181 01","R13B01"}, {erts, "5.7.2"},
 [{kernel,"2.13.2"},
  {stdlib,"1.16.2"},
  {sasl,"2.1.6"},
  {os_mon,"2.2.2"},
  {ssl,"3.10.3"}]}.

2 - Executed the following command

1> systools:make_script("start_ssl",[]).

According to the documentation, running the shell would output this (this output is from docs, not mine):

$ erl -boot /home/me/ssl/start_ssl
Erlang (BEAM) emulator version 5.0

Eshell V5.0  (abort with ^G)
1> whereis(ssl_server).
<0.32.0>

But, I'm receiving this instead:

erl -boot start_ssl
Erlang R13B01 (erts-5.7.2) [source] [smp:2:2] [rq:2] [async-threads:0] [kernel-poll:false]
1> whereis(ssl_server).
undefined
2> 

So, for now, the remaining steps are failing too. Sadly, there is no documentation nor forum threads around the web with the same issue.

Any tips?

标签: ssl erlang
1条回答
\"骚年 ilove
2楼-- · 2019-03-26 00:29

Well, after some try and error, I've managed to start the system:

application:start(ssl)

and passing all certificates when creating the listening socket

ssl:listen(Port, ?TCP_OPTIONS ++ [{ip, Host},{verify, 0},
                                       {depth,  0}, 
                                       {cacertfile, Cacertfile}, 
                                       {certfile,   Certfile},
                                       {keyfile,    Keyfile}]) 

It worked :)

查看更多
登录 后发表回答