This section describes how the Erlang distribution can use TLS to get extra verification and security.
The Erlang distribution can in theory use almost any
connection-based protocol as bearer. However, a module that
implements the protocol-specific parts of the connection setup is
needed. The default distribution module is
In the SSL application, an extra distribution
module,
The security level depends on the parameters provided to the TLS connection setup. Erlang node cookies are however always used, as they can be used to differentiate between two different Erlang networks.
To set up Erlang distribution over TLS:
The following sections describe these steps.
Boot scripts are built using the
The simplest boot script possible includes only the Kernel
and STDLIB applications. Such a script is located in the
Do the following:
Copy that script to another location (and preferably another name).
Add the applications Crypto, Public Key, and SSL with their current version numbers after the STDLIB application.
The following shows an example
{release, {"OTP APN 181 01","R15A"}, {erts, "5.9"},
[{kernel,"2.15"},
{stdlib,"1.18"},
{crypto, "2.0.3"},
{public_key, "0.12"},
{asn1, "4.0"},
{ssl, "5.0"}
]}.
The version numbers differ in your system. Whenever one of the applications included in the script is upgraded, change the script.
Do the following:
Build the boot script.
Assuming the
1> systools:make_script("start_ssl",[]).
There is now a
Do the following:
Test the boot script. To do this, start Erlang with the
whereis(ssl_manager).
<0.41.0> ]]>
The
As an alternative to building a bootscript, you can explicitly
add the path to the SSL
The clone of the SSL application must enable the use of the SSL code in such an early bootstage as needed to set up the distribution. However, this makes it impossible to soft upgrade the SSL application.
The distribution module for SSL/TLS is named
Extending the command line gives the following:
$ erl -boot /home/me/ssl/start_ssl -proto_dist inet_tls
For the distribution to be started, give the emulator a name as well:
$ erl -boot /home/me/ssl/start_ssl -proto_dist inet_tls -sname ssl_test
Erlang (BEAM) emulator version 5.0 [source]
Eshell V5.0 (abort with ^G)
(ssl_test@myhost)1>
However, a node started in this way refuses to talk to other nodes, as no TLS parameters are supplied (see the next section).
The SSL/TLS distribution options can be written into a file
that is consulted when the node is started. This file name
is then specified with the command line argument
Any available SSL/TLS option can be specified in an options file,
but note that options that take a
Do not tamper with the socket options
For SSL/TLS to work, at least a public key and a certificate
must be specified for the server side.
In the following example, the PEM file
Create a file named for example
And then start the node like this (line breaks in the command are for readability, and shall not be there when typed):
The options in the
For the client, the option
For the server it is also possible to use the option
A node started in this way is fully functional, using TLS as the distribution protocol.
As in the previous section the PEM file
On the
The simplest SSL/TLS options in the following list can be specified
by adding the
prefix
Note that
The server can also take the options
Raw socket options, such as
The command-line argument for specifying the SSL/TLS options is named
An example command line doing the same as the example in the previous section can now look as follows (line breaks in the command are for readability, and shall not be there when typed):
]]>
A convenient way to specify arguments to Erlang is to use environment
variable
In a Unix (Bourne) shell, it can look as follows (line breaks are for readability, they are not to be there when typed):
$ ERL_FLAGS="-boot /home/me/ssl/start_ssl -proto_dist inet_tls
-ssl_dist_opt server_certfile /home/me/ssl/erlserver.pem
-ssl_dist_opt server_secure_renegotiate true client_secure_renegotiate true"
$ export ERL_FLAGS
$ erl -sname ssl_test
Erlang (BEAM) emulator version 5.0 [source]
Eshell V5.0 (abort with ^G)
(ssl_test@myhost)1> init:get_arguments().
[{root,["/usr/local/erlang"]},
{progname,["erl "]},
{sname,["ssl_test"]},
{boot,["/home/me/ssl/start_ssl"]},
{proto_dist,["inet_tls"]},
{ssl_dist_opt,["server_certfile","/home/me/ssl/erlserver.pem"]},
{ssl_dist_opt,["server_secure_renegotiate","true",
"client_secure_renegotiate","true"]
{home,["/home/me"]}]
The
It is possible to use SSL/TLS distribution over IPv6 instead of
IPv4. To do this, pass the option
An example command line with this option would look like this:
A node started in this way will only be able to communicate with other nodes using SSL/TLS distribution over IPv6.