Patrik Lundin
0461a8f0b8
Use fullchain.pem instead of cert.pem which fixes "certificate signed by unknown authority" problems. Also point cafile to correct root cert.
24 lines
648 B
Bash
Executable file
24 lines
648 B
Bash
Executable file
#!/bin/bash
|
|
|
|
# Mosquitto is running with a user that is not privileged enough to read files
|
|
# directly from the certbot dirs, so copy files to where mosquitto expects
|
|
# them.
|
|
|
|
set -eu
|
|
|
|
le_dir="/etc/letsencrypt/live/$(hostname -f)"
|
|
mosquitto_dir="/etc/mosquitto"
|
|
|
|
le_fullchain="$le_dir/fullchain.pem"
|
|
mosquitto_fullchain="$mosquitto_dir/certs/fullchain.pem"
|
|
cp "$le_fullchain" "$mosquitto_fullchain"
|
|
chown mosquitto:root "$mosquitto_fullchain"
|
|
|
|
le_key="$le_dir/privkey.pem"
|
|
mosquitto_key="$mosquitto_dir/certs/privkey.pem"
|
|
cp "$le_key" "$mosquitto_key"
|
|
chown mosquitto:root "$mosquitto_key"
|
|
|
|
# Tell mosquitto to reload certs
|
|
pkill -x -HUP mosquitto
|