From d0b58b6d531d477c7cdea1fc0f7b4489ae9fe08d Mon Sep 17 00:00:00 2001 From: turint Date: Fri, 29 Aug 2014 15:28:51 +0300 Subject: [PATCH] Adds certificate choices to debconf. --- debian/jitsi-meet.postinst | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/debian/jitsi-meet.postinst b/debian/jitsi-meet.postinst index 015541dcaa..cd0e359204 100644 --- a/debian/jitsi-meet.postinst +++ b/debian/jitsi-meet.postinst @@ -17,7 +17,6 @@ set -e # for details, see http://www.debian.org/doc/debian-policy/ or # the debian-policy package - case "$1" in configure) @@ -35,6 +34,31 @@ case "$1" in sed -i "s/#\ server_names_hash_bucket_size\ 64/\ server_names_hash_bucket_size\ 64/" /etc/nginx/nginx.conf fi + # loading debconf + . /usr/share/debconf/confmodule + + # SSL for nginx + db_get jitsi-meet/cert-choice + CERT_CHOICE="$RET" + if [ "$CERT_CHOICE" == 'I want a generated self-signed certificate' ]; then + # self-signed certificate is already in place for prosody + elif [ "$CERT_CHOICE" == 'I have a certificate and will upload the files on the server' ]; then + db_fset jitsi-meet/default-key "/etc/ssl/$JVB_HOSTNAME.key" + db_get jitsi-meet/cert-path-key + CERT_KEY="$RET" + db_fset jitsi-meet/default-crt "/etc/ssl/$JVB_HOSTNAME.crt" + db_get jitsi-meet/cert-path-crt + CERT_CRT="$RET" + # replace self-signed certificate paths with user provided ones + sed -i "s/ssl_certificate_key\ /var/lib/prosody/(.*)key;/ssl_certificate_key\ $CERT_KEY;/g" \ + /etc/nginx/sites-available/$JVB_HOSTNAME.conf + sed -i "s/ssl_certificate\ /var/lib/prosody/(.*)crt;/ssl_certificate\ $CERT_CRT;/g" \ + /etc/nginx/sites-available/$JVB_HOSTNAME.conf + fi + + # and we're done with debconf + db_stop + # jitsi meet chown -R www-data:www-data /usr/share/jitsi-meet/ sed -i "s/jitsi-meet.example.com/$JVB_HOSTNAME/g" /usr/share/jitsi-meet/config.js