2018-09-25 08:25:32 +00:00
|
|
|
#!/bin/bash
|
|
|
|
# Quick Jibri Installer - *buntu 16.04 (LTS) based systems.
|
|
|
|
# SwITNet Ltd © - 2018, https://switnet.net/
|
|
|
|
# GPLv3 or later.
|
|
|
|
|
|
|
|
# SYSTEM SETUP
|
|
|
|
JITSI_UNS_REPO=$(apt-cache policy | grep http | grep jitsi | grep unstable | awk '{print $3}' | head -n 1 | cut -d "/" -f 1)
|
|
|
|
CERTBOT_REPO=$(apt-cache policy | grep http | grep certbot | head -n 1 | awk '{print $2}' | cut -d "/" -f 4)
|
|
|
|
APACHE_2=$(dpkg-query -W -f='${Status}' apache2 2>/dev/null | grep -c "ok installed")
|
|
|
|
NGINX=$(dpkg-query -W -f='${Status}' nginx 2>/dev/null | grep -c "ok installed")
|
|
|
|
DIST=$(lsb_release -sc)
|
|
|
|
GOOGL_REPO="/etc/apt/sources.list.d/dl_google_com_linux_chrome_deb.list"
|
|
|
|
|
|
|
|
if [ $DIST = flidas ]; then
|
|
|
|
DIST="xenial"
|
|
|
|
fi
|
2019-04-01 20:29:03 +00:00
|
|
|
install_ifnot() {
|
|
|
|
if [ "$(dpkg-query -W -f='${Status}' $1 2>/dev/null | grep -c "ok installed")" == "1" ]; then
|
|
|
|
echo " $1 is installed, skipping..."
|
|
|
|
else
|
|
|
|
echo -e "\n---- Installing $1 ----"
|
|
|
|
apt -yqq install $1
|
|
|
|
fi
|
|
|
|
}
|
2018-09-25 08:25:32 +00:00
|
|
|
check_serv() {
|
|
|
|
if [ "$APACHE_2" -eq 1 ] || [ "$NGINX" -eq 1 ]; then
|
|
|
|
echo "
|
|
|
|
Webserver already installed!
|
|
|
|
"
|
2019-03-04 12:31:34 +00:00
|
|
|
elif [ "$APACHE_2" -eq 1 ] && [ "$NGINX" -eq 0 ]; then
|
|
|
|
|
2019-04-02 05:15:11 +00:00
|
|
|
echo "
|
|
|
|
Apache webserver already installed!
|
|
|
|
"
|
2019-03-04 12:31:34 +00:00
|
|
|
|
2018-09-25 08:25:32 +00:00
|
|
|
else
|
|
|
|
echo "
|
|
|
|
Installing nginx as webserver!
|
|
|
|
"
|
2019-04-02 05:15:11 +00:00
|
|
|
install_ifnot nginx
|
2018-09-25 08:25:32 +00:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
check_snd_driver() {
|
|
|
|
modprobe snd-aloop
|
|
|
|
echo "snd-aloop" >> /etc/modules
|
|
|
|
if [ "$(lsmod | grep snd_aloop | head -n 1 | cut -d " " -f1)" = "snd_aloop" ]; then
|
|
|
|
echo "Audio driver seems ok."
|
|
|
|
else
|
|
|
|
echo "Seems to be an issue with your audio driver, please fix this before continue."
|
2019-06-28 12:00:06 +00:00
|
|
|
#exit
|
2018-09-25 08:25:32 +00:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
update_certbot() {
|
|
|
|
if [ "$CERTBOT_REPO" = "certbot" ]; then
|
|
|
|
echo "
|
|
|
|
Cerbot repository already on the system!
|
|
|
|
Checking for updates...
|
|
|
|
"
|
|
|
|
apt -qq update
|
|
|
|
apt -yqq dist-upgrade
|
|
|
|
else
|
|
|
|
echo "
|
|
|
|
Adding cerbot (formerly letsencrypt) PPA repository for latest updates
|
|
|
|
"
|
|
|
|
echo "deb http://ppa.launchpad.net/certbot/certbot/ubuntu $DIST main" > /etc/apt/sources.list.d/certbot.list
|
|
|
|
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 75BCA694
|
|
|
|
apt -qq update
|
|
|
|
apt -yqq dist-upgrade
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
clear
|
|
|
|
echo '
|
|
|
|
########################################################################
|
|
|
|
Welcome to Jitsi/Jibri Installer
|
|
|
|
########################################################################
|
|
|
|
by Software, IT & Networks Ltd
|
|
|
|
'
|
|
|
|
|
|
|
|
# Check correct user (sudo or root)
|
|
|
|
if [ "$EUID" == 0 ]
|
|
|
|
then echo "Ok, you have superuser powers"
|
|
|
|
else
|
|
|
|
echo "You should run it with root or sudo permissions."
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Jitsi-Meet Repo
|
|
|
|
echo "Add Jitsi key"
|
|
|
|
if [ "$JITSI_UNS_REPO" = "unstable" ]; then
|
|
|
|
echo "Jitsi unstable repository already installed"
|
|
|
|
else
|
|
|
|
echo 'deb https://download.jitsi.org unstable/' > /etc/apt/sources.list.d/jitsi-unstable.list
|
|
|
|
wget -qO - https://download.jitsi.org/jitsi-key.gpg.key | apt-key add -
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Requirements
|
|
|
|
echo "We'll start by installing system requirements this may take a while please be patient..."
|
|
|
|
apt update -yq2
|
|
|
|
apt dist-upgrade -yq2
|
|
|
|
apt -yqq install \
|
|
|
|
bmon \
|
|
|
|
curl \
|
|
|
|
ffmpeg \
|
|
|
|
git \
|
|
|
|
htop \
|
2019-03-04 12:31:34 +00:00
|
|
|
letsencrypt \
|
2018-09-25 08:25:32 +00:00
|
|
|
linux-image-extra-virtual \
|
|
|
|
unzip \
|
|
|
|
wget
|
|
|
|
check_serv
|
|
|
|
|
|
|
|
echo "
|
2018-10-05 15:00:57 +00:00
|
|
|
#--------------------------------------------------
|
|
|
|
# Install Jitsi Framework
|
|
|
|
#--------------------------------------------------
|
2018-09-25 08:25:32 +00:00
|
|
|
"
|
|
|
|
apt -yqq install \
|
|
|
|
jitsi-meet \
|
|
|
|
jibri
|
|
|
|
|
2018-10-05 15:00:57 +00:00
|
|
|
echo "
|
|
|
|
#--------------------------------------------------
|
|
|
|
# Install NodeJS
|
|
|
|
#--------------------------------------------------
|
|
|
|
"
|
|
|
|
if [ "$(dpkg-query -W -f='${Status}' nodejs 2>/dev/null | grep -c "ok")" == "1" ]; then
|
|
|
|
echo "Nodejs is installed, skipping..."
|
|
|
|
else
|
|
|
|
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
|
|
|
|
apt install -yqq nodejs
|
|
|
|
npm install -g esprima
|
|
|
|
fi
|
|
|
|
|
2018-09-25 08:25:32 +00:00
|
|
|
# ALSA - Loopback
|
|
|
|
echo "snd-aloop" | tee -a /etc/modules
|
|
|
|
check_snd_driver
|
2019-02-25 04:10:26 +00:00
|
|
|
CHD_VER=$(curl -sL https://chromedriver.storage.googleapis.com/LATEST_RELEASE)
|
2018-09-25 08:25:32 +00:00
|
|
|
echo "# Installing Google Chrome / ChromeDriver"
|
|
|
|
if [ -f $GOOGL_REPO ]; then
|
|
|
|
echo "Google repository already set."
|
|
|
|
else
|
|
|
|
echo "Installing Google Chrome Stable"
|
|
|
|
wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | apt-key add -
|
|
|
|
echo "deb http://dl.google.com/linux/chrome/deb/ stable main" | tee $GOOGL_REPO
|
|
|
|
fi
|
|
|
|
apt -qq update
|
|
|
|
apt install -yqq google-chrome-stable
|
|
|
|
rm -rf /etc/apt/sources.list.d/dl_google_com_linux_chrome_deb.list
|
|
|
|
|
|
|
|
if [ -f /usr/local/bin/chromedriver ]; then
|
|
|
|
echo "Chromedriver already installed."
|
|
|
|
else
|
|
|
|
echo "Installing Chromedriver"
|
|
|
|
wget https://chromedriver.storage.googleapis.com/$CHD_VER/chromedriver_linux64.zip -O /tmp/chromedriver_linux64.zip
|
|
|
|
unzip /tmp/chromedriver_linux64.zip -d /usr/local/bin/
|
|
|
|
chown root:root /usr/local/bin/chromedriver
|
|
|
|
chmod 0755 /usr/local/bin/chromedriver
|
|
|
|
rm -rf /tpm/chromedriver_linux64.zip
|
|
|
|
fi
|
|
|
|
|
2019-03-04 12:31:34 +00:00
|
|
|
echo "
|
|
|
|
Check Google Software Working...
|
|
|
|
"
|
2018-09-25 08:25:32 +00:00
|
|
|
/usr/bin/google-chrome --version
|
2019-03-04 12:31:34 +00:00
|
|
|
/usr/local/bin/chromedriver --version | awk '{print$1,$2}'
|
2018-09-25 08:25:32 +00:00
|
|
|
|
|
|
|
echo '
|
|
|
|
########################################################################
|
|
|
|
Starting Jibri configuration
|
|
|
|
########################################################################
|
|
|
|
'
|
|
|
|
# MEET / JIBRI SETUP
|
2019-03-04 12:31:34 +00:00
|
|
|
DOMAIN=$(ls /etc/prosody/conf.d/ | grep -v localhost | cut -d "." -f "1-3")
|
2018-09-25 08:25:32 +00:00
|
|
|
JB_AUTH_PASS_FILE=/var/JB_AUTH_PASS.txt
|
|
|
|
JB_REC_PASS_FILE=/var/JB_REC_PASS.txt
|
|
|
|
PROSODY_FILE=/etc/prosody/conf.d/$DOMAIN.cfg.lua
|
|
|
|
JICOFO_SIP=/etc/jitsi/jicofo/sip-communicator.properties
|
|
|
|
MEET_CONF=/etc/jitsi/meet/$DOMAIN-config.js
|
|
|
|
CONF_JSON=/etc/jitsi/jibri/config.json
|
|
|
|
DIR_RECORD=/tmp/recordings
|
|
|
|
REC_DIR=/home/jibri/finalize_recording.sh
|
|
|
|
JB_NAME="Jibri Sessions"
|
|
|
|
read -p "Jibri internal.auth.$DOMAIN password: "$'\n' -sr JB_AUTH_PASS
|
|
|
|
read -p "Jibri recorder.$DOMAIN password: "$'\n' -sr JB_REC_PASS
|
2019-03-04 12:31:34 +00:00
|
|
|
read -p "Set sysadmin email: "$'\n' -r SYSADMIN_EMAIL
|
2018-10-05 15:00:57 +00:00
|
|
|
while [[ $ENABLE_DB != yes && $ENABLE_DB != no ]]
|
|
|
|
do
|
2019-04-01 20:29:03 +00:00
|
|
|
read -p "Do you want to setup the Dropbox feature now: (yes or no)"$'\n' -r ENABLE_DB
|
2018-10-05 15:00:57 +00:00
|
|
|
if [ $ENABLE_DB = no ]; then
|
|
|
|
echo "Dropbox won't be enable"
|
|
|
|
elif [ $ENABLE_DB = yes ]; then
|
|
|
|
read -p "Please set your Drobbox App key: "$'\n' -r DB_CID
|
|
|
|
fi
|
|
|
|
done
|
2018-09-25 08:25:32 +00:00
|
|
|
while [[ $ENABLE_SSL != yes && $ENABLE_SSL != no ]]
|
|
|
|
do
|
2018-10-05 15:00:57 +00:00
|
|
|
read -p "Do you want to setup LetsEncrypt with your domain: (yes or no)"$'\n' -r ENABLE_SSL
|
2018-09-25 08:25:32 +00:00
|
|
|
if [ $ENABLE_SSL = no ]; then
|
|
|
|
echo "Please run letsencrypt.sh manually post-installation."
|
|
|
|
elif [ $ENABLE_SSL = yes ]; then
|
|
|
|
echo "SSL will be enabled."
|
|
|
|
fi
|
|
|
|
done
|
2019-03-04 12:31:34 +00:00
|
|
|
|
2018-09-25 08:25:32 +00:00
|
|
|
echo "$JB_AUTH_PASS" > $JB_AUTH_PASS_FILE
|
|
|
|
chmod 600 $JB_AUTH_PASS_FILE
|
|
|
|
echo "$JB_REC_PASS" > $JB_REC_PASS_FILE
|
|
|
|
chmod 600 $JB_REC_PASS_FILE
|
|
|
|
JibriBrewery=JibriBrewery
|
|
|
|
INT_CONF=/usr/share/jitsi-meet/interface_config.js
|
|
|
|
WAN_IP=$(dig +short myip.opendns.com @resolver1.opendns.com)
|
|
|
|
|
2019-03-04 12:31:34 +00:00
|
|
|
ssl_wa() {
|
|
|
|
service $1 stop
|
2019-04-02 05:15:11 +00:00
|
|
|
letsencrypt certonly --standalone --renew-by-default --agree-tos --email $5 -d $6
|
|
|
|
sed -i "s|/etc/jitsi/meet/$3.crt|/etc/letsencrypt/live/$3/fullchain.pem|" $4
|
|
|
|
sed -i "s|/etc/jitsi/meet/$3.key|/etc/letsencrypt/live/$3/privkey.pem|" $4
|
2019-03-04 12:31:34 +00:00
|
|
|
service $1 restart
|
|
|
|
#Add cron
|
|
|
|
crontab -l | { cat; echo "@weekly certbot renew --${2}"; } | crontab -
|
|
|
|
crontab -l
|
|
|
|
}
|
|
|
|
|
2018-09-25 08:25:32 +00:00
|
|
|
enable_letsencrypt() {
|
2018-11-05 04:54:08 +00:00
|
|
|
if [ "$ENABLE_SSL" = "yes" ]; then
|
2018-09-25 08:25:32 +00:00
|
|
|
echo '
|
|
|
|
########################################################################
|
|
|
|
Starting LetsEncrypt configuration
|
|
|
|
########################################################################
|
|
|
|
'
|
2019-03-04 12:31:34 +00:00
|
|
|
#Disabled 'til fixed upstream
|
|
|
|
#bash /usr/share/jitsi-meet/scripts/install-letsencrypt-cert.sh
|
|
|
|
|
2018-09-25 08:25:32 +00:00
|
|
|
update_certbot
|
2019-03-04 12:31:34 +00:00
|
|
|
|
2018-09-25 08:25:32 +00:00
|
|
|
else
|
|
|
|
echo "SSL setup will be skipped."
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
check_jibri() {
|
|
|
|
if [ "$(dpkg-query -W -f='${Status}' "jibri" 2>/dev/null | grep -c "ok installed")" == "1" ]
|
|
|
|
then
|
|
|
|
service jibri restart
|
|
|
|
service jibri-icewm restart
|
|
|
|
service jibri-xorg restart
|
|
|
|
else
|
|
|
|
echo "Jibri service not installed"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
# Restarting services
|
|
|
|
restart_services() {
|
|
|
|
service jitsi-videobridge restart
|
|
|
|
service jicofo restart
|
|
|
|
service prosody restart
|
2019-02-25 04:10:26 +00:00
|
|
|
check_jibri
|
2018-09-25 08:25:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# Configure Jibri
|
|
|
|
## PROSODY
|
|
|
|
cat << MUC-JIBRI >> $PROSODY_FILE
|
|
|
|
|
|
|
|
-- internal muc component, meant to enable pools of jibri and jigasi clients
|
|
|
|
Component "internal.auth.$DOMAIN" "muc"
|
|
|
|
modules_enabled = {
|
|
|
|
"ping";
|
|
|
|
}
|
|
|
|
storage = "null"
|
|
|
|
muc_room_cache_size = 1000
|
|
|
|
|
|
|
|
MUC-JIBRI
|
|
|
|
|
|
|
|
cat << REC-JIBRI >> $PROSODY_FILE
|
|
|
|
|
|
|
|
VirtualHost "recorder.$DOMAIN"
|
|
|
|
modules_enabled = {
|
|
|
|
"ping";
|
|
|
|
}
|
|
|
|
authentication = "internal_plain"
|
|
|
|
|
|
|
|
REC-JIBRI
|
|
|
|
|
|
|
|
### Prosody users
|
|
|
|
prosodyctl register jibri auth.$DOMAIN $JB_AUTH_PASS
|
|
|
|
prosodyctl register recorder recorder.$DOMAIN $JB_REC_PASS
|
|
|
|
|
|
|
|
## JICOFO
|
|
|
|
# /etc/jitsi/jicofo/sip-communicator.properties
|
|
|
|
cat << BREWERY >> $JICOFO_SIP
|
2019-04-05 06:14:57 +00:00
|
|
|
#org.jitsi.jicofo.auth.URL=XMPP:$DOMAIN
|
2018-09-25 08:25:32 +00:00
|
|
|
org.jitsi.jicofo.jibri.BREWERY=$JibriBrewery@internal.auth.$DOMAIN
|
|
|
|
org.jitsi.jicofo.jibri.PENDING_TIMEOUT=90
|
2019-04-01 20:29:03 +00:00
|
|
|
#org.jitsi.jicofo.auth.DISABLE_AUTOLOGIN=true
|
2018-09-25 08:25:32 +00:00
|
|
|
BREWERY
|
|
|
|
|
|
|
|
# Jibri tweaks for /etc/jitsi/meet/$DOMAIN-config.js
|
2019-02-25 04:10:26 +00:00
|
|
|
sed -i "s|// anonymousdomain: 'guest.example.com'|anonymousdomain: \'guest.$DOMAIN\'|" $MEET_CONF
|
2018-09-25 08:25:32 +00:00
|
|
|
sed -i "s|conference.$DOMAIN|internal.auth.$DOMAIN|" $MEET_CONF
|
|
|
|
sed -i "s|// fileRecordingsEnabled: false,|fileRecordingsEnabled: true,| " $MEET_CONF
|
|
|
|
sed -i "s|// liveStreamingEnabled: false,|liveStreamingEnabled: true,\\
|
|
|
|
\\
|
2018-10-05 15:00:57 +00:00
|
|
|
hiddenDomain: \'recorder.$DOMAIN\',|" $MEET_CONF
|
|
|
|
|
|
|
|
#Dropbox feature
|
|
|
|
if [ $ENABLE_DB = "yes" ]; then
|
|
|
|
DB_STR=$(grep -n "dropbox:" $MEET_CONF | cut -d ":" -f1)
|
2019-04-02 16:33:33 +00:00
|
|
|
DB_END=$((DB_STR + 10))
|
2018-10-05 15:00:57 +00:00
|
|
|
sed -i "$DB_STR,$DB_END{s|// dropbox: {|dropbox: {|}" $MEET_CONF
|
|
|
|
sed -i "$DB_STR,$DB_END{s|// appKey: '<APP_KEY>'|appKey: \'$DB_CID\'|}" $MEET_CONF
|
|
|
|
sed -i "$DB_STR,$DB_END{s|// },|},|}" $MEET_CONF
|
|
|
|
fi
|
2018-09-25 08:25:32 +00:00
|
|
|
|
|
|
|
#LocalRecording
|
|
|
|
echo "# Enabling local recording (audio only)."
|
2018-10-05 15:00:57 +00:00
|
|
|
DI_STR=$(grep -n "deploymentInfo:" $MEET_CONF | cut -d ":" -f1)
|
|
|
|
DI_END=$((DI_STR + 6))
|
|
|
|
sed -i "$DI_STR,$DI_END{s|}|},|}" $MEET_CONF
|
|
|
|
LR_STR=$(grep -n "// Local Recording" $MEET_CONF | cut -d ":" -f1)
|
|
|
|
LR_END=$((LR_STR + 18))
|
|
|
|
sed -i "$LR_STR,$LR_END{s|// localRecording: {|localRecording: {|}" $MEET_CONF
|
|
|
|
sed -i "$LR_STR,$LR_END{s|// enabled: true,|enabled: true,|}" $MEET_CONF
|
|
|
|
sed -i "$LR_STR,$LR_END{s|// format: 'flac'|format: 'flac'|}" $MEET_CONF
|
|
|
|
sed -i "$LR_STR,$LR_END{s|// }|}|}" $MEET_CONF
|
2018-09-25 08:25:32 +00:00
|
|
|
|
|
|
|
sed -i "s|'tileview'|'tileview', 'localrecording'|" $INT_CONF
|
|
|
|
#EOLR
|
|
|
|
|
2018-10-05 15:00:57 +00:00
|
|
|
#Check config file
|
|
|
|
echo "
|
|
|
|
# Checking $MEET_CONF file for errors
|
|
|
|
"
|
|
|
|
CHECKJS=$(esvalidate $MEET_CONF| cut -d ":" -f2)
|
2018-10-24 10:03:05 +00:00
|
|
|
if [[ -z "$CHECKJS" ]]; then
|
2018-10-05 15:00:57 +00:00
|
|
|
echo "
|
|
|
|
# The $MEET_CONF configuration seems correct. =)
|
|
|
|
"
|
|
|
|
else
|
|
|
|
echo "
|
|
|
|
Watch out!, there seems to be an issue on $MEET_CONF line:
|
|
|
|
$CHECKJS
|
|
|
|
Most of the times this is due upstream changes, please report to
|
|
|
|
https://github.com/switnet-ltd/quick-jibri-installer/issues
|
|
|
|
"
|
|
|
|
fi
|
|
|
|
|
2018-09-25 08:25:32 +00:00
|
|
|
# Recording directory
|
|
|
|
cat << REC_DIR > $REC_DIR
|
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
RECORDINGS_DIR=$1
|
|
|
|
|
|
|
|
echo "This is a dummy finalize script" > /tmp/finalize.out
|
|
|
|
echo "The script was invoked with recordings directory $RECORDINGS_DIR." >> /tmp/finalize.out
|
|
|
|
echo "You should put any finalize logic (renaming, uploading to a service" >> /tmp/finalize.out
|
|
|
|
echo "or storage provider, etc.) in this script" >> /tmp/finalize.out
|
|
|
|
|
|
|
|
exit 0
|
|
|
|
REC_DIR
|
|
|
|
|
|
|
|
## JSON Config
|
2019-03-04 12:31:34 +00:00
|
|
|
cp $CONF_JSON $CONF_JSON.orig
|
2018-09-25 08:25:32 +00:00
|
|
|
cat << CONF_JSON > $CONF_JSON
|
|
|
|
{
|
|
|
|
"recording_directory":"$DIR_RECORD",
|
|
|
|
"finalize_recording_script_path": "$REC_DIR",
|
|
|
|
"xmpp_environments": [
|
|
|
|
{
|
|
|
|
"name": "$JB_NAME",
|
|
|
|
"xmpp_server_hosts": [
|
|
|
|
"$WAN_IP"
|
|
|
|
],
|
|
|
|
"xmpp_domain": "$DOMAIN",
|
|
|
|
"control_login": {
|
|
|
|
"domain": "auth.$DOMAIN",
|
|
|
|
"username": "jibri",
|
|
|
|
"password": "$JB_AUTH_PASS"
|
|
|
|
},
|
|
|
|
"control_muc": {
|
|
|
|
"domain": "internal.auth.$DOMAIN",
|
|
|
|
"room_name": "$JibriBrewery",
|
|
|
|
"nickname": "Live"
|
|
|
|
},
|
|
|
|
"call_login": {
|
|
|
|
"domain": "recorder.$DOMAIN",
|
|
|
|
"username": "recorder",
|
|
|
|
"password": "$JB_REC_PASS"
|
|
|
|
},
|
|
|
|
|
|
|
|
"room_jid_domain_string_to_strip_from_start": "internal.auth",
|
|
|
|
"usage_timeout": "0"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
CONF_JSON
|
|
|
|
|
2019-02-25 04:10:26 +00:00
|
|
|
#Tune webserver for Jitsi App control
|
2018-11-06 04:43:41 +00:00
|
|
|
if [ -f /etc/apache2/sites-available/$DOMAIN.conf ]; then
|
|
|
|
WS_CONF=/etc/apache2/sites-available/$DOMAIN.conf
|
|
|
|
sed -i '$ d' $WS_CONF
|
|
|
|
cat << NG_APP >> $WS_CONF
|
|
|
|
|
|
|
|
Alias "/external_api.js" "/usr/share/jitsi-meet/libs/external_api.min.js"
|
|
|
|
Alias "/external_api.min.js" "/usr/share/jitsi-meet/libs/external_api.min.js"
|
|
|
|
|
|
|
|
</VirtualHost>
|
|
|
|
NG_APP
|
|
|
|
service apache2 reload
|
|
|
|
elif [ -f /etc/nginx/sites-available/$DOMAIN.conf ]; then
|
2019-06-28 07:28:11 +00:00
|
|
|
WS_CONF=/etc/nginx/sites-enabled/$DOMAIN.conf
|
|
|
|
WS_STR=$(grep -n "external_api.js" $WS_CONF | cut -d ":" -f1)
|
|
|
|
WS_END=$((WS_STR + 2))
|
|
|
|
sed -i "${WS_STR},${WS_END} s|^|#|" $WS_CONF
|
2018-11-06 04:43:41 +00:00
|
|
|
sed -i '$ d' $WS_CONF
|
|
|
|
cat << NG_APP >> $WS_CONF
|
|
|
|
|
|
|
|
location /external_api.min.js {
|
|
|
|
alias /usr/share/jitsi-meet/libs/external_api.min.js;
|
|
|
|
}
|
|
|
|
|
|
|
|
location /external_api.js {
|
|
|
|
alias /usr/share/jitsi-meet/libs/external_api.min.js;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
NG_APP
|
|
|
|
service nginx reload
|
|
|
|
else
|
|
|
|
echo "No app configuration done to server file, please report to:
|
|
|
|
-> https://github.com/switnet-ltd/quick-jibri-installer/issues"
|
|
|
|
fi
|
|
|
|
|
2019-02-25 04:10:26 +00:00
|
|
|
#Enable static avatar
|
|
|
|
while [[ "$ENABLE_SA" != "yes" && "$ENABLE_SA" != "no" ]]
|
|
|
|
do
|
|
|
|
read -p "Do you want to enable static avatar?: (yes or no)"$'\n' -r ENABLE_SA
|
|
|
|
if [ "$ENABLE_SA" = "no" ]; then
|
|
|
|
echo "Static avatar won't be enable"
|
|
|
|
elif [ "$ENABLE_SA" = "yes" ] && [ -f /etc/apache2/sites-available/$DOMAIN.conf ]; then
|
|
|
|
echo "Static avatar are being enable"
|
|
|
|
wget https://switnet.net/static/avatar.png -O /usr/share/jitsi-meet/images/avatar2.png
|
|
|
|
WS_CONF=/etc/apache2/sites-available/$DOMAIN.conf
|
|
|
|
sed -i "/Alias \"\/external_api.js\"/i \ \ AliasMatch \^\/avatar\/\(.\*\)\\\.png /usr/share/jitsi-meet/images/avatar2.png" $WS_CONF
|
|
|
|
sed -i "/RANDOM_AVATAR_URL_PREFIX/ s|false|\'https://$DOMAIN/avatar/\'|" $INT_CONF
|
|
|
|
sed -i "/RANDOM_AVATAR_URL_SUFFIX/ s|false|\'.png\'|" $INT_CONF
|
|
|
|
elif [ "$ENABLE_SA" = "yes" ] && [ -f /etc/nginx/sites-available/$DOMAIN.conf ]; then
|
|
|
|
wget https://switnet.net/static/avatar.png -O /usr/share/jitsi-meet/images/avatar2.png
|
2019-06-28 07:28:11 +00:00
|
|
|
WS_CONF=/etc/nginx/sites-enabled/$DOMAIN.conf
|
2019-02-25 04:10:26 +00:00
|
|
|
sed -i "/location \/external_api.min.js/i \ \ \ \ location \~ \^\/avatar\/\(.\*\)\\\.png {\\
|
|
|
|
\
|
|
|
|
\ \ \ \ \ \ \ \ alias /usr/share/jitsi-meet/images/avatar2.png;\\
|
|
|
|
\
|
|
|
|
\ \ \ \ }\\
|
|
|
|
\ " $WS_CONF
|
2019-04-05 06:14:57 +00:00
|
|
|
sed -i "/RANDOM_AVATAR_URL_PREFIX/ s|false|\'https://$DOMAIN/avatar/\'|" $INT_CONF
|
2019-02-25 04:10:26 +00:00
|
|
|
sed -i "/RANDOM_AVATAR_URL_SUFFIX/ s|false|\'.png\'|" $INT_CONF
|
|
|
|
else
|
|
|
|
echo "No app configuration done to server file, please report to:
|
|
|
|
-> https://github.com/switnet-ltd/quick-jibri-installer/issues"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2019-01-07 08:00:55 +00:00
|
|
|
#Enable secure rooms?
|
2019-04-05 06:14:57 +00:00
|
|
|
cat << P_SR >> $PROSODY_FILE
|
|
|
|
VirtualHost "$DOMAIN"
|
|
|
|
authentication = "internal_plain"
|
|
|
|
|
|
|
|
VirtualHost "guest.$DOMAIN"
|
|
|
|
authentication = "anonymous"
|
|
|
|
c2s_require_encryption = false
|
|
|
|
P_SR
|
2019-02-25 04:10:26 +00:00
|
|
|
while [[ "$ENABLE_SC" != "yes" && "$ENABLE_SC" != "no" ]]
|
2019-01-07 08:00:55 +00:00
|
|
|
do
|
|
|
|
read -p "Do you want to enable secure rooms?: (yes or no)"$'\n' -r ENABLE_SC
|
2019-02-25 04:10:26 +00:00
|
|
|
if [ "$ENABLE_SC" = "no" ]; then
|
2019-01-07 08:00:55 +00:00
|
|
|
echo "Secure rooms won't be enable"
|
2019-02-25 04:10:26 +00:00
|
|
|
elif [ "$ENABLE_SC" = "yes" ]; then
|
2019-01-07 08:00:55 +00:00
|
|
|
echo "Secure rooms are being enable"
|
2019-04-01 20:29:03 +00:00
|
|
|
#Secure room initial user
|
|
|
|
read -p "Set username for secure room moderator: "$'\n' -r SEC_ROOM_USER
|
|
|
|
read -p "Secure room moderator password: "$'\n' -sr SEC_ROOM_PASS
|
|
|
|
echo "You'll be able to login Secure Room chat with '${SEC_ROOM_USER}' \
|
|
|
|
or '${SEC_ROOM_USER}@${DOMAIN}' using the password you just entered.
|
|
|
|
If you have issues with the password refer to your sysadmin."
|
2019-04-05 06:14:57 +00:00
|
|
|
sed -i "s|#org.jitsi.jicofo.auth.URL=XMPP:|org.jitsi.jicofo.auth.URL=XMPP:|" $JICOFO_SIP
|
2019-04-01 20:29:03 +00:00
|
|
|
prosodyctl register $SEC_ROOM_USER $DOMAIN $SEC_ROOM_PASS
|
2019-01-07 08:00:55 +00:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2019-02-25 04:10:26 +00:00
|
|
|
#Set main language (Spanish)
|
|
|
|
sed -i "s|// defaultLanguage: 'en',|defaultLanguage: 'es',|" $MEET_CONF
|
|
|
|
|
|
|
|
#Start with video muted by default
|
|
|
|
sed -i "s|// startWithVideoMuted: false,|startWithVideoMuted: true,|" $MEET_CONF
|
|
|
|
|
|
|
|
#Start with audio muted but admin
|
|
|
|
sed -i "s|// startAudioMuted: 10,|startAudioMuted: 1,|" $MEET_CONF
|
|
|
|
|
2019-03-04 12:31:34 +00:00
|
|
|
#Disable/enable welcome page
|
|
|
|
sed -i "s|// enableWelcomePage: true,|enableWelcomePage: true,|" $MEET_CONF
|
2019-02-25 06:15:25 +00:00
|
|
|
|
2019-03-04 12:31:34 +00:00
|
|
|
#Set displayname as not required since jibri can't set it up.
|
|
|
|
sed -i "s|// requireDisplayName: true,|requireDisplayName: false,|" $MEET_CONF
|
2019-02-25 06:15:25 +00:00
|
|
|
|
2018-09-25 08:25:32 +00:00
|
|
|
#Enable jibri services
|
|
|
|
systemctl enable jibri
|
|
|
|
systemctl enable jibri-xorg
|
|
|
|
systemctl enable jibri-icewm
|
|
|
|
restart_services
|
|
|
|
|
|
|
|
enable_letsencrypt
|
|
|
|
|
2019-04-02 05:15:11 +00:00
|
|
|
#SSL workaround
|
|
|
|
if [ "$(dpkg-query -W -f='${Status}' apache2 2>/dev/null | grep -c "ok installed")" -eq 1 ]; then
|
2019-04-05 06:14:57 +00:00
|
|
|
ssl_wa apache2 apache $DOMAIN $WS_CONF $SYSADMIN_EMAIL $DOMAIN
|
|
|
|
install_ifnot python3-certbot-apache
|
2019-04-02 05:15:11 +00:00
|
|
|
elif [ "$(dpkg-query -W -f='${Status}' nginx 2>/dev/null | grep -c "ok installed")" -eq 1 ]; then
|
2019-04-05 06:14:57 +00:00
|
|
|
ssl_wa nginx nginx $DOMAIN $WS_CONF $SYSADMIN_EMAIL $DOMAIN
|
|
|
|
install_ifnot python3-certbot-nginx
|
2019-04-02 05:15:11 +00:00
|
|
|
else
|
2019-04-05 06:14:57 +00:00
|
|
|
echo "No webserver found please report."
|
2019-04-02 05:15:11 +00:00
|
|
|
fi
|
|
|
|
|
2018-09-25 08:25:32 +00:00
|
|
|
echo "
|
|
|
|
########################################################################
|
|
|
|
Installation complete!!
|
2019-01-07 08:07:59 +00:00
|
|
|
for customized support: http://switnet.net
|
2018-09-25 08:25:32 +00:00
|
|
|
########################################################################
|
|
|
|
"
|
|
|
|
apt -y autoremove
|
|
|
|
apt autoclean
|
|
|
|
|
|
|
|
echo "Rebooting in..."
|
|
|
|
secs=$((15))
|
|
|
|
while [ $secs -gt 0 ]; do
|
|
|
|
echo -ne "$secs\033[0K\r"
|
|
|
|
sleep 1
|
|
|
|
: $((secs--))
|
|
|
|
done
|
|
|
|
reboot
|