quick-jibri-installer/quick_jibri_installer.sh

731 lines
22 KiB
Bash
Raw Normal View History

#!/bin/bash
2020-04-11 05:08:30 +00:00
# Quick Jibri Installer - *buntu (LTS) based systems.
2020-04-11 09:51:31 +00:00
# SwITNet Ltd © - 2020, https://switnet.net/
# GPLv3 or later.
2020-03-26 00:47:37 +00:00
{
echo "Started at $(date +'%Y-%m-%d %H:%M:%S')" >> qj-installer.log
while getopts m: option
do
case "${option}"
in
m) MODE=${OPTARG};;
\?) echo "Usage: sudo ./quick_jibri_installer.sh [-m debug]" && exit;;
esac
done
#DEBUG
if [ "$MODE" = "debug" ]; then
set -x
fi
# SYSTEM SETUP
2020-04-07 02:08:39 +00:00
JITSI_STBL_REPO=$(apt-cache policy | grep http | grep jitsi | grep stable | 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
2020-04-11 05:08:30 +00:00
if [ $DIST = etiona ]; then
DIST="bionic"
fi
if
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
}
check_serv() {
if [ "$APACHE_2" -eq 1 ]; then
echo "
The recommended setup is using NGINX, exiting...
"
exit
elif [ "$NGINX" -eq 1 ]; then
2019-03-04 12:31:34 +00:00
2019-04-02 05:15:11 +00:00
echo "
Webserver already installed!
2019-04-02 05:15:11 +00:00
"
2019-03-04 12:31:34 +00:00
else
echo "
Installing nginx as webserver!
"
2019-04-02 05:15:11 +00:00
install_ifnot nginx
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
2020-04-07 02:08:39 +00:00
echo "
2020-04-11 05:08:30 +00:00
#--------------------------------------------------
# Audio driver seems - OK.
#--------------------------------------------------"
else
2020-04-07 02:08:39 +00:00
echo "
2020-04-11 05:08:30 +00:00
#--------------------------------------------------
# Seems to be an issue with your audio driver,
# please review your hw setup.
#--------------------------------------------------"
2020-04-07 02:08:39 +00:00
read -p
fi
}
update_certbot() {
if [ "$CERTBOT_REPO" = "certbot" ]; then
echo "
Cerbot repository already on the system!
Checking for updates...
"
apt -q2 update
apt -yq2 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
2020-04-11 09:51:31 +00:00
Featuring:
- Jibri
- Jibri Recordings Access via Nextcloud
- Jigasi Transcription
- Brandless Mode
- Recurring changes updater
See more at: https://github.com/switnet-ltd/quick-jibri-installer/
'
#Check if user is root
if ! [ $(id -u) = 0 ]; then
echo "You need to be root or have sudo privileges!"
exit 0
fi
2020-04-07 02:08:39 +00:00
DISTRO_RELEASE=$(lsb_release -sc)
if [ $DISTRO_RELEASE = xenial ] || [ $DISTRO_RELEASE = bionic ]; then
echo "OS: $(lsb_release -sd)
Good, this is a supported platform!"
else
echo "OS: $(lsb_release -sd)
Sorry, this platform is not supported... exiting"
exit
fi
#Suggest 18.04 LTS release over 16.04
if [ $DIST="xenial" ]; then
echo "$(lsb_release -sc), even when it's compatible and functional.
We suggest to use the next (LTS) release, for longer support and security reasons."
read -p "Enter any key to continue..."
fi
# Jitsi-Meet Repo
echo "Add Jitsi key"
2020-04-07 02:08:39 +00:00
if [ "$JITSI_STBL_REPO" = "stable" ]; then
echo "Jitsi stable repository already installed"
else
2020-04-07 02:08:39 +00:00
echo 'deb https://download.jitsi.org stable/' > /etc/apt/sources.list.d/jitsi-stable.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
2020-04-07 02:08:39 +00:00
apt -y install \
bmon \
curl \
ffmpeg \
git \
htop \
2019-03-04 12:31:34 +00:00
letsencrypt \
2020-04-07 02:08:39 +00:00
linux-image-generic-hwe-$(lsb_release -r|awk '{print$2}') \
unzip \
wget
2020-04-07 02:08:39 +00:00
check_serv
echo "
#--------------------------------------------------
# Install Jitsi Framework
#--------------------------------------------------
"
apt -y install \
jitsi-meet \
jibri \
openjdk-8-jre-headless
# Fix RAND_load_file error
#https://github.com/openssl/openssl/issues/7754#issuecomment-444063355
sed -i "/RANDFILE/d" /etc/ssl/openssl.cnf
echo "
#--------------------------------------------------
# Install NodeJS
#--------------------------------------------------
"
if [ "$(dpkg-query -W -f='${Status}' nodejs 2>/dev/null | grep -c "ok")" == "1" ]; then
echo "Nodejs is installed, skipping..."
else
2019-10-20 16:04:45 +00:00
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
apt install -yq2 nodejs
echo "Installing nodejs esprima package..."
npm install -g esprima
fi
if [ "$(npm list -g esprima 2>/dev/null | grep -c "empty")" == "1" ]; then
echo "Installing nodejs esprima package..."
npm install -g esprima
elif [ "$(npm list -g esprima 2>/dev/null | grep -c "esprima")" == "1" ]; then
echo "Good. Esprima package is already installed"
fi
# 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)
2020-04-07 02:08:39 +00:00
GCMP_JSON="/etc/opt/chrome/policies/managed/managed_policies.json"
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 -yq2 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...
"
/usr/bin/google-chrome --version
2019-03-04 12:31:34 +00:00
/usr/local/bin/chromedriver --version | awk '{print$1,$2}'
2020-04-07 02:08:39 +00:00
echo "
Remove Chrome warning...
"
mkdir -p /etc/opt/chrome/policies/managed
echo '{ "CommandLineFlagSecurityWarningsEnabled": false }' >> $GCMP_JSON
echo '
########################################################################
2020-04-11 05:08:30 +00:00
Please Setup Your Instalation
########################################################################
'
# MEET / JIBRI SETUP
2019-07-02 21:00:10 +00:00
DOMAIN=$(ls /etc/prosody/conf.d/ | grep -v localhost | awk -F'.cfg' '{print $1}' | awk '!NF || !seen[$0]++')
2020-04-11 05:08:30 +00:00
WS_CONF=/etc/nginx/sites-enabled/$DOMAIN.conf
2020-04-07 02:08:39 +00:00
JB_AUTH_PASS="$(tr -dc "a-zA-Z0-9#*=" < /dev/urandom | fold -w 10 | head -n1)"
JB_REC_PASS="$(tr -dc "a-zA-Z0-9#*=" < /dev/urandom | fold -w 10 | head -n1)"
PROSODY_FILE=/etc/prosody/conf.d/$DOMAIN.cfg.lua
2020-04-07 02:08:39 +00:00
PROSODY_SYS=/etc/prosody/prosody.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
2020-04-07 02:08:39 +00:00
DIR_RECORD=/var/jbrecord
REC_DIR=/home/jibri/finalize_recording.sh
JB_NAME="Jibri Sessions"
2019-11-20 06:48:04 +00:00
LE_RENEW_LOG="/var/log/letsencrypt/renew.log"
2020-04-11 05:08:30 +00:00
MOD_LISTU="https://prosody.im/files/mod_listusers.lua"
MOD_LIST_FILE="/usr/lib/prosody/modules/mod_listusers.lua"
echo "## Setting up Jitsi Meet language ##
You can define your language by using a two letter code (ISO 639-1);
English -> en
Spanish -> es
German -> de
...
Jitsi Meet web interface will be set to use such language (if availabe).
"
2020-04-11 05:08:30 +00:00
read -p "Please set your language:"$'\n' -r LANG
read -p "Set sysadmin email: "$'\n' -r SYSADMIN_EMAIL
#Drop unsecure TLS
while [[ $DROP_TLS1 != yes && $DROP_TLS1 != no ]]
do
2020-04-11 05:08:30 +00:00
read -p "Do you want to drop support for unsecure protocols TLSv1.0/1.1 now: (yes or no)"$'\n' -r DROP_TLS1
if [ $DROP_TLS1 = no ]; then
echo "TLSv1.0/1.1 will remain."
elif [ $DROP_TLS1 = yes ]; then
echo "TLSv1.0/1.1 will be dropped"
fi
2020-04-11 05:08:30 +00:00
done
#Dropbox
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
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
2020-04-11 05:08:30 +00:00
#SSL LE
while [[ $ENABLE_SSL != yes && $ENABLE_SSL != no ]]
do
read -p "Do you want to setup LetsEncrypt with your domain: (yes or no)"$'\n' -r ENABLE_SSL
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
2020-04-11 09:59:29 +00:00
#Brandless Mode
while [[ $ENABLE_BLESSM != yes && $ENABLE_BLESSM != no ]]
do
read -p "Do you want to install on custom \"Brandless mode\"?: (yes or no)"$'\n' -r ENABLE_BLESSM
if [ $ENABLE_BLESSM = no ]; then
echo "Brandless mode won't be set."
elif [ $ENABLE_BLESSM = yes ]; then
echo "Brandless mode will be set."
fi
done
#Jibri Records Access (JRA) via Nextcloud
while [[ $ENABLE_NC_ACCESS != yes && $ENABLE_NC_ACCESS != no ]]
do
read -p "Do you want to setup Jibri Records Access via Nextcloud: (yes or no)"$'\n' -r ENABLE_NC_ACCESS
if [ $ENABLE_NC_ACCESS = no ]; then
echo "JRA via Nextcloud won't be enabled."
elif [ $ENABLE_NC_ACCESS = yes ]; then
echo "JRA via Nextcloud will be enabled."
fi
done
2019-07-29 09:24:32 +00:00
#Jigasi
while [[ $ENABLE_TRANSCRIPT != yes && $ENABLE_TRANSCRIPT != no ]]
do
read -p "Do you want to setup Jigasi Transcription: (yes or no)"$'\n' -r ENABLE_TRANSCRIPT
if [ $ENABLE_TRANSCRIPT = no ]; then
echo "Jigasi Transcription won't be enabled."
elif [ $ENABLE_TRANSCRIPT = yes ]; then
echo "Jigasi Transcription will be enabled."
fi
done
2020-04-11 05:08:30 +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 enabled"
2020-04-11 05:08:30 +00:00
elif [ "$ENABLE_SA" = "yes" ]; then
echo "Static avatar will be enabled"
fi
done
#Enable local audio recording
while [[ "$ENABLE_LAR" != "yes" && "$ENABLE_LAR" != "no" ]]
do
read -p "Do you want to enable local audio recording option?: (yes or no)"$'\n' -r ENABLE_LAR
if [ "$ENABLE_LAR" = "no" ]; then
echo "Local audio recording option won't be enabled"
elif [ "$ENABLE_LAR" = "yes" ]; then
echo "Local audio recording option will be enabled"
2020-04-11 05:08:30 +00:00
fi
done
#Secure room initial user
while [[ "$ENABLE_SC" != "yes" && "$ENABLE_SC" != "no" ]]
do
read -p "Do you want to enable secure rooms?: (yes or no)"$'\n' -r ENABLE_SC
if [ "$ENABLE_SC" = "no" ]; then
echo "-- Secure rooms won't be enabled."
elif [ "$ENABLE_SC" = "yes" ]; then
echo "-- Secure rooms will being enabled."
read -p "Set username for secure room moderator: "$'\n' -r SEC_ROOM_USER
read -p "Secure room moderator password: "$'\n' -sr SEC_ROOM_PASS
fi
done
#Welcome Page
while [[ $ENABLE_WELCP != yes && $ENABLE_WELCP != no ]]
do
read -p "Do you want to disable the Welcome page: (yes or no)"$'\n' -r ENABLE_WELCP
if [ $ENABLE_WELCP = yes ]; then
echo "Welcome page will be disabled."
elif [ $ENABLE_WELCP = no ]; then
echo "Welcome page will be enabled."
fi
done
#Start configuration
echo '
########################################################################
Start Jitsi Framework configuration
########################################################################
'
JibriBrewery=JibriBrewery
2020-04-11 09:59:29 +00:00
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() {
systemctl stop $1
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
systemctl restart $1
2019-03-04 12:31:34 +00:00
#Add cron
2019-11-20 06:48:04 +00:00
crontab -l | { cat; echo "@weekly certbot renew --${2} > $LE_RENEW_LOG 2>&1 || mail -s 'LE SSL Errors' $SYSADMIN_EMAIL < $LE_RENEW_LOG"; } | crontab -
2019-03-04 12:31:34 +00:00
crontab -l
}
enable_letsencrypt() {
if [ "$ENABLE_SSL" = "yes" ]; then
echo '
2020-04-11 05:08:30 +00:00
#--------------------------------------------------
# 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
update_certbot
2019-03-04 12:31:34 +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
systemctl restart jibri
systemctl restart jibri-icewm
systemctl restart jibri-xorg
else
echo "Jibri service not installed"
fi
}
# Restarting services
restart_services() {
systemctl restart jitsi-videobridge*
systemctl restart jicofo
systemctl restart prosody
2019-02-25 04:10:26 +00:00
check_jibri
}
# 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
2020-04-07 02:08:39 +00:00
#Fix Jibri conectivity issues
sed -i "s|c2s_require_encryption = .*|c2s_require_encryption = false|" $PROSODY_SYS
sed -i "/c2s_require_encryption = false/a \\
\\
consider_bosh_secure = true" $PROSODY_SYS
2020-04-11 05:08:30 +00:00
if [ ! -f $MOD_LIST_FILE ]; then
2020-04-07 02:08:39 +00:00
echo "
-> Adding external module to list prosody users...
"
2020-04-11 05:08:30 +00:00
curl -s $MOD_LISTU > $MOD_LIST_FILE
2020-04-07 02:08:39 +00:00
echo "Now you can check registered users with:
prosodyctl mod_listusers
"
else
echo "Prosody support for listing users seems to be enabled.
check with: prosodyctl mod_listusers
"
fi
### 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
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
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
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,\\
\\
hiddenDomain: \'recorder.$DOMAIN\',|" $MEET_CONF
#Dropbox feature
if [ $ENABLE_DB = "yes" ]; then
DB_STR=$(grep -n "dropbox:" $MEET_CONF | cut -d ":" -f1)
DB_END=$((DB_STR + 10))
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
#LocalRecording
if
2020-03-26 06:10:33 +00:00
echo "# Enabling local recording (audio only)."
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
sed -i "s|'tileview'|'tileview', 'localrecording'|" $INT_CONF
sed -i "s|LOC_REC=.*|LOC_REC=\"on\"|" jitsi-updater.sh
fi
#Setup main language
if [ -z $LANG ] || [ "$LANG" = "en" ]; then
echo "Leaving English (en) as default language..."
2019-11-20 07:38:52 +00:00
sed -i "s|// defaultLanguage: 'en',|defaultLanguage: 'en',|" $MEET_CONF
else
echo "Changing default language to: $LANG"
2019-11-20 07:38:52 +00:00
sed -i "s|// defaultLanguage: 'en',|defaultLanguage: \'$LANG\',|" $MEET_CONF
fi
#Check config file
echo "
# Checking $MEET_CONF file for errors
"
CHECKJS=$(esvalidate $MEET_CONF| cut -d ":" -f2)
if [[ -z "$CHECKJS" ]]; then
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
# Recording directory
2020-04-07 02:08:39 +00:00
mkdir $DIR_RECORD
chown -R jibri:jibri $DIR_RECORD
cat << REC_DIR > $REC_DIR
#!/bin/bash
2020-04-07 02:08:39 +00:00
RECORDINGS_DIR=$DIR_RECORD
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
2020-04-07 02:08:39 +00:00
chmod -R 770 \$RECORDINGS_DIR
exit 0
REC_DIR
2020-04-07 02:08:39 +00:00
chown jibri:jibri $REC_DIR
chmod +x $REC_DIR
## JSON Config
2019-03-04 12:31:34 +00:00
cp $CONF_JSON $CONF_JSON.orig
cat << CONF_JSON > $CONF_JSON
{
"recording_directory":"$DIR_RECORD",
"finalize_recording_script_path": "$REC_DIR",
"xmpp_environments": [
{
"name": "$JB_NAME",
"xmpp_server_hosts": [
2020-04-07 02:08:39 +00:00
"$DOMAIN"
],
"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"
},
2020-04-07 02:08:39 +00:00
"room_jid_domain_string_to_strip_from_start": "conference.",
"usage_timeout": "0"
}
]
}
CONF_JSON
2019-02-25 04:10:26 +00:00
#Tune webserver for Jitsi App control
2020-04-11 05:08:30 +00:00
if [ -f $WS_CONF ]; then
sed -i "/Anything that didn't match above/i \\\n" $WS_CONF
sed -i "/Anything that didn't match above/i \ \ \ \ location = \/external_api.min.js {" $WS_CONF
sed -i "/Anything that didn't match above/i \ \ \ \ \ \ \ \ alias \/usr\/share\/jitsi-meet\/libs\/external_api.min.js;" $WS_CONF
sed -i "/Anything that didn't match above/i \ \ \ \ }" $WS_CONF
sed -i "/Anything that didn't match above/i \\\n" $WS_CONF
systemctl reload nginx
else
echo "No app configuration done to server file, please report to:
-> https://github.com/switnet-ltd/quick-jibri-installer/issues"
fi
2020-04-11 05:08:30 +00:00
#Static avatar
if [ "$ENABLE_SA" = "yes" ] && [ -f $WS_CONF ]; then
#wget https://switnet.net/static/avatar.png -O /usr/share/jitsi-meet/images/avatar2.png
cp images/avatar2.png /usr/share/jitsi-meet/images/
2020-04-11 05:08:30 +00:00
sed -i "/location \/external_api.min.js/i \ \ \ \ location \~ \^\/avatar\/\(.\*\)\\\.png {" $WS_CONF
sed -i "/location \/external_api.min.js/i \ \ \ \ \ \ \ \ alias /usr/share/jitsi-meet/images/avatar2.png;" $WS_CONF
sed -i "/location \/external_api.min.js/i \ \ \ \ }\\
2019-02-25 04:10:26 +00:00
\ " $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
fi
2020-04-11 05:08:30 +00:00
#nginx -tlsv1/1.1
if [ $DROP_TLS1 = "yes" ] && [ $DIST = "bionic" ];then
echo "Dropping TLSv1/1.1 in favor of v1.3"
2020-04-11 05:08:30 +00:00
sed -i "s|TLSv1 TLSv1.1|TLSv1.3|" /etc/nginx/nginx.conf
#sed -i "s|TLSv1 TLSv1.1|TLSv1.3|" $WS_CONF
elif [ $DROP_TLS1 = "yes" ] && [ ! $DIST = "bionic" ];then
echo "Only dropping TLSv1/1.1"
2020-04-11 05:08:30 +00:00
sed -i "s|TLSv1 TLSv1.1||" /etc/nginx/nginx.conf
#sed -i "s|TLSv1 TLSv1.1||" $WS_CONF
else
echo "No TLSv1/1.1 dropping was done. Please report to
https://github.com/switnet-ltd/quick-jibri-installer/issues "
fi
2020-04-11 05:08:30 +00:00
# Disable "Blur my background" until new notice
sed -i "s|'videobackgroundblur', ||" $INT_CONF
2020-04-11 05:08:30 +00:00
#Setup 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-04-01 20:29:03 +00:00
#Secure room initial user
2020-04-11 05:08:30 +00:00
if [ "$ENABLE_SC" = "yes" ]; then
echo "Secure rooms are being enabled..."
2019-04-01 20:29:03 +00:00
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
fi
2019-02-25 04:10:26 +00:00
#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
if [ $ENABLE_WELCP = yes ]; then
2020-04-02 20:47:24 +00:00
sed -i "s|.*enableWelcomePage:.*| enableWelcomePage: false,|" $MEET_CONF
elif [ $ENABLE_WELCP = no ]; then
2020-04-02 20:47:24 +00:00
sed -i "s|.*enableWelcomePage:.*| enableWelcomePage: true,|" $MEET_CONF
2019-11-20 07:29:46 +00:00
fi
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
#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}' 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
2020-04-11 09:59:29 +00:00
#Brandless Mode
if [ $ENABLE_BLESSM = yes ]; then
echo "Jigasi Transcription will be enabled."
sed -i "s|ENABLE_BLESSM=.*|ENABLE_BLESSM=\"on\"|" jitsi-updater.sh
bash $PWD/jm-bm.sh
fi
#JRA via Nextcloud
if [ $ENABLE_NC_ACCESS = yes ]; then
echo "Jigasi Transcription will be enabled."
bash $PWD/jra_nextcloud.sh
fi
#Jigasi Transcript
2019-07-29 17:13:41 +00:00
if [ $ENABLE_TRANSCRIPT = yes ]; then
2019-07-29 09:24:32 +00:00
echo "Jigasi Transcription will be enabled."
2019-07-29 17:13:41 +00:00
bash $PWD/jigasi.sh
2019-07-29 09:24:32 +00:00
fi
2020-04-07 02:08:39 +00:00
#Prevent Jibri conecction issue
sed -i "/127.0.0.1/a \\
127.0.0.1 $DOMAIN" /etc/hosts
echo "
########################################################################
Installation complete!!
for customized support: http://switnet.net
########################################################################
"
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
2020-03-26 00:47:37 +00:00
} > >(tee -a qj-installer.log) 2> >(tee -a qj-installer.log >&2)
reboot