Several functions of the Weble IoT gateway can encrypt their connections with TLS: the web interface of the device (HTTPS), the Generic IP driver, the MQTT client and broker, BACnet/SC and the OPC UA server. This page explains the certificate fields they share, how to create certificates with openssl, and how to obtain them automatically with SCEP.
| Function | Where to set it | Fields |
|---|---|---|
| Web interface of the device (HTTPS) | System configuration › Webserver configuration, Custom certificates (System) | Cert, Key, Key passphrase, CA |
| Generic IP, client or server | Gateway form, TLS (Generic IP) | ca, key, cert, Require client certificate (server), SCEP |
| MQTT client | Gateway form, Protocol mqtts or wss (MQTT) |
ca, key, cert (or pfx and passphrase), rejectUnauthorized, servername, SCEP |
| MQTT broker | Interface of type TLS (MQTT broker) | Auto manage certs. (the device makes its own certificate), or Key and Cert |
| BACnet/SC | Secure Connect channel of the BACnet gateway (BACnet/SC) | Own certificate file (p12, or cer + key), Certificate password, Trusted certificates file (CA), Validate hub certificate |
| OPC UA server | OPC UA gateway (OPC UA, OPC UA server security) | Self-signed certificate made automatically; CA certificates (PEM), CRLs (PEM), Trusted client certificates (PEM) |
The fields ca, key and cert take files in PEM format (text starting with -----BEGIN …-----). Load them with the file button of the field, or paste their content.
| Field | Content |
|---|---|
| ca | Certificate(s) of the authority (CA) that the device trusts to check the other side. Several certificates are allowed. |
| key | Private key of the device. |
| cert | Certificate of the device, signed by a CA that the other side trusts. |
Never paste a private key in an e-mail or a chat. Generate it on your computer, load it in the form, and keep the original in a safe place.
Run these commands on your computer (Linux, macOS, or Windows with OpenSSL). Replace 192.168.1.24 by the address that the clients use to reach the device, and adapt the validity.
1. A private CA (keep ca.key offline):
openssl genrsa -out ca.key 2048
openssl req -x509 -new -key ca.key -sha256 -days 3650 -subj "/CN=WBox local CA" -out ca.crt
2. A server certificate for the device, with its address in the Subject Alternative Name (SAN):
openssl genrsa -out server.key 2048
openssl req -new -key server.key -subj "/CN=192.168.1.24" -out server.csr
printf "subjectAltName=IP:192.168.1.24\nextendedKeyUsage=serverAuth\n" > san.ext
openssl x509 -req -in server.csr -CA ca.crt -CAkey ca.key -CAcreateserial -days 1825 -sha256 -extfile san.ext -out server.crt
For a DNS name, write subjectAltName=DNS:gateway.example.com (or both: IP:192.168.1.24,DNS:gateway.example.com).
Load ca.crt in ca, server.key in key and server.crt in cert. The clients must trust ca.crt.
3. A client certificate for mutual TLS: same commands with another name and extendedKeyUsage=clientAuth, signed by the same CA. Give client.key and client.crt to the client.
openssl x509 -in server.crt -noout -subject -issuer -dates -ext subjectAltName
openssl rsa -in server.key -check -noout
The first command shows who the certificate is for, who signed it, its validity dates and its SAN. The second checks that the key is valid.
With SCEP (Simple Certificate Enrollment Protocol), the device creates its own key and asks the certificate to a SCEP server of your PKI (for example Microsoft NDES). It then renews the certificate by itself. SCEP is available in the Generic IP driver and in the MQTT client.
mqtts / wss (MQTT), then tick SCEP. The ca, key and cert fields are replaced by the SCEP fields.| Field | Content |
|---|---|
| SCEP URL | Address of the SCEP service, given by the administrator of the PKI. |
| SCEP CN | Common Name of the certificate, for example the name or the address of the device. |
| SCEP challenge | Challenge password of the SCEP server, if it asks for one. |
| Symptom or message | Cause and action |
|---|---|
| The client refuses the certificate of the device | The SAN does not contain the address or the name used by the client, or the client does not trust the CA. Make a new certificate with the right SAN, and install ca.crt on the client. |
| The device refuses the server | ca does not contain the CA of the server, or the certificate of the server has expired. |
| The HTTPS page keeps showing the built-in certificate | Cert, Key and CA are all required, and the Key passphrase must match the key. If the device cannot load your certificate, it uses its built-in one. |
| Certificate expired | Check the date of the device (System) and the validity of the certificate (openssl x509 -dates). |
scep: no certificate yet (…), retry in N s |
The first enrolment did not succeed yet. Read the reason in brackets: address, challenge, or approval pending on the CA. |
request pending (manual approval on the CA), polling every 60 s |
Approve the request on the CA. |
CA fingerprint mismatch |
The CA of the SCEP server is not the one expected. Check the SCEP URL with the administrator of the PKI. |
enrollment failed: … retry in N s / renewal failed: … |
The SCEP server refused or did not answer. The device tries again by itself. |
The SCEP messages are in the logs of the gateway.