This chapter describes how the Erlang distribution can use
SSL to get additional verification and security.
Note this
documentation is written for the old ssl implementation and
will be updated for the new one once this functionallity is
supported by the new implementation.
The Erlang distribution can in theory use almost any connection
based protocol as bearer. A module that implements the protocol
specific parts of connection setup is however needed. The
default distribution module is
In the SSL application there is an additional distribution
module,
The security depends on how the connections are set up, one can use key files or certificates to just get a crypted connection. One can also make the SSL package verify the certificates of other nodes to get additional security. Cookies are however always used as they can be used to differentiate between two different Erlang networks.
Setting up Erlang distribution over SSL involves some simple but necessary steps:
The rest of this chapter describes the above mentioned steps in more detail.
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
Erlang distributions bin directory. The source for the script
can be found under the Erlang installation top directory under
An example .rel file with SSL added may look like this:
{release, {"OTP APN 181 01","P7A"}, {erts, "5.0"},
[{kernel,"2.5"},
{stdlib,"1.8.1"},
{ssl,"2.2.1"}]}.
Note that the version numbers surely will differ in your system. Whenever one of the applications included in the script is upgraded, the script has to be changed.
Assuming the above .rel file is stored in a file
1> systools:make_script("start_ssl",[]).
There will now be a file
whereis(ssl_server).
<0.32.0> ]]>
The
As an alternative to building a bootscript, one can explicitly
add the path to the ssl
The distribution module for SSL is named
Extending the command line from above gives us the following:
$ erl -boot /home/me/ssl/start_ssl -proto_dist inet_ssl
For the distribution to actually be started, we need to give the emulator a name as well:
$ erl -boot /home/me/ssl/start_ssl -proto_dist inet_ssl -sname ssl_test
Erlang (BEAM) emulator version 5.0 [source]
Eshell V5.0 (abort with ^G)
(ssl_test@myhost)1>
Note however that a node started in this way will refuse to talk to other nodes, as no certificates or key files are supplied (see below).
When the SSL distribution starts, the OTP system is in its
early boot stage, why neither
For SSL to work, you either need certificate files or a key file. Certificate files can be specified both when working as client and as server (connecting or accepting).
On the
The command line argument for specifying the SSL options is named
An example command line would now look something like this (line breaks in the command are for readability, they should not be there when typed):
$ erl -boot /home/me/ssl/start_ssl -proto_dist inet_ssl
-ssl_dist_opt client_certfile "/home/me/ssl/erlclient.pem"
-ssl_dist_opt server_certfile "/home/me/ssl/erlserver.pem"
-ssl_dist_opt verify 1 depth 1
-sname ssl_test
Erlang (BEAM) emulator version 5.0 [source]
Eshell V5.0 (abort with ^G)
(ssl_test@myhost)1>
A node started in this way will be fully functional, using SSL as the distribution protocol.
A convenient way to specify arguments to Erlang is to use the
In a Unix (Bourne) shell it could look like this (line breaks for readability):
$ ERL_FLAGS="-boot \\"/home/me/ssl/start_ssl\\" -proto_dist inet_ssl
-ssl_dist_opt client_certfile \\"/home/me/ssl/erlclient.pem\\"
-ssl_dist_opt server_certfile \\"/home/me/ssl/erlserver.pem\\"
-ssl_dist_opt verify 1 -ssl_dist_opt depth 1"
$ 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_ssl"]},
{ssl_dist_opt,["client_certfile","/home/me/ssl/erlclient.pem"]},
{ssl_dist_opt,["server_certfile","/home/me/ssl/erlserver.pem"]},
{ssl_dist_opt,["verify","1"]},
{ssl_dist_opt,["depth","1"]},
{home,["/home/me"]}]
The