2016-11-05 16:42:19 +01:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
|
|
|
# .---. . .
|
|
|
|
# | | |
|
|
|
|
# |--- .--. .-. .-. .-.| .-. .--.--. |.-. .-. .--. .-.
|
|
|
|
# | | (.-' (.-' ( | ( )| | | | )( )| | (.-'
|
|
|
|
# ' ' --' --' -' - -' ' ' -' -' -' ' - --'
|
|
|
|
#
|
|
|
|
# Freedom in the Cloud
|
|
|
|
#
|
|
|
|
# Jitsi meet + videobridge
|
|
|
|
#
|
|
|
|
# Instructions: https://github.com/jitsi/jitsi-meet/blob/master/doc/manual-install.md
|
|
|
|
#
|
|
|
|
# License
|
|
|
|
# =======
|
|
|
|
#
|
|
|
|
# Copyright (C) 2016 Bob Mottram <bob@freedombone.net>
|
|
|
|
#
|
|
|
|
# This program is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU Affero General Public License as published by
|
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU Affero General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU Affero General Public License
|
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
2016-11-09 14:15:48 +01:00
|
|
|
VARIANTS="full full-vim chat"
|
2016-11-05 16:42:19 +01:00
|
|
|
|
2016-11-05 18:05:54 +01:00
|
|
|
IN_DEFAULT_INSTALL=0
|
2016-11-09 14:15:48 +01:00
|
|
|
SHOW_ON_ABOUT=1
|
2016-11-05 16:42:19 +01:00
|
|
|
|
|
|
|
VIDEOBRIDGE_PORT=5347
|
|
|
|
JITSI_ONION_PORT=8102
|
2016-11-09 14:15:48 +01:00
|
|
|
JITSI_PORT=5280
|
2016-11-05 16:42:19 +01:00
|
|
|
|
|
|
|
# domains
|
|
|
|
JITSI_DOMAIN_NAME=
|
|
|
|
JITSI_CODE=
|
|
|
|
JITSI_ONION_HOSTNAME=
|
|
|
|
|
|
|
|
jitsi_variables=(ONION_ONLY
|
|
|
|
JITSI_DOMAIN_NAME
|
2016-11-09 20:38:22 +01:00
|
|
|
JITSI_ONION_HOSTNAME
|
2016-11-05 16:42:19 +01:00
|
|
|
JITSI_CODE
|
|
|
|
DEFAULT_DOMAIN_NAME
|
|
|
|
MY_USERNAME)
|
|
|
|
|
2016-11-05 21:04:48 +01:00
|
|
|
function change_password_jitsi {
|
|
|
|
echo -n ''
|
|
|
|
}
|
|
|
|
|
2016-11-05 16:42:19 +01:00
|
|
|
function can_install_videobridge {
|
|
|
|
check_architecture=$(uname -a)
|
|
|
|
if [[ "$check_architecture" == *"amd64"* || "$check_architecture" == *"i386"* ]]; then
|
|
|
|
echo "1"
|
|
|
|
else
|
|
|
|
echo "0"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
function create_jitsi_subdomains {
|
|
|
|
JITSI_ONION_HOSTNAME=$(add_onion_service jitsi 80 ${JITSI_ONION_PORT})
|
|
|
|
|
|
|
|
if ! grep -q "Jitsi onion domain" /home/${MY_USERNAME}/README; then
|
|
|
|
echo $"Jitsi onion domain: ${JITSI_ONION_HOSTNAME}" >> /home/${MY_USERNAME}/README
|
|
|
|
echo '' >> /home/${MY_USERNAME}/README
|
|
|
|
chown ${MY_USERNAME}:${MY_USERNAME} /home/${MY_USERNAME}/README
|
|
|
|
chmod 600 /home/${MY_USERNAME}/README
|
|
|
|
else
|
|
|
|
if [ -f /home/${MY_USERNAME}/README ]; then
|
|
|
|
sed -i "s|Jitsi onion domain.*|Jitsi onion domain: ${JITSI_ONION_HOSTNAME}|g" /home/${MY_USERNAME}/README
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
function remove_jitsi_subdomains {
|
|
|
|
function_check remove_onion_service
|
|
|
|
remove_onion_service jitsi ${JITSI_ONION_PORT}
|
|
|
|
}
|
|
|
|
|
|
|
|
function remove_user_jitsi {
|
|
|
|
remove_username="$1"
|
|
|
|
}
|
|
|
|
|
|
|
|
function add_user_jitsi {
|
|
|
|
new_username="$1"
|
|
|
|
new_user_password="$2"
|
|
|
|
}
|
|
|
|
|
|
|
|
function install_interactive_jitsi {
|
|
|
|
if [ ! ${ONION_ONLY} ]; then
|
|
|
|
ONION_ONLY='no'
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ ${ONION_ONLY} != "no" ]]; then
|
|
|
|
JITSI_DOMAIN_NAME='jitsi.local'
|
|
|
|
write_config_param "JITSI_DOMAIN_NAME" "$JITSI_DOMAIN_NAME"
|
|
|
|
else
|
|
|
|
function_check interactive_site_details
|
|
|
|
interactive_site_details "jitsi" "JITSI_DOMAIN_NAME" "JITSI_CODE"
|
|
|
|
fi
|
|
|
|
APP_INSTALLED=1
|
|
|
|
}
|
|
|
|
|
|
|
|
function configure_interactive_jitsi {
|
|
|
|
echo -n ''
|
|
|
|
}
|
|
|
|
|
|
|
|
function reconfigure_jitsi {
|
|
|
|
echo -n ''
|
|
|
|
}
|
|
|
|
|
|
|
|
function upgrade_jitsi {
|
2016-11-09 23:34:47 +01:00
|
|
|
echo -n ''
|
2016-11-05 16:42:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
function backup_local_jitsi {
|
|
|
|
echo -n ''
|
|
|
|
}
|
|
|
|
|
|
|
|
function restore_local_jitsi {
|
|
|
|
echo -n ''
|
|
|
|
}
|
|
|
|
|
|
|
|
function backup_remote_jitsi {
|
|
|
|
echo -n ''
|
|
|
|
}
|
|
|
|
|
|
|
|
function restore_remote_jitsi {
|
|
|
|
echo -n ''
|
|
|
|
}
|
|
|
|
|
|
|
|
function remove_jitsi {
|
|
|
|
read_config_param JITSI_DOMAIN_NAME
|
|
|
|
if [ ${#JITSI_DOMAIN_NAME} -eq 0 ]; then
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -f /etc/nginx/sites-available/${JITSI_DOMAIN_NAME} ]; then
|
2016-11-09 23:31:08 +01:00
|
|
|
nginx_dissite ${JITSI_DOMAIN_NAME}.conf
|
2016-11-05 16:42:19 +01:00
|
|
|
if [ -d /var/www/${JITSI_DOMAIN_NAME} ]; then
|
|
|
|
rm -rf /var/www/${JITSI_DOMAIN_NAME}
|
|
|
|
fi
|
2016-11-09 23:33:11 +01:00
|
|
|
rm /etc/nginx/sites-available/${JITSI_DOMAIN_NAME}.conf
|
2016-11-05 16:42:19 +01:00
|
|
|
|
|
|
|
function_check remove_certs
|
|
|
|
remove_certs ${JITSI_DOMAIN_NAME}
|
|
|
|
|
|
|
|
systemctl reload nginx
|
|
|
|
fi
|
|
|
|
|
|
|
|
remove_jitsi_subdomains
|
|
|
|
|
|
|
|
systemctl stop prosody
|
|
|
|
if [ -f /etc/prosody/conf.d/${JITSI_DOMAIN_NAME}.cfg.lua ]; then
|
|
|
|
rm /etc/prosody/conf.d/${JITSI_DOMAIN_NAME}.cfg.lua
|
|
|
|
fi
|
|
|
|
if [ -f /etc/prosody/conf.avail/${JITSI_DOMAIN_NAME}.cfg.lua ]; then
|
|
|
|
rm /etc/prosody/conf.avail/${JITSI_DOMAIN_NAME}.cfg.lua
|
|
|
|
fi
|
|
|
|
prosodyctl unregister focus auth.${JITSI_DOMAIN_NAME}
|
|
|
|
systemctl start prosody
|
|
|
|
|
|
|
|
remove_nodejs jitsi
|
|
|
|
|
|
|
|
# remove videobridge
|
2016-11-09 18:20:32 +01:00
|
|
|
firewall_remove ${VIDEOBRIDGE_PORT}
|
2016-11-10 11:18:53 +01:00
|
|
|
firewall_remove "10000:20000"
|
2016-11-09 18:20:32 +01:00
|
|
|
apt-get -yq remove --purge jitsi-videobridge jicofo jitsi-meet jitsi-meet-prosody
|
2016-11-05 16:42:19 +01:00
|
|
|
if [ -d /etc/jitsi ]; then
|
|
|
|
rm -rf /etc/jitsi
|
|
|
|
fi
|
|
|
|
if [ -d /usr/share/jitsi-videobridge ]; then
|
|
|
|
rm -rf /usr/share/jitsi-videobridge
|
|
|
|
fi
|
2016-11-09 18:20:32 +01:00
|
|
|
if [ -d /usr/share/jitsi-meet ]; then
|
|
|
|
rm -rf /usr/share/jitsi-meet
|
|
|
|
fi
|
2016-11-09 20:24:16 +01:00
|
|
|
if [ -d /etc/jitsi ]; then
|
|
|
|
rm -rf /etc/jitsi
|
|
|
|
fi
|
2016-11-05 16:42:19 +01:00
|
|
|
sed -i "/jitsi/d" /etc/apt/sources.list
|
|
|
|
apt-get update
|
|
|
|
|
|
|
|
remove_app jitsi
|
|
|
|
remove_completion_param install_jitsi
|
|
|
|
sed -i '/jitsi/d' ${COMPLETION_FILE}
|
|
|
|
sed -i '/Jitsi/d' /home/${MY_USERNAME}/README
|
2016-11-06 15:13:00 +01:00
|
|
|
|
|
|
|
function_check remove_ddns_domain
|
|
|
|
remove_ddns_domain $JITSI_DOMAIN_NAME
|
2016-11-05 16:42:19 +01:00
|
|
|
}
|
|
|
|
|
2016-11-09 18:13:06 +01:00
|
|
|
function install_jitsi {
|
|
|
|
if [[ "$(can_install_videobridge)" == "0" ]]; then
|
|
|
|
echo $'jitsi meet/videobridge can only be installed on i386 or amd64 architectures'
|
|
|
|
exit 83562
|
2016-11-05 16:42:19 +01:00
|
|
|
fi
|
|
|
|
|
2016-11-09 18:13:06 +01:00
|
|
|
if [ ! ${JITSI_DOMAIN_NAME} ]; then
|
|
|
|
echo $'No domain name was given for jitsi'
|
|
|
|
exit 47682
|
|
|
|
fi
|
2016-11-05 16:42:19 +01:00
|
|
|
|
2016-11-09 18:13:06 +01:00
|
|
|
if [ ! -d /etc/prosody ]; then
|
|
|
|
echo $'xmpp must be installed before installing jitsi'
|
|
|
|
exit 62394
|
2016-11-05 16:42:19 +01:00
|
|
|
fi
|
2016-11-09 18:13:06 +01:00
|
|
|
|
|
|
|
if [[ "${JITSI_DOMAIN_NAME}" == "${DEFAULT_DOMAIN_NAME}" ]]; then
|
|
|
|
echo $'The jitsi domain name should not be the same as the main domain name'
|
|
|
|
exit 78372
|
2016-11-05 16:42:19 +01:00
|
|
|
fi
|
|
|
|
|
2016-11-09 18:13:06 +01:00
|
|
|
# add jitsi repo
|
2016-11-09 22:34:35 +01:00
|
|
|
jitsi_deb_repo=binary
|
2016-11-09 23:31:08 +01:00
|
|
|
apt-get -yq install wget debconf-utils default-jre
|
2016-11-09 21:31:49 +01:00
|
|
|
install_nodejs jitsi
|
|
|
|
npm install -g browserify@13.1.1
|
2016-11-10 15:59:48 +01:00
|
|
|
if [ ! "$?" = "0" ]; then
|
|
|
|
remove_nodejs jitsi
|
|
|
|
exit 638352
|
|
|
|
fi
|
2016-11-09 20:45:04 +01:00
|
|
|
if ! grep "jitsi" /etc/apt/sources.list; then
|
|
|
|
echo "deb http://download.jitsi.org/nightly/deb ${jitsi_deb_repo}/" >> /etc/apt/sources.list
|
|
|
|
fi
|
2016-11-09 20:14:45 +01:00
|
|
|
wget -qO - https://download.jitsi.org/nightly/deb/${jitsi_deb_repo}/archive.key | apt-key add -
|
2016-11-09 18:13:06 +01:00
|
|
|
apt-get update
|
2016-11-05 16:42:19 +01:00
|
|
|
|
2016-11-09 18:13:06 +01:00
|
|
|
# create onion domains
|
|
|
|
create_jitsi_subdomains
|
2016-11-05 16:42:19 +01:00
|
|
|
|
2016-11-09 18:13:06 +01:00
|
|
|
# videobridge
|
2016-11-09 18:36:33 +01:00
|
|
|
if [[ $ONION_ONLY == 'no' ]]; then
|
|
|
|
debconf-set-selections <<< "jitsi-videobridge jitsi-videobridge/jvb-hostname string ${JITSI_DOMAIN_NAME}"
|
|
|
|
else
|
|
|
|
debconf-set-selections <<< "jitsi-videobridge jitsi-videobridge/jvb-hostname string ${JITSI_ONION_HOSTNAME}"
|
|
|
|
fi
|
2016-11-09 18:13:06 +01:00
|
|
|
apt-get -yq install jitsi-videobridge
|
|
|
|
if [ ! -d /etc/jitsi ]; then
|
|
|
|
echo $'Videobridge package failed to install'
|
|
|
|
exit 63983
|
|
|
|
fi
|
|
|
|
firewall_add videobridge ${VIDEOBRIDGE_PORT}
|
2016-11-10 11:20:11 +01:00
|
|
|
firewall_add_range jitsi 10000 20000 udp
|
2016-11-05 16:42:19 +01:00
|
|
|
|
2016-11-09 18:13:06 +01:00
|
|
|
# meet
|
2016-11-09 18:36:33 +01:00
|
|
|
debconf-set-selections <<< "jitsi-meet jitsi-meet/cert-choice multiselect 1"
|
|
|
|
apt-get -yq install jitsi-meet jitsi-meet-prosody
|
2016-11-05 16:42:19 +01:00
|
|
|
|
2016-11-09 23:31:08 +01:00
|
|
|
jitsi_nginx_site=/etc/nginx/sites-available/${JITSI_DOMAIN_NAME}.conf
|
2016-11-10 14:06:49 +01:00
|
|
|
echo 'server_names_hash_bucket_size 64;' > $jitsi_nginx_site
|
2016-11-05 16:42:19 +01:00
|
|
|
if [[ $ONION_ONLY == "no" ]]; then
|
2016-11-09 23:18:20 +01:00
|
|
|
echo '' >> $jitsi_nginx_site
|
2016-11-05 16:42:19 +01:00
|
|
|
echo 'server {' >> $jitsi_nginx_site
|
2016-11-10 13:44:21 +01:00
|
|
|
echo ' listen 80;' >> $jitsi_nginx_site
|
|
|
|
echo " server_name ${JITSI_DOMAIN_NAME};" >> $jitsi_nginx_site
|
|
|
|
echo ' return 301 https://$host$request_uri;' >> $jitsi_nginx_site
|
|
|
|
echo '}' >> $jitsi_nginx_site
|
|
|
|
echo 'server {' >> $jitsi_nginx_site
|
|
|
|
echo ' listen 443 ssl;' >> $jitsi_nginx_site
|
|
|
|
echo " server_name ${JITSI_DOMAIN_NAME};" >> $jitsi_nginx_site
|
2016-11-05 16:42:19 +01:00
|
|
|
echo '' >> $jitsi_nginx_site
|
2016-11-10 13:44:21 +01:00
|
|
|
echo ' ssl_protocols TLSv1 TLSv1.1 TLSv1.2;' >> $jitsi_nginx_site
|
|
|
|
echo ' ssl_prefer_server_ciphers on;' >> $jitsi_nginx_site
|
|
|
|
echo ' ssl_ciphers "EECDH+ECDSA+AESGCM:EECDH+aRSA+AESGCM:EECDH+ECDSA+SHA256:EECDH+aRSA+SHA256:EECDH+ECDSA+SHA384:EECDH+ECDSA+SHA256:EECDH+aRSA+SHA384:EDH+aRSA+AESGCM:EDH+aRSA+SHA256:EDH+aRSA:EECDH:!aNULL:!eNULL:!MEDIUM:!LOW:!3DES:!MD5:!EXP:!PSK:!SRP:!DSS:!RC4:!SEED";' >> $jitsi_nginx_site
|
|
|
|
echo '' >> $jitsi_nginx_site
|
|
|
|
echo ' add_header Strict-Transport-Security "max-age=31536000";' >> $jitsi_nginx_site
|
2016-11-05 16:42:19 +01:00
|
|
|
echo '' >> $jitsi_nginx_site
|
2016-11-10 13:44:21 +01:00
|
|
|
echo " ssl_certificate /etc/ssl/certs/${JITSI_DOMAIN_NAME}.crt;" >> $jitsi_nginx_site
|
|
|
|
echo " ssl_certificate_key /etc/ssl/private/${JITSI_DOMAIN_NAME}.key;" >> $jitsi_nginx_site
|
|
|
|
echo " ssl_dhparam /etc/ssl/certs/${JITSI_DOMAIN_NAME}.dhparam;" >> $jitsi_nginx_site
|
2016-11-05 16:42:19 +01:00
|
|
|
echo '' >> $jitsi_nginx_site
|
2016-11-10 13:44:21 +01:00
|
|
|
echo ' root /usr/share/jitsi-meet;' >> $jitsi_nginx_site
|
|
|
|
echo ' index index.html index.htm;' >> $jitsi_nginx_site
|
2016-11-05 16:42:19 +01:00
|
|
|
echo '' >> $jitsi_nginx_site
|
2016-11-10 13:44:21 +01:00
|
|
|
echo ' location /config.js {' >> $jitsi_nginx_site
|
2016-11-10 13:45:25 +01:00
|
|
|
echo " alias /etc/jitsi/meet/${JITSI_DOMAIN_NAME}-config.js;" >> $jitsi_nginx_site
|
2016-11-10 13:44:21 +01:00
|
|
|
echo ' }' >> $jitsi_nginx_site
|
2016-11-09 20:14:45 +01:00
|
|
|
echo '' >> $jitsi_nginx_site
|
2016-11-10 13:44:21 +01:00
|
|
|
echo ' location ~ ^/([a-zA-Z0-9=\?]+)$ {' >> $jitsi_nginx_site
|
|
|
|
echo ' rewrite ^/(.*)$ / break;' >> $jitsi_nginx_site
|
|
|
|
echo ' }' >> $jitsi_nginx_site
|
2016-11-05 16:42:19 +01:00
|
|
|
echo '' >> $jitsi_nginx_site
|
2016-11-10 13:44:21 +01:00
|
|
|
echo ' location / {' >> $jitsi_nginx_site
|
|
|
|
echo ' ssi on;' >> $jitsi_nginx_site
|
|
|
|
echo ' }' >> $jitsi_nginx_site
|
2016-11-05 16:42:19 +01:00
|
|
|
echo '' >> $jitsi_nginx_site
|
2016-11-10 13:44:21 +01:00
|
|
|
echo ' # Backward compatibility' >> $jitsi_nginx_site
|
|
|
|
echo ' location ~ /external_api.* {' >> $jitsi_nginx_site
|
|
|
|
echo ' root /usr/share/jitsi-meet/libs;' >> $jitsi_nginx_site
|
|
|
|
echo ' }' >> $jitsi_nginx_site
|
2016-11-05 16:42:19 +01:00
|
|
|
echo '' >> $jitsi_nginx_site
|
2016-11-10 14:52:06 +01:00
|
|
|
echo ' # Logs' >> $jitsi_nginx_site
|
|
|
|
echo ' access_log /dev/null;' >> $jitsi_nginx_site
|
2016-11-10 15:17:15 +01:00
|
|
|
echo ' error_log /var/lof/nginx/jitsi_error.log warn;' >> $jitsi_nginx_site
|
2016-11-10 14:32:57 +01:00
|
|
|
echo '' >> $jitsi_nginx_site
|
2016-11-10 13:44:21 +01:00
|
|
|
echo ' # BOSH' >> $jitsi_nginx_site
|
|
|
|
echo ' location /http-bind {' >> $jitsi_nginx_site
|
|
|
|
echo ' proxy_pass http://localhost:5280/http-bind;' >> $jitsi_nginx_site
|
|
|
|
echo ' proxy_set_header X-Forwarded-For $remote_addr;' >> $jitsi_nginx_site
|
|
|
|
echo ' proxy_set_header Host $http_host;' >> $jitsi_nginx_site
|
|
|
|
echo ' }' >> $jitsi_nginx_site
|
2016-11-05 16:42:19 +01:00
|
|
|
echo '}' >> $jitsi_nginx_site
|
|
|
|
fi
|
2016-11-10 14:06:49 +01:00
|
|
|
echo '' >> $jitsi_nginx_site
|
2016-11-05 16:42:19 +01:00
|
|
|
echo 'server {' >> $jitsi_nginx_site
|
|
|
|
echo " listen 127.0.0.1:$JITSI_ONION_PORT default_server;" >> $jitsi_nginx_site
|
2016-11-09 14:15:48 +01:00
|
|
|
if [[ $ONION_ONLY == 'no' ]]; then
|
|
|
|
echo " server_name ${JITSI_DOMAIN_NAME};" >> $jitsi_nginx_site
|
|
|
|
else
|
|
|
|
echo " server_name ${JITSI_ONION_HOSTNAME};" >> $jitsi_nginx_site
|
|
|
|
fi
|
2016-11-05 16:42:19 +01:00
|
|
|
echo '' >> $jitsi_nginx_site
|
2016-11-10 13:44:21 +01:00
|
|
|
echo ' root /usr/share/jitsi-meet;' >> $jitsi_nginx_site
|
|
|
|
echo ' index index.html index.htm;' >> $jitsi_nginx_site
|
2016-11-05 16:42:19 +01:00
|
|
|
echo '' >> $jitsi_nginx_site
|
2016-11-10 13:44:21 +01:00
|
|
|
echo ' location /config.js {' >> $jitsi_nginx_site
|
2016-11-10 13:45:25 +01:00
|
|
|
echo " alias /etc/jitsi/meet/${JITSI_DOMAIN_NAME}-config.js;" >> $jitsi_nginx_site
|
2016-11-10 13:44:21 +01:00
|
|
|
echo ' }' >> $jitsi_nginx_site
|
2016-11-05 16:42:19 +01:00
|
|
|
echo '' >> $jitsi_nginx_site
|
2016-11-10 13:44:21 +01:00
|
|
|
echo ' location ~ ^/([a-zA-Z0-9=\?]+)$ {' >> $jitsi_nginx_site
|
|
|
|
echo ' rewrite ^/(.*)$ / break;' >> $jitsi_nginx_site
|
|
|
|
echo ' }' >> $jitsi_nginx_site
|
2016-11-05 16:42:19 +01:00
|
|
|
echo '' >> $jitsi_nginx_site
|
2016-11-10 13:44:21 +01:00
|
|
|
echo ' location / {' >> $jitsi_nginx_site
|
|
|
|
echo ' ssi off;' >> $jitsi_nginx_site
|
|
|
|
echo ' }' >> $jitsi_nginx_site
|
2016-11-09 20:14:45 +01:00
|
|
|
echo '' >> $jitsi_nginx_site
|
2016-11-10 13:44:21 +01:00
|
|
|
echo ' # Backward compatibility' >> $jitsi_nginx_site
|
|
|
|
echo ' location ~ /external_api.* {' >> $jitsi_nginx_site
|
|
|
|
echo ' root /usr/share/jitsi-meet/libs;' >> $jitsi_nginx_site
|
|
|
|
echo ' }' >> $jitsi_nginx_site
|
2016-11-05 16:42:19 +01:00
|
|
|
echo '' >> $jitsi_nginx_site
|
2016-11-10 14:52:06 +01:00
|
|
|
echo ' # Logs' >> $jitsi_nginx_site
|
|
|
|
echo ' access_log /dev/null;' >> $jitsi_nginx_site
|
2016-11-10 17:06:58 +01:00
|
|
|
echo ' error_log /var/log/nginx/jitsi_error.log warn;' >> $jitsi_nginx_site
|
2016-11-10 14:32:57 +01:00
|
|
|
echo '' >> $jitsi_nginx_site
|
2016-11-10 13:44:21 +01:00
|
|
|
echo ' # BOSH' >> $jitsi_nginx_site
|
|
|
|
echo ' location /http-bind {' >> $jitsi_nginx_site
|
|
|
|
echo ' proxy_pass http://localhost:5280/http-bind;' >> $jitsi_nginx_site
|
|
|
|
echo ' proxy_set_header X-Forwarded-For $remote_addr;' >> $jitsi_nginx_site
|
|
|
|
echo ' proxy_set_header Host $http_host;' >> $jitsi_nginx_site
|
|
|
|
echo ' }' >> $jitsi_nginx_site
|
2016-11-05 16:42:19 +01:00
|
|
|
echo '}' >> $jitsi_nginx_site
|
|
|
|
|
2016-11-10 13:44:21 +01:00
|
|
|
sed -i "s|server_name ${JITSI_DOMAIN_NAME}.conf|server_name ${JITSI_DOMAIN_NAME}|g" $jitsi_nginx_site
|
|
|
|
sed -i "s|/var/www/${JITSI_DOMAIN_NAME}.conf/htdocs|/usr/share/jitsi-meet|g" $jitsi_nginx_site
|
|
|
|
|
2016-11-09 19:08:56 +01:00
|
|
|
if [ ! -f /etc/ssl/certs/${JITSI_DOMAIN_NAME}.pem ]; then
|
|
|
|
function_check create_site_certificate
|
|
|
|
create_site_certificate ${JITSI_DOMAIN_NAME} 'yes'
|
|
|
|
fi
|
2016-11-05 16:42:19 +01:00
|
|
|
|
|
|
|
if [ -f /etc/ssl/certs/${JITSI_DOMAIN_NAME}.crt ]; then
|
|
|
|
mv /etc/ssl/certs/${JITSI_DOMAIN_NAME}.crt /etc/ssl/certs/${JITSI_DOMAIN_NAME}.pem
|
|
|
|
fi
|
2016-11-09 18:13:06 +01:00
|
|
|
|
2016-11-10 16:51:02 +01:00
|
|
|
# ensure that certs are available to prosody with correct permissions
|
|
|
|
cp /etc/ssl/certs/${JITSI_DOMAIN_NAME}.* /etc/prosody/certs
|
|
|
|
cp /etc/ssl/private/${JITSI_DOMAIN_NAME}.key /etc/prosody/certs
|
|
|
|
chown prosody:prosody /etc/prosody/certs/${JITSI_DOMAIN_NAME}.*
|
|
|
|
|
2016-11-09 18:20:32 +01:00
|
|
|
if [ -f /etc/ssl/certs/${JITSI_DOMAIN_NAME}.pem ]; then
|
|
|
|
sed -i "s|.crt|.pem|g" $jitsi_nginx_site
|
2016-11-09 19:23:50 +01:00
|
|
|
sed -i "s|.crt|.pem|g" /etc/prosody/conf.d/${JITSI_DOMAIN_NAME}.cfg.lua
|
2016-11-09 18:20:32 +01:00
|
|
|
fi
|
2016-11-10 16:51:02 +01:00
|
|
|
|
|
|
|
sed -i "s|key =.*|key = \"/etc/prosody/certs/${JITSI_DOMAIN_NAME}.key\"|g" /etc/prosody/conf.avail/${JITSI_DOMAIN_NAME}.cfg.lua
|
|
|
|
sed -i "s|certificate =.*|certificate = \"/etc/prosody/certs/${JITSI_DOMAIN_NAME}.pem\"|g" /etc/prosody/conf.avail/${JITSI_DOMAIN_NAME}.cfg.lua
|
|
|
|
|
2016-11-10 11:34:01 +01:00
|
|
|
sed -i "s|.conf.crt|.crt|g" /etc/nginx/sites-available/${JITSI_DOMAIN_NAME}.conf
|
|
|
|
sed -i "s|.conf.pem|.pem|g" /etc/nginx/sites-available/${JITSI_DOMAIN_NAME}.conf
|
|
|
|
sed -i "s|.conf.key|.key|g" /etc/nginx/sites-available/${JITSI_DOMAIN_NAME}.conf
|
|
|
|
sed -i "s|.conf.dhparam|.dhparam|g" /etc/nginx/sites-available/${JITSI_DOMAIN_NAME}.conf
|
2016-11-09 18:20:32 +01:00
|
|
|
|
2016-11-05 16:42:19 +01:00
|
|
|
function_check nginx_ensite
|
2016-11-09 23:31:08 +01:00
|
|
|
nginx_ensite ${JITSI_DOMAIN_NAME}.conf
|
2016-11-05 16:42:19 +01:00
|
|
|
|
|
|
|
set_completion_param "jitsi domain" "$JITSI_DOMAIN_NAME"
|
|
|
|
|
|
|
|
systemctl restart nginx
|
2016-11-09 19:23:50 +01:00
|
|
|
systemctl restart prosody
|
2016-11-05 16:42:19 +01:00
|
|
|
|
2016-11-06 15:13:00 +01:00
|
|
|
function_check add_ddns_domain
|
|
|
|
add_ddns_domain $JITSI_DOMAIN_NAME
|
|
|
|
|
2016-11-05 16:42:19 +01:00
|
|
|
APP_INSTALLED=1
|
|
|
|
}
|