Table of Contents
Mosquitto Broker
Haproxy
Letsencrypt
Paho client has compatility problems with ECDSA encryption. Use RSA:
Get cert:
I have multidomain certificates with three domains and so I must request an RSA certificate explicitly using “–key-type rsa” as follows:
certbot certonly --key-type rsa --no-reuse-key -d domain1.tld -d domain2.tld -d domain3.tld --force-renewal
To issue the wildcard certificate using an RSA key instead of Certbot's default ECDSA key (useful for older IoT microcontrollers like ESP8266 or legacy TLS libraries), add –key-type rsa (and optionally –rsa-key-size 2048 or 4096) to your Certbot command.
- Request the RSA Wildcard Certificate
If you already generated an ECDSA certificate for example.com, add –force-renewal so Certbot replaces the existing private key type immediately:
- snippet.bash
sudo certbot certonly \ --dns-cloudflare \ --dns-cloudflare-credentials /etc/letsencrypt/cloudflare/credentials.ini \ --dns-cloudflare-propagation-seconds 30 \ --key-type rsa \ --rsa-key-size 2048 \ --force-renewal \ -d example.com \ -d *.example.com
(Note: 2048 is the standard RSA key size and provides the fastest TLS handshakes for embedded IoT devices; use 4096 only if your compliance rules require it.)
- Re-Bundle the .pem File and Reload HAProxy
Because the private key changed, rebuild the .pem file for HAProxy and reload the service:
- snippet.bash
sudo cat /etc/letsencrypt/live/://example.com \ /etc/letsencrypt/live/://example.com \ | sudo tee /etc/haproxy/certs/://example.com.pem > /dev/null sudo chmod 600 /etc/haproxy/certs/://example.com.pem sudo systemctl reload haproxy
- Verify the RSA Key Type
Certbot saves key_type = rsa in /etc/letsencrypt/renewal/example.com.conf, so all future automatic renewals will stay RSA. You can confirm the active certificate uses RSA with:
openssl x509 -in /etc/haproxy/certs/://example.com.pem -text -noout | grep "Public Key Algorithm"
Expected output: Public Key Algorithm: rsaEncryption.
If you are connecting specific IoT devices (such as ESP32, ESP8266, or SIM7600 modules) and need the Let's Encrypt Root CA (ISRG Root X1) or specific TLS cipher settings in HAProxy for compatibility, let me know which devices you're using.
Troubleshooting
Check what certificate Mosquitto is serving openssl s_client -connect localhost:8883 -CApath /etc/ssl/certs 2>&1 | grep -E "issuer|subject|Verify|PKEY|sigalg" Check how many certs are in a PEM file openssl crl2pkcs7 -nocrl -certfile /etc/mosquitto/certs/fullchain.pem | openssl pkcs7 -print_certs -noout Check cert details openssl x509 -in /etc/mosquitto/certs/fullchain.pem -noout -issuer -subject -dates Watch Mosquitto log sudo tail -f /var/log/mosquitto/mosquitto.log