Skip to content

Commit a4d69c5

Browse files
Szymon MentelSzymon Mentel
authored andcommitted
Add TLS support
1 parent 580f84e commit a4d69c5

4 files changed

Lines changed: 47 additions & 7 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ rel/dobby_allinone/
1010
rebar
1111
id_rsa*
1212
priv/erl_sshd
13+
priv/erl_cowboy

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,6 @@ rebar:
5656

5757
id_rsa:
5858
deps/erl_sshd/make_keys
59+
60+
tls:
61+
deps/erl_cowboy/make_tls.sh

README.md

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,14 @@ This is an Erlang node that contains:
77
3. [dobby_ui_lib](https://github.com/ivanos/dobby_ui_lib)
88
3. [erl_sshd](https://github.com/marcsugiyama/erl_sshd)
99

10-
<!-- markdown-toc start - Don't edit this section. Run M-x markdown-toc/generate-toc again -->
1110
**Table of Contents**
1211

1312
- [Dobby All In One](#dobby-all-in-one)
1413
- [Requirements](#requirements)
1514
- [Building](#building)
1615
- [Running](#running)
1716
- [Connecting via ssh](#connecting-via-ssh)
18-
19-
<!-- markdown-toc end -->
20-
17+
- [Configuring TLS](#configuring-tls)
2118

2219
## Requirements
2320
- Erlang R17+
@@ -61,3 +58,37 @@ ssh 127.0.0.1 -p 11133 -i id_rsa
6158
```
6259

6360
To exit the Erlang shell obtained via ssh call `exit().`
61+
62+
## Configuring TLS
63+
64+
To enable TLS support for the HTTP interface you have to configure it in the `erl_cowboy`
65+
application and provide the following options:
66+
67+
* certificate file name (expected in the `priv/erl_cowboy`)
68+
* key file name (expected in the `priv/erl_cowboy`)
69+
* password to the key if it is password protected
70+
71+
The configuration has to be placed in the sys.config file. Below is an example:
72+
```erlang
73+
[
74+
...
75+
{erl_cowboy, [
76+
{port, 8080},
77+
{listeners, 10},
78+
{app, 'dobby_allinone'},
79+
{tls_enabled, true},
80+
{tls_opts, [{certfile, "dummy.crt"},
81+
{keyfile, "dummy.key"},
82+
{password, ""}]}
83+
]},
84+
...
85+
]
86+
```
87+
88+
There is a sample certificate and key generator that you can run with:
89+
`make tls`.
90+
The above example config works with the generated files. To test the TLS,
91+
put the config snippet into the `rel/files/sys.config`. Remember
92+
to re-generated the release after the change.
93+
94+
With TLS enabled, the Visualizer can be accessed via https://localhost:8080/static/www/index.html.

rel/files/sys.config

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,17 @@
77
]},
88
%% erl_mnesia configuration
99
{erl_mnesia, [
10-
{options, [persistent]}
11-
]},
10+
{options, [persistent]}
11+
]},
1212
%% erl_cowboy configuration
1313
{erl_cowboy, [
1414
{port, 8080},
15-
{listeners, 10}
15+
{listeners, 10},
16+
{app, 'dobby_allinone'},
17+
{tls_enabled, false}
18+
%% ,{tls_opts, [{certfile, "dummy.crt"},
19+
%% {keyfile, "dummy.key"},
20+
%% {password, ""}]}
1621
]},
1722
%% lager configuration
1823
{lager, [

0 commit comments

Comments
 (0)