aboutsummaryrefslogtreecommitdiffstats
path: root/roles/znc/templates/deploy_ssl.sh.j2
diff options
context:
space:
mode:
Diffstat (limited to 'roles/znc/templates/deploy_ssl.sh.j2')
-rw-r--r--roles/znc/templates/deploy_ssl.sh.j222
1 files changed, 22 insertions, 0 deletions
diff --git a/roles/znc/templates/deploy_ssl.sh.j2 b/roles/znc/templates/deploy_ssl.sh.j2
new file mode 100644
index 0000000..679ea4d
--- /dev/null
+++ b/roles/znc/templates/deploy_ssl.sh.j2
@@ -0,0 +1,22 @@
+#!/bin/sh
+#
+# Copy the issued SSL key and certificate to deploy them for ZNC.
+#
+# Reference: https://wiki.znc.in/Signed_SSL_certificate
+#
+
+cp -v {{ web.ssl_root }}/{{ network.domain }}/key \
+ {{ znc.data_dir }}/ssl.key
+cp -v {{ web.ssl_root }}/{{ network.domain }}/fullchain \
+ {{ znc.data_dir }}/ssl.crt
+chown znc:znc {{ znc.data_dir }}/ssl.key {{ znc.data_dir }}/ssl.crt
+chmod 0400 {{ znc.data_dir }}/ssl.key {{ znc.data_dir }}/ssl.crt
+
+if pgrep -x znc >/dev/null; then
+ echo -n "Reloading service znc ... "
+ # ZNC's service file doesn't support 'reload' command
+ killall -SIGHUP znc
+ echo "done"
+else
+ echo "WARNING: service znc is not running" >&2
+fi