Просмотр исходного кода

Merge pull request #1504 from emqtt/develop

Feature - Using SSL for Erlang Distribution
Feng Lee 8 лет назад
Родитель
Сommit
37bc6f54ea
4 измененных файлов с 29 добавлено и 2 удалено
  1. 8 0
      etc/emq.conf
  2. 11 0
      etc/ssl_dist.conf
  3. 9 1
      priv/emq.schema
  4. 1 1
      src/emqttd.app.src

+ 8 - 0
etc/emq.conf

@@ -236,10 +236,18 @@ node.crash_dump = {{ platform_log_dir }}/crash.dump
 ## Value: Enum
 ## Value: Enum
 ##  - inet_tcp: the default; handles TCP streams with IPv4 addressing.
 ##  - inet_tcp: the default; handles TCP streams with IPv4 addressing.
 ##  - inet6_tcp: handles TCP with IPv6 addressing.
 ##  - inet6_tcp: handles TCP with IPv6 addressing.
+##  - inet_tls: using TLS for Erlang Distribution.
 ##
 ##
 ## vm.args: -proto_dist inet_tcp
 ## vm.args: -proto_dist inet_tcp
 node.proto_dist = inet_tcp
 node.proto_dist = inet_tcp
 
 
+## Specify SSL Options in the file if using SSL for Erlang Distribution.
+##
+## Value: File
+##
+## vm.args: -ssl_dist_optfile <File>
+## node.ssl_dist_optfile = {{ platform_etc_dir }}/ssl_dist.conf
+
 ## Sets the net_kernel tick time. TickTime is specified in seconds.
 ## Sets the net_kernel tick time. TickTime is specified in seconds.
 ## Notice that all communicating nodes are to have the same TickTime
 ## Notice that all communicating nodes are to have the same TickTime
 ## value specified.
 ## value specified.

+ 11 - 0
etc/ssl_dist.conf

@@ -0,0 +1,11 @@
+%% The options in the {server, Opts} tuple are used when calling ssl:ssl_accept/3,
+%% and the options in the {client, Opts} tuple are used when calling ssl:connect/4.
+%% 
+%% More information at: http://erlang.org/doc/apps/ssl/ssl_distribution.html
+[{server,
+  [{certfile, "{{ platform_etc_dir }}/certs/cert.pem"},
+   {keyfile, "{{ platform_etc_dir }}/certs/key.pem"},
+   {secure_renegotiate, true},
+   {depth, 0}]},
+ {client,
+  [{secure_renegotiate, true}]}].

+ 9 - 1
priv/emq.schema

@@ -170,7 +170,15 @@ end}.
 
 
 %% @doc The erlang distributed protocol
 %% @doc The erlang distributed protocol
 {mapping, "node.proto_dist", "vm_args.-proto_dist", [
 {mapping, "node.proto_dist", "vm_args.-proto_dist", [
-  %%{default, "inet_tcp"}
+  {default, "inet_tcp"},
+  {datatype, {enum, [inet_tcp, inet6_tcp, inet_tls]}},
+  hidden
+]}.
+
+%% @doc Specify SSL Options in the file if using SSL for erlang distribution
+{mapping, "node.ssl_dist_optfile", "vm_args.-ssl_dist_optfile", [
+  {datatype, string},
+  hidden
 ]}.
 ]}.
 
 
 %% @doc Secret cookie for distributed erlang node
 %% @doc Secret cookie for distributed erlang node

+ 1 - 1
src/emqttd.app.src

@@ -1,6 +1,6 @@
 {application,emqttd,
 {application,emqttd,
              [{description,"Erlang MQTT Broker"},
              [{description,"Erlang MQTT Broker"},
-              {vsn,"2.3.4"},
+              {vsn,"2.3.5"},
               {modules,[]},
               {modules,[]},
               {registered,[emqttd_sup]},
               {registered,[emqttd_sup]},
               {applications,[kernel,stdlib,gproc,lager,esockd,mochiweb,
               {applications,[kernel,stdlib,gproc,lager,esockd,mochiweb,