diff --git a/.gitignore b/.gitignore index 9b36f55..b27c7cf 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ rel/dobby_allinone/ rebar id_rsa* priv/erl_sshd +priv/erl_cowboy diff --git a/Makefile b/Makefile index 260e9f1..9e023ef 100644 --- a/Makefile +++ b/Makefile @@ -56,3 +56,6 @@ rebar: id_rsa: deps/erl_sshd/make_keys + +tls: + deps/erl_cowboy/make_tls.sh diff --git a/README.md b/README.md index 2171ecb..2992886 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,6 @@ This is an Erlang node that contains: 3. [dobby_ui_lib](https://github.com/ivanos/dobby_ui_lib) 3. [erl_sshd](https://github.com/marcsugiyama/erl_sshd) - **Table of Contents** - [Dobby All In One](#dobby-all-in-one) @@ -15,9 +14,7 @@ This is an Erlang node that contains: - [Building](#building) - [Running](#running) - [Connecting via ssh](#connecting-via-ssh) - - - + - [Configuring TLS](#configuring-tls) ## Requirements - Erlang R17+ @@ -61,3 +58,37 @@ ssh 127.0.0.1 -p 11133 -i id_rsa ``` To exit the Erlang shell obtained via ssh call `exit().` + +## Configuring TLS + +To enable TLS support for the HTTP interface you have to configure it in the `erl_cowboy` +application and provide the following options: + +* certificate file name (expected in the `priv/erl_cowboy`) +* key file name (expected in the `priv/erl_cowboy`) +* password to the key if it is password protected + +The configuration has to be placed in the sys.config file. Below is an example: +```erlang +[ +... + {erl_cowboy, [ + {port, 8080}, + {listeners, 10}, + {app, 'dobby_allinone'}, + {tls_enabled, true}, + {tls_opts, [{certfile, "dummy.crt"}, + {keyfile, "dummy.key"}, + {password, ""}]} + ]}, +... +] +``` + +There is a sample certificate and key generator that you can run with: +`make tls`. +The above example config works with the generated files. To test the TLS, +put the config snippet into the `rel/files/sys.config`. Remember +to re-generated the release after the change. + +With TLS enabled, the Visualizer can be accessed via https://localhost:8080/static/www/index.html. diff --git a/rel/files/sys.config b/rel/files/sys.config index 3088d7d..2ea5336 100644 --- a/rel/files/sys.config +++ b/rel/files/sys.config @@ -7,12 +7,17 @@ ]}, %% erl_mnesia configuration {erl_mnesia, [ - {options, [persistent]} - ]}, + {options, [persistent]} + ]}, %% erl_cowboy configuration {erl_cowboy, [ {port, 8080}, - {listeners, 10} + {listeners, 10}, + {app, 'dobby_allinone'}, + {tls_enabled, false} + %% ,{tls_opts, [{certfile, "dummy.crt"}, + %% {keyfile, "dummy.key"}, + %% {password, ""}]} ]}, %% lager configuration {lager, [