mail4one/deploy_configs/mail4one_cert_copy.sh
Balakrishnan Balasubramanian 95423ebf63 Remove pyc files
pyc files are not compatible across multiple python versions
Harden systemd service files
2023-06-24 20:12:20 -04:00

19 lines
559 B
Bash
Executable File

#!/bin/sh
# certbot deploy hook to copy certificates to mail4one when renewed.
# This file is supposed to be copied to /etc/letsencrypt/renewal-hooks/deploy/
# Change the mail domain to the one on MX record
set -x
if [ "$RENEWED_DOMAINS" = "mail.mydomain.com" ]
then
mkdir -p /var/lib/mail4one/certs
chmod 750 /var/lib/mail4one/certs
chown mail4one:mail4one /var/lib/mail4one/certs
cp "$RENEWED_LINEAGE/fullchain.pem" /var/lib/mail4one/certs/
cp "$RENEWED_LINEAGE/privkey.pem" /var/lib/mail4one/certs/
systemctl restart mail4one.service
fi