aboutsummaryrefslogtreecommitdiff
path: root/make/template/deploy-ssl.sh
blob: 1e5c76a86a1a2cea25988988d5501f3cf0dfc262 (about) (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
%mode 0750
#!/bin/sh
set -e

# IMPORTANT: This script is an example post-deploy hook for use with CertBot,
# Dehydrated, or a similar SSL (TLS) renewal tool. You will need to customise
# it for your setup before you use it

# The location your renewal tool places your certificates.
CERT_DIR="/etc/letsencrypt/live/irc.example.com"

# The location of the InspIRCd config directory.
INSPIRCD_CONFIG_DIR="@CONFIG_DIR@"

# The location of the InspIRCd pid file.
INSPIRCD_PID_FILE="@RUNTIME_DIR@/inspircd.pid"

# The user:group that InspIRCd runs as.
INSPIRCD_OWNER="@USER@:@GROUP@"

if [ -e ${CERT_DIR} -a -e ${INSPIRCD_CONFIG_DIR} ]
then
    cp "${CERT_DIR}/fullchain.pem" "${INSPIRCD_CONFIG_DIR}/cert.pem"
    cp "${CERT_DIR}/privkey.pem" "${INSPIRCD_CONFIG_DIR}/key.pem"
    chown ${INSPIRCD_OWNER} "${INSPIRCD_CONFIG_DIR}/cert.pem" "${INSPIRCD_CONFIG_DIR}/key.pem"

    if [ -r ${INSPIRCD_PID_FILE} ]
    then
        kill -USR1 $(cat ${INSPIRCD_PID_FILE})
    elif [ -d /lib/systemd ] && systemctl --quiet is-active inspircd
    then
        systemctl kill --signal USR1 inspircd
    fi
fi