2024-10-10 08:13:04 +00:00
|
|
|
#!/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)"
|
2024-10-10 08:36:00 +00:00
|
|
|
mosquitto_dir="/etc/mosquitto"
|
2024-10-10 08:13:04 +00:00
|
|
|
|
2024-11-05 13:39:13 +00:00
|
|
|
le_fullchain="$le_dir/fullchain.pem"
|
|
|
|
mosquitto_fullchain="$mosquitto_dir/certs/fullchain.pem"
|
|
|
|
cp "$le_fullchain" "$mosquitto_fullchain"
|
|
|
|
chown mosquitto:root "$mosquitto_fullchain"
|
2024-10-10 08:13:04 +00:00
|
|
|
|
|
|
|
le_key="$le_dir/privkey.pem"
|
|
|
|
mosquitto_key="$mosquitto_dir/certs/privkey.pem"
|
2024-10-10 08:38:45 +00:00
|
|
|
cp "$le_key" "$mosquitto_key"
|
|
|
|
chown mosquitto:root "$mosquitto_key"
|
2024-10-10 08:13:04 +00:00
|
|
|
|
|
|
|
# Tell mosquitto to reload certs
|
|
|
|
pkill -x -HUP mosquitto
|