[SYS] Multiple connections management (#1947)
Enable the management of different connections at runtime with a set of certs for each. Add parameters to the WiFi Manager onboarding, client certificates, and certificate validation
This commit is contained in:
1 parent
743083cbfe
commit
f98474bed0
14 files changed
+808
-448
No files matched your search
@@ -10,16 +10,17 @@ The configuration of the broker is not covered here, you should look into the do
|
||||
|
||||
### Prerequisites
|
||||
The MQTT broker is configured for TLS and you have access to the CA certificate which was used to sign the MQTT broker certificate.
|
||||
You are using ESP8266 or ESP32, for other boards TLS is not supported.
|
||||
You are using ESP8266 or ESP32.
|
||||
|
||||
### Configure secure connection in the gateway
|
||||
To enable the secure connection and use TLS set the `#define MQTT_DEFAULT_SECURE` to true.
|
||||
To enable the secure connection and use TLS set the `#define MQTT_DEFAULT_SECURE` to true at build time, or the `mqtt secure` parameter with WiFi Manager or `mqtt_secure` with MQTT.
|
||||
Set `MQTT_SERVER` to the Common Name (CN) of the certificate of the broker.
|
||||
This can be the hostname or the IP of the broker.
|
||||
|
||||
The server identity can be verified against a certificate or not, if you don't want to use a certicate to verify the server you can uncheck the option `validate cert` with WiFi Manager or set `mqtt_validate` to `false` with MQTT
|
||||
|
||||
The CA certificate should be in PEM ascii format.
|
||||
If your CA certificate is not in the correct format or you don't know the format, use `openssl` to convert the certificate to the correct format.
|
||||
In `User_config.h` replace the `...` with the content of your certificate which is between the `-----BEGIN CERTIFICATE-----` and `-----END CERTIFICATE-----` lines:
|
||||
At build time, in `main/certs/default_server_cert.h` replace the `...` with the content of your certificate which is between the `-----BEGIN CERTIFICATE-----` and `-----END CERTIFICATE-----` lines:
|
||||
```cpp
|
||||
const char* certificate CERT_ATTRIBUTE = R"EOF("
|
||||
-----BEGIN CERTIFICATE-----
|
||||
@@ -28,7 +29,14 @@ const char* certificate CERT_ATTRIBUTE = R"EOF("
|
||||
")EOF";
|
||||
```
|
||||
|
||||
You can know compile and upload to your board and the gateway should connect with TLS to your broker.
|
||||
With WiFi Manager copy your certificate from `-----BEGIN CERTIFICATE-----` to `-----END CERTIFICATE-----` (included) and paste it into the input field:
|
||||
```
|
||||
-----BEGIN CERTIFICATE-----
|
||||
...
|
||||
-----END CERTIFICATE-----
|
||||
```
|
||||
|
||||
This process can also be used for the other certificates, OTA, client key, client certificate if necessary.
|
||||
|
||||
## Add the received "value" at the end of the topic
|
||||
For the gateways that publish a "value" parameter on the json (RF, IR...), it is possible to concatenate this parameter at the end of the topic.
|
||||
|
||||
@@ -29,8 +29,6 @@ If the board is connected by ethernet, the Wifi and password can be empty. If yo
|
||||
|
||||
* Set your MQTT Server IP or domain name (for Home Assistant you can enter `homeassistant.local` if your server is configured with mDNS)
|
||||
* Set your MQTT Server Port (default: 1883)
|
||||
* Set the MQTT secure connection box to select whether or not the connection should be secure
|
||||
* Copy/paste the MQTT server certificate in the MQTT server cert box (only required if using a secure connection), be sure to include the `-----BEGIN CERTIFICATE-----` and `-----END CERTIFICATE-----` markers
|
||||
* Set your MQTT Server username (optional, 64 characters maximum)
|
||||
* Set your MQTT Server password (optional, 64 characters maximum)
|
||||
* Set your MQTT base topic if you need to change it (you must keep the / at the end) (default: home/, 64 characters maximum)
|
||||
@@ -39,6 +37,10 @@ If the board is connected by ethernet, the Wifi and password can be empty. If yo
|
||||
* Local and remote OTA
|
||||
* WebUI login (login:"admin", password: "")
|
||||
* WiFi Manager Access Point password after initial config
|
||||
* Set the MQTT secure connection box to select whether or not the connection should be secure
|
||||
* Set the certificate validation to select wether or not you want to validate the server identity with a certificate
|
||||
* Copy/paste the MQTT server certificate in the MQTT server cert box (only required if using a secure connection), be sure to include the `-----BEGIN CERTIFICATE-----` and `-----END CERTIFICATE-----` markers
|
||||
* Add your certificates
|
||||
* Click on save
|
||||
|
||||

|
||||
|
||||
Reference in new issue
Block a user