2023-07-10 17:54:59 +01:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
#
|
|
|
|
# Copy dehydrated generated certs into /var/local/certificates and
|
2023-09-06 14:22:51 +01:00
|
|
|
# set required ownership and permissions. Also restart local services
|
|
|
|
# as appropriate.
|
2023-07-10 17:54:59 +01:00
|
|
|
|
|
|
|
action=$1
|
|
|
|
shift
|
|
|
|
|
|
|
|
deploy_cert() {
|
2023-08-06 11:07:16 +01:00
|
|
|
cp -a /var/lib/dehydrated/certs/* /var/local/certificates/
|
2023-07-10 17:54:59 +01:00
|
|
|
chown -R root:ssl-cert /var/local/certificates/
|
2023-09-06 14:22:51 +01:00
|
|
|
find /var/local/certificates/ -type d -print0 | xargs -0 chmod g+rx
|
|
|
|
find /var/local/certificates/ -type f -print0 | xargs -0 chmod g+r
|
2023-07-10 17:54:59 +01:00
|
|
|
|
|
|
|
DOMAIN="$1"
|
|
|
|
case $DOMAIN in
|
|
|
|
"mail.lunch.org.uk")
|
|
|
|
systemctl restart exim4
|
2023-08-06 11:07:16 +01:00
|
|
|
systemctl reload dovecot
|
2023-07-10 17:54:59 +01:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
|
|
|
case $action in
|
|
|
|
deploy_cert)
|
|
|
|
deploy_cert "$@"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|