|
|
@@ -19,6 +19,7 @@
|
|
|
-behaviour(hocon_schema).
|
|
|
|
|
|
-include_lib("typerefl/include/types.hrl").
|
|
|
+-include_lib("hocon/include/hoconsc.hrl").
|
|
|
|
|
|
-export([
|
|
|
roots/0,
|
|
|
@@ -32,19 +33,7 @@ roots() -> ["psk_authentication"].
|
|
|
fields("psk_authentication") ->
|
|
|
#{
|
|
|
fields => fields(),
|
|
|
- desc =>
|
|
|
- ""
|
|
|
- "PSK stands for 'Pre-Shared Keys'.\n"
|
|
|
- "This config to enable TLS-PSK authentication.\n"
|
|
|
- "\n"
|
|
|
- "<strong>Important!</strong> Make sure the SSL listener with\n"
|
|
|
- "only <code>tlsv1.2</code> enabled, and also PSK cipher suites\n"
|
|
|
- "configured, such as <code>RSA-PSK-AES256-GCM-SHA384</code>.\n"
|
|
|
- "See listener SSL options config for more details.\n"
|
|
|
- "\n"
|
|
|
- "The IDs and secrets can be provided from a file the path\n"
|
|
|
- "to which is configurable by the <code>init_file</code> field.\n"
|
|
|
- ""
|
|
|
+ desc => ?DESC(psk_authentication)
|
|
|
}.
|
|
|
|
|
|
fields() ->
|
|
|
@@ -52,19 +41,14 @@ fields() ->
|
|
|
{enable,
|
|
|
sc(boolean(), #{
|
|
|
default => false,
|
|
|
- desc => <<"Whether to enable TLS PSK support">>
|
|
|
+ desc => ?DESC(enable)
|
|
|
})},
|
|
|
{init_file,
|
|
|
sc(
|
|
|
binary(),
|
|
|
#{
|
|
|
required => false,
|
|
|
- desc =>
|
|
|
- <<"If init_file is specified, emqx will import PSKs from the file ",
|
|
|
- "into the built-in database at startup for use by the runtime. ",
|
|
|
- "The file has to be structured line-by-line, each line must be in ",
|
|
|
- "the format of <code>PSKIdentity:SharedSecret</code>. For example: ",
|
|
|
- "<code>mydevice1:c2VjcmV0</code>">>
|
|
|
+ desc => ?DESC(init_file)
|
|
|
}
|
|
|
)},
|
|
|
{separator,
|
|
|
@@ -72,11 +56,7 @@ fields() ->
|
|
|
binary(),
|
|
|
#{
|
|
|
default => <<":">>,
|
|
|
- desc =>
|
|
|
- <<
|
|
|
- "The separator between <code>PSKIdentity</code>"
|
|
|
- " and <code>SharedSecret</code> in the psk file"
|
|
|
- >>
|
|
|
+ desc => ?DESC(separator)
|
|
|
}
|
|
|
)},
|
|
|
{chunk_size,
|
|
|
@@ -84,10 +64,7 @@ fields() ->
|
|
|
integer(),
|
|
|
#{
|
|
|
default => 50,
|
|
|
- desc => <<
|
|
|
- "The size of each chunk used to import to"
|
|
|
- " the built-in database from psk file"
|
|
|
- >>
|
|
|
+ desc => ?DESC(chunk_size)
|
|
|
}
|
|
|
)}
|
|
|
].
|