Merge PR #2364: Implement HTTPS for the LCD REST server

In order to guarantee a secure connection between apps and the LCD the
communication must be encrypted - even if clients and server run on the
same local machine, credentials must never be transmitted in clear text.

Upon start up, the server generates a self-signed certificate and a key.
Both are stored as temporary files; removal is guaranteed on exit.

This new behaviour is now enabled by default, though users are provided
with a --insecure flag to switch it off.
This commit is contained in:
Alessio Treglia
2018-09-22 00:33:58 +08:00
committed by Christopher Goes
parent 7823b9bb10
commit e2da4caae4
5 changed files with 365 additions and 13 deletions
+18 -2
View File
@@ -1,6 +1,6 @@
# Getting Started
To start a rest server, we need to specify the following parameters:
To start a REST server, we need to specify the following parameters:
| Parameter | Type | Default | Required | Description |
| ----------- | --------- | ----------------------- | -------- | ---------------------------------------------------- |
| chain-id | string | null | true | chain id of the full node to connect |
@@ -12,9 +12,25 @@ To start a rest server, we need to specify the following parameters:
Sample command:
```bash
gaiacli light-client --chain-id=test --laddr=tcp://localhost:1317 --node tcp://localhost:46657 --trust-node=false
gaiacli rest-server --chain-id=test \
--laddr=tcp://localhost:1317 \
--node tcp://localhost:46657 \
--trust-node=false
```
The server listens on HTTPS by default. You can set the SSL certificate to be used by the server with these additional flags:
```bash
gaiacli rest-server --chain-id=test \
--laddr=tcp://localhost:1317 \
--node tcp://localhost:46657 \
--trust-node=false \
--certfile=mycert.pem --keyfile=mykey.key
```
If no certificate/keyfile pair is supplied, a self-signed certificate will be generated and its fingerprint printed out.
Append `--insecure` to the command line if you want to disable the secure layer and listen on an insecure HTTP port.
## Gaia Light Use Cases
LCD could be very helpful for related service providers. For a wallet service provider, LCD could