From 32cfa0cba616e8baaa8e90e0a3c1e3850d12ff5a Mon Sep 17 00:00:00 2001 From: Ark74 Date: Tue, 29 Sep 2020 21:27:13 -0500 Subject: [PATCH 01/54] Add fail checks on installer --- jra_nextcloud.sh | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/jra_nextcloud.sh b/jra_nextcloud.sh index 9fd3f80..ec4bec4 100644 --- a/jra_nextcloud.sh +++ b/jra_nextcloud.sh @@ -2,6 +2,20 @@ # JRA (Jibri Recordings Access) via Nextcloud # SwITNet Ltd © - 2020, https://switnet.net/ # GPLv3 or later. +while getopts m: option +do + case "${option}" + in + m) MODE=${OPTARG};; + \?) echo "Usage: sudo ./jra_nextcloud.sh [-m debug]" && exit;; + esac +done + +#DEBUG +if [ "$MODE" = "debug" ]; then +set -x +fi + if ! [ $(id -u) = 0 ]; then echo "You need to be root or have sudo privileges!" exit 0 @@ -71,6 +85,17 @@ JITSI_MEET_PROXY="/etc/nginx/modules-enabled/60-jitsi-meet.conf" if [ -f $JITSI_MEET_PROXY ];then PREAD_PROXY=$(grep -nr "preread_server_name" $JITSI_MEET_PROXY | cut -d ":" -f1) fi + +echo -e "\n# Check for jitsi-meet/jibri\n" +if [ "$(dpkg-query -W -f='${Status}' jibri 2>/dev/null | grep -c "ok installed")" == "1" ] || \ + [ -f /etc/prosody/conf.d/$DOMAIN.conf ]; then + echo "jibri is installed, checking version:" + apt-show-versions jibri +else + echo "Wait!, jibri or jitsi-meet is not installed on this system using apt, exiting..." + exit +fi + exit_ifinstalled() { if [ "$(dpkg-query -W -f='${Status}' $1 2>/dev/null | grep -c "ok installed")" == "1" ]; then echo " This instance already has $1 installed, exiting..." @@ -128,7 +153,8 @@ apt-get install -y \ php$PHPVER-zip \ php-imagick \ php-redis \ - redis-server + redis-server \ + unzip #System related install_ifnot smbclient @@ -175,6 +201,7 @@ systemctl restart php$PHPVER-fpm.service #-------------------------------------------------- echo -e "\n---- Creating the PgSQL DB & User ----" +cd /tmp sudo -u postgres psql < Date: Tue, 29 Sep 2020 21:35:01 -0500 Subject: [PATCH 02/54] Return to git folder... ...to set jitsi-updater domain --- jra_nextcloud.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/jra_nextcloud.sh b/jra_nextcloud.sh index ec4bec4..6497a5c 100644 --- a/jra_nextcloud.sh +++ b/jra_nextcloud.sh @@ -463,6 +463,7 @@ Adding trusted domain... sudo -u www-data php $NC_PATH/occ config:system:set trusted_domains 0 --value=$NC_DOMAIN echo "Setting JRA domain on jitsi-updater.sh" +cd ~/quick-jibri-installer sed -i "s|NC_DOMAIN=.*|NC_DOMAIN=\"$NC_DOMAIN\"|" jitsi-updater.sh echo "Quick Nextcloud installation complete!" -- 2.34.1 From 18da44e1f74d63706ef2927fc15d9508db6b689c Mon Sep 17 00:00:00 2001 From: Ark74 Date: Tue, 29 Sep 2020 21:37:28 -0500 Subject: [PATCH 03/54] Fix kernel lookup, prevent missing modules. --- quick_jibri_installer.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/quick_jibri_installer.sh b/quick_jibri_installer.sh index 09784bb..4d15ee3 100644 --- a/quick_jibri_installer.sh +++ b/quick_jibri_installer.sh @@ -26,7 +26,6 @@ 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" PROSODY_REPO=$(apt-cache policy | grep http | grep prosody| awk '{print $3}' | head -n 1 | cut -d "/" -f2) -HWE_VIR_MOD=$(apt-cache madison linux-modules-extra-virtual-hwe-$(lsb_release -sr) 2>/dev/null|head -n1|grep -c "extra-virtual-hwe") CR=`echo $'\n> '` if [ $DIST = flidas ]; then @@ -229,6 +228,7 @@ apt-get -y install \ wget echo "# Check and Install HWE kernel if possible..." +HWE_VIR_MOD=$(apt-cache madison linux-modules-extra-virtual-hwe-$(lsb_release -sr) 2>/dev/null|head -n1|grep -c "extra-virtual-hwe") if [ "$HWE_VIR_MOD" == "1" ]; then apt-get -y install \ linux-image-generic-hwe-$(lsb_release -sr) \ @@ -334,6 +334,7 @@ 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 +JIBRI_CONF=/etc/jitsi/jibri/jibri.conf DIR_RECORD=/var/jbrecord REC_DIR=/home/jibri/finalize_recording.sh JB_NAME="Jibri Sessions" @@ -482,7 +483,7 @@ read -p "> Do you want to setup Jigasi Transcription: (yes or no) fi done else - echo "No valid option for Jigasi.Please report this to + echo "No valid option for Jigasi. Please report this to https://github.com/switnet-ltd/quick-jibri-installer/issues " fi #Grafana -- 2.34.1 From 14a3d47e99a15a0330aa444f7a3cfe946af244e4 Mon Sep 17 00:00:00 2001 From: Ark74 Date: Tue, 29 Sep 2020 21:42:19 -0500 Subject: [PATCH 04/54] Check for updates first, then check for kernel --- tools/test-jibri-env.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/test-jibri-env.sh b/tools/test-jibri-env.sh index b3e4cc1..f7a56db 100644 --- a/tools/test-jibri-env.sh +++ b/tools/test-jibri-env.sh @@ -30,14 +30,14 @@ if ! [ $(id -u) = 0 ]; then exit 0 fi -JITSI_REPO=$(apt-cache policy | grep http | grep jitsi | grep stable | awk '{print $3}' | head -n 1 | cut -d "/" -f1) -SND_AL_MODULE=$(lsmod | awk '{print$1}'| grep snd_aloop) -HWE_VIR_MOD=$(apt-cache madison linux-modules-extra-virtual-hwe-$(lsb_release -sr) 2>/dev/null|head -n1|grep -c "extra-virtual-hwe") - echo "Checking for updates...." apt -q2 update apt -yq2 install apt-show-versions +JITSI_REPO=$(apt-cache policy | grep http | grep jitsi | grep stable | awk '{print $3}' | head -n 1 | cut -d "/" -f1) +SND_AL_MODULE=$(lsmod | awk '{print$1}'| grep snd_aloop) +HWE_VIR_MOD=$(apt-cache madison linux-modules-extra-virtual-hwe-$(lsb_release -sr) 2>/dev/null|head -n1|grep -c "extra-virtual-hwe") + echo -e "\n# Check repository\n" if [ -z $JITSI_REPO ]; then echo "No repository detected, wait whaaaat?..." -- 2.34.1 From 471ed82eb06a2dd84ee66a437020e6b554c81b40 Mon Sep 17 00:00:00 2001 From: Ark74 Date: Wed, 30 Sep 2020 02:03:11 -0500 Subject: [PATCH 05/54] Require a minimum of 6 characters for password --- jra_nextcloud.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/jra_nextcloud.sh b/jra_nextcloud.sh index 6497a5c..15e3ee7 100644 --- a/jra_nextcloud.sh +++ b/jra_nextcloud.sh @@ -42,11 +42,12 @@ if [ -z "$NC_USER" ]; then echo "-- This field is mandatory." fi done -while [[ -z "$NC_PASS" ]] +while [ -z "$NC_PASS" ] || [ ${#NC_PASS} -lt 6 ] do read -p "Nextcloud user password: " -r NC_PASS -if [ -z "$NC_PASS" ]; then - echo "-- This field is mandatory." + +if [ -z "$NC_PASS" ] || [ ${#NC_PASS} -lt 6 ]; then + echo -e "-- This field is mandatory. \nPlease make sure it's at least 6 caracters.\n" fi done #Enable HSTS -- 2.34.1 From b64e768d94a4dbb5b455c86ae50877605cca8cc5 Mon Sep 17 00:00:00 2001 From: Ark74 Date: Wed, 30 Sep 2020 03:14:08 -0500 Subject: [PATCH 06/54] Test chained debug mode --- quick_jibri_installer.sh | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/quick_jibri_installer.sh b/quick_jibri_installer.sh index 4d15ee3..49d84c0 100644 --- a/quick_jibri_installer.sh +++ b/quick_jibri_installer.sh @@ -940,24 +940,41 @@ fi #JRA via Nextcloud if [ "$ENABLE_NC_ACCESS" = "yes" ]; then echo "JRA via Nextcloud will be enabled." - bash $PWD/jra_nextcloud.sh + if [ "$MODE" = "debug" ]; then + bash $PWD/jra_nextcloud.sh -m debug + else + bash $PWD/jra_nextcloud.sh + fi fi } > >(tee -a qj-installer.log) 2> >(tee -a qj-installer.log >&2) #Jigasi Transcript if [ "$ENABLE_TRANSCRIPT" = "yes" ]; then echo "Jigasi Transcription will be enabled." - bash $PWD/jigasi.sh + # ToDo: Analyze behavior on debug + #if [ "$MODE" = "debug" ]; then + # bash $PWD/jigasi.sh -m debug + #else + bash $PWD/jigasi.sh + #fi fi { #Grafana Dashboard if [ "$ENABLE_GRAFANA_DSH" = "yes" ]; then echo "Grafana Dashboard will be enabled." - bash $PWD/grafana.sh + if [ "$MODE" = "debug" ]; then + bash $PWD/grafana.sh -m debug + else + bash $PWD/grafana.sh + fi fi #Docker Etherpad if [ "$ENABLE_DOCKERPAD" = "yes" ]; then echo "Docker Etherpad will be enabled." - bash $PWD/etherpad.sh + if [ "$MODE" = "debug" ]; then + bash $PWD/etherpad.sh -m debug + else + bash $PWD/etherpad.sh + fi fi #Prevent Jibri conecction issue if [ -z "$(grep -n $DOMAIN /etc/hosts)" ];then -- 2.34.1 From b87d5359f480f0d6092bd766b4f954e7e74260de Mon Sep 17 00:00:00 2001 From: Ark74 Date: Wed, 30 Sep 2020 03:16:11 -0500 Subject: [PATCH 07/54] Change watermark on interface_config for brandless mode --- jm-bm.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/jm-bm.sh b/jm-bm.sh index 36484f9..338ac04 100644 --- a/jm-bm.sh +++ b/jm-bm.sh @@ -74,4 +74,6 @@ else sed -i "s|'me'|'$LOCAL_USER'|" $INT_CONF sed -i "s|LIVE_STREAMING_HELP_LINK: .*|LIVE_STREAMING_HELP_LINK: '#',|g" $INT_CONF sed -i "s|SUPPORT_URL: .*|SUPPORT_URL: '#',|g" $INT_CONF + #Logo 2 + sed -i "s|watermark.png|watermark2.png|g" $INT_CONF fi -- 2.34.1 From f8b58802f9f82603e23bf9af3c4a602bbc6408ab Mon Sep 17 00:00:00 2001 From: Ark74 Date: Thu, 1 Oct 2020 02:09:47 -0500 Subject: [PATCH 08/54] Upgrade jibri config --- quick_jibri_installer.sh | 101 ++++++++++++++++++++++++++------------- 1 file changed, 68 insertions(+), 33 deletions(-) diff --git a/quick_jibri_installer.sh b/quick_jibri_installer.sh index 49d84c0..3a56c82 100644 --- a/quick_jibri_installer.sh +++ b/quick_jibri_installer.sh @@ -199,6 +199,7 @@ if [ "$JITSI_REPO" = "stable" ]; then else echo 'deb http://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 - + JITSI_REPO="stable" fi #Default to LE SSL? while [[ $LE_SSL != yes && $LE_SSL != no ]] @@ -333,7 +334,6 @@ PROSODY_FILE=/etc/prosody/conf.d/$DOMAIN.cfg.lua 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 JIBRI_CONF=/etc/jitsi/jibri/jibri.conf DIR_RECORD=/var/jbrecord REC_DIR=/home/jibri/finalize_recording.sh @@ -736,41 +736,76 @@ REC_DIR chown jibri:jibri $REC_DIR chmod +x $REC_DIR -## JSON Config -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": [ - "$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" - }, +## New Jibri Config (2020) +mv $JIBRI_CONF ${JIBRI_CONF}-dpkg-file +cat << NEW_CONF > $JIBRI_CONF +// New XMPP environment config. +jibri { + recording { + recordings-directory = $DIR_RECORD + finalize-script = $REC_DIR + } + api { + xmpp { + environments = [ + { + // A user-friendly name for this environment + name = "$JB_NAME" - "room_jid_domain_string_to_strip_from_start": "conference.", - "usage_timeout": "0" + // A list of XMPP server hosts to which we'll connect + xmpp-server-hosts = [ "$DOMAIN" ] + + // The base XMPP domain + xmpp-domain = "$DOMAIN" + + // The MUC we'll join to announce our presence for + // recording and streaming services + control-muc { + domain = "internal.auth.$DOMAIN" + room-name = "$JibriBrewery" + nickname = "Live" + } + + // The login information for the control MUC + control-login { + domain = "auth.$DOMAIN" + username = "jibri" + password = "$JB_AUTH_PASS" + } + + // An (optional) MUC configuration where we'll + // join to announce SIP gateway services + // sip-control-muc { + // domain = "domain" + // room-name = "room-name" + // nickname = "nickname" + // } + + // The login information the selenium web client will use + call-login { + domain = "recorder.$DOMAIN" + username = "recorder" + password = "$JB_REC_PASS" + } + + // The value we'll strip from the room JID domain to derive + // the call URL + strip-from-room-domain = "conference." + + // How long Jibri sessions will be allowed to last before + // they are stopped. A value of 0 allows them to go on + // indefinitely + usage-timeout = 0 hour + + // Whether or not we'll automatically trust any cert on + // this XMPP domain + trust-all-xmpp-certs = true + } + ] } - ] + } } -CONF_JSON +NEW_CONF #Setting varibales for add-jibri-node.sh sed -i "s|MAIN_SRV_DIST=.*|MAIN_SRV_DIST=\"$DIST\"|" add-jibri-node.sh -- 2.34.1 From 8ea31cc9741de51e8eb3be91df7218b7dd722c55 Mon Sep 17 00:00:00 2001 From: Ark74 Date: Thu, 1 Oct 2020 02:10:53 -0500 Subject: [PATCH 09/54] Upgrade jibri config --- add-jibri-node.sh | 100 +++++++++++++++++++++++++++++++--------------- 1 file changed, 67 insertions(+), 33 deletions(-) diff --git a/add-jibri-node.sh b/add-jibri-node.sh index 22ad407..bd579d1 100644 --- a/add-jibri-node.sh +++ b/add-jibri-node.sh @@ -46,7 +46,7 @@ THIS_SRV_DIST=$(lsb_release -sc) JITSI_REPO=$(apt-cache policy | grep http | grep jitsi | grep stable | awk '{print $3}' | head -n 1 | cut -d "/" -f1) START=0 LAST=TBD -CONF_JSON="/etc/jitsi/jibri/config.json" +JIBRI_CONF="/etc/jitsi/jibri/jibri.conf" DIR_RECORD="/var/jbrecord" REC_DIR="/home/jibri/finalize_recording.sh" CHD_VER="$(curl -sL https://chromedriver.storage.googleapis.com/LATEST_RELEASE)" @@ -220,42 +220,76 @@ REC_DIR chown jibri:jibri $REC_DIR chmod +x $REC_DIR -## JSON Config -cp $CONF_JSON ${CONF_JSON}.orig +## New Jibri Config (2020) +mv $JIBRI_CONF ${JIBRI_CONF}-dpkg-file +cat << NEW_CONF > $JIBRI_CONF +// New XMPP environment config. +jibri { + recording { + recordings-directory = $DIR_RECORD + finalize-script = $REC_DIR + } + api { + xmpp { + environments = [ + { + // A user-friendly name for this environment + name = "$JB_NAME" -cat << CONF_JSON > $CONF_JSON -{ - "recording_directory":"$DIR_RECORD", - "finalize_recording_script_path": "$REC_DIR", - "xmpp_environments": [ - { - "name": "$JB_NAME", - "xmpp_server_hosts": [ - "$MAIN_SRV_DOMAIN" - ], - "xmpp_domain": "$MAIN_SRV_DOMAIN", - "control_login": { - "domain": "auth.$MAIN_SRV_DOMAIN", - "username": "jibri", - "password": "$JB_AUTH_PASS" - }, - "control_muc": { - "domain": "internal.auth.$MAIN_SRV_DOMAIN", - "room_name": "$JibriBrewery", - "nickname": "Live-$ADDUP" - }, - "call_login": { - "domain": "recorder.$MAIN_SRV_DOMAIN", - "username": "recorder", - "password": "$JB_REC_PASS" - }, + // A list of XMPP server hosts to which we'll connect + xmpp-server-hosts = [ "$DOMAIN" ] - "room_jid_domain_string_to_strip_from_start": "conference.", - "usage_timeout": "0" + // The base XMPP domain + xmpp-domain = "$DOMAIN" + + // The MUC we'll join to announce our presence for + // recording and streaming services + control-muc { + domain = "internal.auth.$DOMAIN" + room-name = "$JibriBrewery" + nickname = "Live" + } + + // The login information for the control MUC + control-login { + domain = "auth.$DOMAIN" + username = "jibri" + password = "$JB_AUTH_PASS" + } + + // An (optional) MUC configuration where we'll + // join to announce SIP gateway services + // sip-control-muc { + // domain = "domain" + // room-name = "room-name" + // nickname = "nickname" + // } + + // The login information the selenium web client will use + call-login { + domain = "recorder.$DOMAIN" + username = "recorder" + password = "$JB_REC_PASS" + } + + // The value we'll strip from the room JID domain to derive + // the call URL + strip-from-room-domain = "conference." + + // How long Jibri sessions will be allowed to last before + // they are stopped. A value of 0 allows them to go on + // indefinitely + usage-timeout = 0 hour + + // Whether or not we'll automatically trust any cert on + // this XMPP domain + trust-all-xmpp-certs = true + } + ] } - ] + } } -CONF_JSON +NEW_CONF echo "Writting last node number..." sed -i "$(var_dlim 0_VAR),$(var_dlim 1_VAR){s|LAST=.*|LAST=$ADDUP|}" add-jibri-node.sh -- 2.34.1 From 3b7f74d8a292dc5268dc771be855a3dab0113b37 Mon Sep 17 00:00:00 2001 From: Ark74 Date: Thu, 1 Oct 2020 02:12:09 -0500 Subject: [PATCH 10/54] Add jibri conf test --- tools/test-jibri-env.sh | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/tools/test-jibri-env.sh b/tools/test-jibri-env.sh index f7a56db..a53f4c4 100644 --- a/tools/test-jibri-env.sh +++ b/tools/test-jibri-env.sh @@ -37,15 +37,17 @@ apt -yq2 install apt-show-versions JITSI_REPO=$(apt-cache policy | grep http | grep jitsi | grep stable | awk '{print $3}' | head -n 1 | cut -d "/" -f1) SND_AL_MODULE=$(lsmod | awk '{print$1}'| grep snd_aloop) HWE_VIR_MOD=$(apt-cache madison linux-modules-extra-virtual-hwe-$(lsb_release -sr) 2>/dev/null|head -n1|grep -c "extra-virtual-hwe") +CONF_JSON="/etc/jitsi/jibri/config.json" +JIBRI_CONF="/etc/jitsi/jibri/jibri.conf" -echo -e "\n# Check repository\n" +echo -e "\n# -- Check repository --\n" if [ -z $JITSI_REPO ]; then echo "No repository detected, wait whaaaat?..." else echo "This installation is using the \"$JITSI_REPO\" repository." fi -echo -e "\n# Check latest updates for jibri\n" +echo -e "\n# -- Check latest updates for jibri --\n" if [ "$(dpkg-query -W -f='${Status}' jibri 2>/dev/null | grep -c "ok installed")" == "1" ]; then echo "Jibri is installed, checking version:" apt-show-versions jibri @@ -57,7 +59,7 @@ fi echo -e "\nAttempting (any possible) jibri upgrade!" apt -y install --only-upgrade jibri -echo -e "\n# Test kernel modules\n" +echo -e "\n# -- Test kernel modules --\n" if [ -z $SND_AL_MODULE ]; then echo -e "No module snd_aloop detected.\nIf you just installed a new kernel, \ please try rebooting.\nFor now wait 'til the end of the recommended kernel installation." @@ -73,7 +75,7 @@ please try rebooting.\nFor now wait 'til the end of the recommended kernel insta else echo -e "Great!\nModule snd-aloop found!" fi -echo -e "\n# Test .asoundrc file\n" +echo -e "\n# -- Test .asoundrc file --\n" ASRC_MASTER="https://raw.githubusercontent.com/jitsi/jibri/master/resources/debian-package/etc/jitsi/jibri/asoundrc" ASRC_INSTALLED="/home/jibri/.asoundrc" ASRC_MASTER_MD5SUM=$(curl -sL $ASRC_MASTER | md5sum | cut -d ' ' -f 1) @@ -85,9 +87,23 @@ else echo "asoundrc files differ, if you have errors, you might wanna check this file!" fi -echo -e "\n# Old or new config (ToDo)\n" +echo -e "\n# -- Old or new config --\n" echo -e "What config version is this using?" -echo -e "(Not implemented yet)" +if [ -f ${CONF_JSON}_disabled ] && \ + [ -f $JIBRI_CONF ] && \ + [ -f $JIBRI_CONF-dpkg-file ]; then + echo -e "\n> This jibri config has been upgraded already.\n\nIf you think there maybe an error on checking you current jibri configuration.\nPlease report this to \ +https://github.com/switnet-ltd/quick-jibri-installer/issues\n" +elif [ ! -f $CONF_JSON ] && \ + [ -f $JIBRI_CONF ] && \ + [ -f ${JIBRI_CONF}-dpkg-file ]; then + echo -e "\n> This jibri seems to be running the lastest configuration already.\n\nIf you think there maybe an error on checking you current jibri configuration.\nPlease report this to \ +https://github.com/switnet-ltd/quick-jibri-installer/issues\n" +elif [ -f ${CONF_JSON}_disabled ] && \ + [ -f $JIBRI_CONF ]; then + echo -e "\n> This jibri config seems to be candidate for upgrading.\nIf you think there maybe an error on checking you current jibri configuration.\nPlease report this to \ +https://github.com/switnet-ltd/quick-jibri-installer/issues\n" +fi echo -e "\nJibri Test complete, thanks for testing.\n" -- 2.34.1 From 38eb8acac6333b42803f8bf103ea75583e4e3550 Mon Sep 17 00:00:00 2001 From: Ark74 Date: Thu, 1 Oct 2020 02:21:58 -0500 Subject: [PATCH 11/54] Fix if condition. --- tools/test-jibri-env.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/test-jibri-env.sh b/tools/test-jibri-env.sh index a53f4c4..577a927 100644 --- a/tools/test-jibri-env.sh +++ b/tools/test-jibri-env.sh @@ -100,7 +100,7 @@ elif [ ! -f $CONF_JSON ] && \ [ -f ${JIBRI_CONF}-dpkg-file ]; then echo -e "\n> This jibri seems to be running the lastest configuration already.\n\nIf you think there maybe an error on checking you current jibri configuration.\nPlease report this to \ https://github.com/switnet-ltd/quick-jibri-installer/issues\n" -elif [ -f ${CONF_JSON}_disabled ] && \ +elif [ -f ${CONF_JSON} ] && \ [ -f $JIBRI_CONF ]; then echo -e "\n> This jibri config seems to be candidate for upgrading.\nIf you think there maybe an error on checking you current jibri configuration.\nPlease report this to \ https://github.com/switnet-ltd/quick-jibri-installer/issues\n" -- 2.34.1 From 9bab344f3973e091a5f3cdb5127fb577cf1fb6b5 Mon Sep 17 00:00:00 2001 From: Ark74 Date: Thu, 1 Oct 2020 03:01:03 -0500 Subject: [PATCH 12/54] Add jibri upgrader to new conf late 2020 --- tools/jibri-conf-upgrade.sh | 190 ++++++++++++++++++++++++++++++++++++ 1 file changed, 190 insertions(+) create mode 100644 tools/jibri-conf-upgrade.sh diff --git a/tools/jibri-conf-upgrade.sh b/tools/jibri-conf-upgrade.sh new file mode 100644 index 0000000..5a75039 --- /dev/null +++ b/tools/jibri-conf-upgrade.sh @@ -0,0 +1,190 @@ +#!/bin/bash +# Simple Jibri conf updater +# 2020 - SwITNet Ltd +# GNU GPLv3 or later. + +while getopts m: option +do + case "${option}" + in + m) MODE=${OPTARG};; + \?) echo "Usage: sudo ./test-jibri-env.sh [-m debug]" && exit;; + esac +done + +#DEBUG +if [ "$MODE" = "debug" ]; then +set -x +fi + +echo -e ' +######################################################################## + Welcome to Jibri Config Upgrader +######################################################################## + by Software, IT & Networks Ltd +\n' + +#Check if user is root +if ! [ $(id -u) = 0 ]; then + echo "You need to be root or have sudo privileges!" + exit 0 +fi + +echo "Checking for updates...." +apt -q2 update +apt install -y apt-show-versions jq + +echo -e "\n# Check for jibri\n" +if [ "$(dpkg-query -W -f='${Status}' jibri 2>/dev/null | grep -c "ok installed")" == "1" ]; then + echo "Jibri is installed, checking version:" + apt-show-versions jibri +else + echo "Wait!, jibri is not installed on this system using apt, exiting..." + exit +fi + +DOMAIN=$(ls /etc/prosody/conf.d/ | grep -v localhost | awk -F'.cfg' '{print $1}' | awk '!NF || !seen[$0]++') +CONF_JSON="/etc/jitsi/jibri/config.json" +JIBRI_CONF="/etc/jitsi/jibri/jibri.conf" +DIR_RECORD=/var/jbrecord +REC_DIR=/home/jibri/finalize_recording.sh +JibriBrewery=JibriBrewery + +check_read_vars() { + echo "Checking $1" + if [ -z "$2" ];then + echo "This variable seems wrong, please check before continue" + exit 1 + fi +} +restart_services_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 +} + +#Prevent re-run on completed jibri upgraded instance +if [ -f $CONF_JSON_disabled ] && \ + [ -f $JIBRI_CONF ] && \ + [ -f $JIBRI_CONF-dpkg-file ]; then + echo -e "\n> This jibri config has been upgraded already, we'll exit...\n\nIf you think there maybe an error on checking you current jibri configuration.\nPlease report this to \ +https://github.com/switnet-ltd/quick-jibri-installer/issues\n" + exit +elif [ ! -f $CONF_JSON ] && \ + [ -f $JIBRI_CONF ] && \ + [ -f $JIBRI_CONF-dpkg-file ]; then + echo -e "\n> This jibri seems to be running the lastest configuration already, we'll exit...\n\nIf you think there maybe an error on checking you current jibri configuration.\nPlease report this to \ +https://github.com/switnet-ltd/quick-jibri-installer/issues\n" + exit +elif [ -f $CONF_JSON ] && \ + [ -f $JIBRI_CONF ]; then + echo -e "\n> This jibri config seems to be candidate for upgrading, we'll continue...\nIf you think there maybe an error on checking you current jibri configuration.\nPlease report this to \ +https://github.com/switnet-ltd/quick-jibri-installer/issues\n" +fi + +#Read missing variables +if [ -f $CONF_JSON ]; then + echo "Reading current config.json file..." + JB_NAME=$(jq .xmpp_environments[0].name $CONF_JSON|cut -d '"' -f2) + JB_AUTH_PASS=$(jq .xmpp_environments[0].control_login.password $CONF_JSON|cut -d '"' -f2) + JB_REC_PASS=$(jq .xmpp_environments[0].call_login.password $CONF_JSON|cut -d '"' -f2) +else + echo "Can't find the instance config.json file, exiting..." + exit +fi + +check_read_vars "Jibri Name" $JB_NAME +check_read_vars "Control login passwd" $JB_AUTH_PASS +check_read_vars "Call login passwd" $JB_REC_PASS + +if [ "$MODE" = "debug" ]; then +echo "$JB_NAME" +echo "$JB_AUTH_PASS" +echo "$JB_REC_PASS" +fi + +#Backup and setup new conf file +echo -e "Backing up config.json for historical porpuses at:\n ${CONF_JSON}_disabled" +mv $CONF_JSON ${CONF_JSON}_disabled + +mv $JIBRI_CONF ${JIBRI_CONF}-dpkg-file +cat << NEW_CONF > $JIBRI_CONF +// New XMPP environment config. +jibri { + recording { + recordings-directory = $DIR_RECORD + finalize-script = $REC_DIR + } + api { + xmpp { + environments = [ + { + // A user-friendly name for this environment + name = "$JB_NAME" + + // A list of XMPP server hosts to which we'll connect + xmpp-server-hosts = [ "$DOMAIN" ] + + // The base XMPP domain + xmpp-domain = "$DOMAIN" + + // The MUC we'll join to announce our presence for + // recording and streaming services + control-muc { + domain = "internal.auth.$DOMAIN" + room-name = "$JibriBrewery" + nickname = "Live" + } + + // The login information for the control MUC + control-login { + domain = "auth.$DOMAIN" + username = "jibri" + password = "$JB_AUTH_PASS" + } + + // An (optional) MUC configuration where we'll + // join to announce SIP gateway services + // sip-control-muc { + // domain = "domain" + // room-name = "room-name" + // nickname = "nickname" + // } + + // The login information the selenium web client will use + call-login { + domain = "recorder.$DOMAIN" + username = "recorder" + password = "$JB_REC_PASS" + } + + // The value we'll strip from the room JID domain to derive + // the call URL + strip-from-room-domain = "conference." + + // How long Jibri sessions will be allowed to last before + // they are stopped. A value of 0 allows them to go on + // indefinitely + usage-timeout = 0 hour + + // Whether or not we'll automatically trust any cert on + // this XMPP domain + trust-all-xmpp-certs = true + } + ] + } + } +} +NEW_CONF + +echo "Check final jibri.conf file:" +cat $JIBRI_CONF +read -n 1 -s -r -p "Press any key to continue..."$'\n' + +restart_services_jibri +systemctl status jibri -- 2.34.1 From 0c5b6748910df9df676b194e3fac138292c66062 Mon Sep 17 00:00:00 2001 From: Ark74 Date: Sat, 3 Oct 2020 00:19:55 -0500 Subject: [PATCH 13/54] Fix missing incremental nickname and adding right kernel installation. --- add-jibri-node.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/add-jibri-node.sh b/add-jibri-node.sh index bd579d1..67f15bf 100644 --- a/add-jibri-node.sh +++ b/add-jibri-node.sh @@ -146,6 +146,17 @@ apt-get -y install \ unzip \ wget +echo "# Check and Install HWE kernel if possible..." +HWE_VIR_MOD=$(apt-cache madison linux-modules-extra-virtual-hwe-$(lsb_release -sr) 2>/dev/null|head -n1|grep -c "extra-virtual-hwe") +if [ "$HWE_VIR_MOD" == "1" ]; then + apt-get -y install \ + linux-image-generic-hwe-$(lsb_release -sr) \ + linux-modules-extra-virtual-hwe-$(lsb_release -sr) + else + apt-get -y install \ + linux-modules-extra-$(uname -r) +fi + check_snd_driver echo " @@ -247,7 +258,7 @@ jibri { control-muc { domain = "internal.auth.$DOMAIN" room-name = "$JibriBrewery" - nickname = "Live" + nickname = "Live-$ADDUP" } // The login information for the control MUC -- 2.34.1 From a8d167e22fc825020ed3599550d9fed92e410adc Mon Sep 17 00:00:00 2001 From: Ark74 Date: Sat, 3 Oct 2020 00:21:20 -0500 Subject: [PATCH 14/54] Improve config upgrader for aditional jibri nodes --- tools/jibri-conf-upgrade.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/jibri-conf-upgrade.sh b/tools/jibri-conf-upgrade.sh index 5a75039..b8bbea9 100644 --- a/tools/jibri-conf-upgrade.sh +++ b/tools/jibri-conf-upgrade.sh @@ -93,6 +93,7 @@ if [ -f $CONF_JSON ]; then JB_NAME=$(jq .xmpp_environments[0].name $CONF_JSON|cut -d '"' -f2) JB_AUTH_PASS=$(jq .xmpp_environments[0].control_login.password $CONF_JSON|cut -d '"' -f2) JB_REC_PASS=$(jq .xmpp_environments[0].call_login.password $CONF_JSON|cut -d '"' -f2) + JB_NICKN=$(jq .xmpp_environments[0].control_muc.nickname $CONF_JSON|cut -d '"' -f2) else echo "Can't find the instance config.json file, exiting..." exit @@ -106,6 +107,7 @@ if [ "$MODE" = "debug" ]; then echo "$JB_NAME" echo "$JB_AUTH_PASS" echo "$JB_REC_PASS" +echo "$JB_NICKN" fi #Backup and setup new conf file @@ -138,7 +140,7 @@ jibri { control-muc { domain = "internal.auth.$DOMAIN" room-name = "$JibriBrewery" - nickname = "Live" + nickname = "$JB_NICKN" } // The login information for the control MUC -- 2.34.1 From 9a03815572f82a383633460aefaf8efd780ebbd1 Mon Sep 17 00:00:00 2001 From: Ark74 Date: Sat, 3 Oct 2020 00:40:29 -0500 Subject: [PATCH 15/54] Fix jibri node conf upgrade --- tools/jibri-conf-upgrade.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/jibri-conf-upgrade.sh b/tools/jibri-conf-upgrade.sh index b8bbea9..0f93920 100644 --- a/tools/jibri-conf-upgrade.sh +++ b/tools/jibri-conf-upgrade.sh @@ -90,6 +90,9 @@ fi #Read missing variables if [ -f $CONF_JSON ]; then echo "Reading current config.json file..." + if [ -z $DOMAIN ]; then + DOMAIN=$(jq .xmpp_environments[0].xmpp_domain $CONF_JSON|cut -d '"' -f2) + fi JB_NAME=$(jq .xmpp_environments[0].name $CONF_JSON|cut -d '"' -f2) JB_AUTH_PASS=$(jq .xmpp_environments[0].control_login.password $CONF_JSON|cut -d '"' -f2) JB_REC_PASS=$(jq .xmpp_environments[0].call_login.password $CONF_JSON|cut -d '"' -f2) @@ -100,11 +103,14 @@ else fi check_read_vars "Jibri Name" $JB_NAME +check_read_vars "(Main server) Domain" $DOMAIN check_read_vars "Control login passwd" $JB_AUTH_PASS check_read_vars "Call login passwd" $JB_REC_PASS +check_read_vars "Jibri Node nickname" $JB_NICKN if [ "$MODE" = "debug" ]; then echo "$JB_NAME" +echo "$DOMAIN" echo "$JB_AUTH_PASS" echo "$JB_REC_PASS" echo "$JB_NICKN" -- 2.34.1 From 3a0ce3411d2c1c9e2d824936b2cc29e6f7852f36 Mon Sep 17 00:00:00 2001 From: Ark74 Date: Sat, 3 Oct 2020 03:21:38 -0500 Subject: [PATCH 16/54] Add emphasis to the kernel importance --- tools/test-jibri-env.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/test-jibri-env.sh b/tools/test-jibri-env.sh index 577a927..bfb3725 100644 --- a/tools/test-jibri-env.sh +++ b/tools/test-jibri-env.sh @@ -61,7 +61,7 @@ apt -y install --only-upgrade jibri echo -e "\n# -- Test kernel modules --\n" if [ -z $SND_AL_MODULE ]; then - echo -e "No module snd_aloop detected.\nIf you just installed a new kernel, \ + echo -e "No module snd_aloop detected. <== IMPORTANT!\nIf you just installed a new kernel, \ please try rebooting.\nFor now wait 'til the end of the recommended kernel installation." echo "# Check and Install HWE kernel if possible..." if [ "$HWE_VIR_MOD" == "1" ]; then -- 2.34.1 From ae0699bd12f7e3b56bbbcf5803c7d670c1e3dfc1 Mon Sep 17 00:00:00 2001 From: Ark74 Date: Mon, 5 Oct 2020 01:43:24 -0500 Subject: [PATCH 17/54] Set rsync manually installed --- quick_jibri_installer.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/quick_jibri_installer.sh b/quick_jibri_installer.sh index 3a56c82..516f719 100644 --- a/quick_jibri_installer.sh +++ b/quick_jibri_installer.sh @@ -225,6 +225,7 @@ apt-get -y install \ htop \ letsencrypt \ net-tools \ + rsync \ unzip \ wget -- 2.34.1 From ef3f3a0a611cf1e78de48176c70fc0eec611b995 Mon Sep 17 00:00:00 2001 From: Ark74 Date: Mon, 5 Oct 2020 01:44:35 -0500 Subject: [PATCH 18/54] Fix domain variable and add new requirements tools. --- add-jibri-node.sh | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/add-jibri-node.sh b/add-jibri-node.sh index 67f15bf..7154183 100644 --- a/add-jibri-node.sh +++ b/add-jibri-node.sh @@ -52,6 +52,7 @@ REC_DIR="/home/jibri/finalize_recording.sh" CHD_VER="$(curl -sL https://chromedriver.storage.googleapis.com/LATEST_RELEASE)" GOOGL_REPO="/etc/apt/sources.list.d/dl_google_com_linux_chrome_deb.list" GCMP_JSON="/etc/opt/chrome/policies/managed/managed_policies.json" +PUBLIC_IP="$(dig -4 @resolver1.opendns.com ANY myip.opendns.com +short)" ### 1_VAR_DEF # sed limiters for add-jibri-node.sh variables @@ -98,6 +99,10 @@ check_var JB_NAME "$JB_NAME" check_var JB_AUTH_PASS "$JB_AUTH_PASS" check_var JB_REC_PASS "$JB_REC_PASS" +#Rename hostname for each jibri node +hostnamectl set-hostname "jbnode${ADDUP}.${MAIN_SRV_DOMAIN}" +sed "1i ${PUBLIC_IP} jbnode${ADDUP}.${MAIN_SRV_DOMAIN}" /etc/hosts + # Jitsi-Meet Repo echo "Add Jitsi repo" if [ -z "$JITSI_REPO" ]; then @@ -137,14 +142,15 @@ apt-get update -q2 apt-get dist-upgrade -yq2 apt-get -y install \ - bmon \ - curl \ - ffmpeg \ - git \ - htop \ - linux-image-generic-hwe-"$(lsb_release -r|awk '{print$2}')" \ - unzip \ - wget + bmon \ + curl \ + ffmpeg \ + git \ + htop \ + inotify-tools \ + rsync \ + unzip \ + wget echo "# Check and Install HWE kernel if possible..." HWE_VIR_MOD=$(apt-cache madison linux-modules-extra-virtual-hwe-$(lsb_release -sr) 2>/dev/null|head -n1|grep -c "extra-virtual-hwe") @@ -248,22 +254,22 @@ jibri { name = "$JB_NAME" // A list of XMPP server hosts to which we'll connect - xmpp-server-hosts = [ "$DOMAIN" ] + xmpp-server-hosts = [ "$MAIN_SRV_DOMAIN" ] // The base XMPP domain - xmpp-domain = "$DOMAIN" + xmpp-domain = "$MAIN_SRV_DOMAIN" // The MUC we'll join to announce our presence for // recording and streaming services control-muc { - domain = "internal.auth.$DOMAIN" + domain = "internal.auth.$MAIN_SRV_DOMAIN" room-name = "$JibriBrewery" nickname = "Live-$ADDUP" } // The login information for the control MUC control-login { - domain = "auth.$DOMAIN" + domain = "auth.$MAIN_SRV_DOMAIN" username = "jibri" password = "$JB_AUTH_PASS" } @@ -278,7 +284,7 @@ jibri { // The login information the selenium web client will use call-login { - domain = "recorder.$DOMAIN" + domain = "recorder.$MAIN_SRV_DOMAIN" username = "recorder" password = "$JB_REC_PASS" } -- 2.34.1 From 693a3e601c4692401c5e1b17382ebdef694a2612 Mon Sep 17 00:00:00 2001 From: Ark74 Date: Mon, 5 Oct 2020 03:14:31 -0500 Subject: [PATCH 19/54] Add new requirements and improve echoing display --- quick_jibri_installer.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/quick_jibri_installer.sh b/quick_jibri_installer.sh index 516f719..22bbb92 100644 --- a/quick_jibri_installer.sh +++ b/quick_jibri_installer.sh @@ -218,11 +218,13 @@ apt-get update -q2 apt-get dist-upgrade -yq2 apt-get -y install \ + apt-show-versions \ bmon \ curl \ ffmpeg \ git \ htop \ + jq \ letsencrypt \ net-tools \ rsync \ @@ -975,7 +977,7 @@ else fi #JRA via Nextcloud if [ "$ENABLE_NC_ACCESS" = "yes" ]; then - echo "JRA via Nextcloud will be enabled." + echo -n "\nJRA via Nextcloud will be enabled." if [ "$MODE" = "debug" ]; then bash $PWD/jra_nextcloud.sh -m debug else @@ -985,7 +987,7 @@ fi } > >(tee -a qj-installer.log) 2> >(tee -a qj-installer.log >&2) #Jigasi Transcript if [ "$ENABLE_TRANSCRIPT" = "yes" ]; then - echo "Jigasi Transcription will be enabled." + echo -e "\nJigasi Transcription will be enabled." # ToDo: Analyze behavior on debug #if [ "$MODE" = "debug" ]; then # bash $PWD/jigasi.sh -m debug @@ -996,7 +998,7 @@ fi { #Grafana Dashboard if [ "$ENABLE_GRAFANA_DSH" = "yes" ]; then - echo "Grafana Dashboard will be enabled." + echo -e "\nGrafana Dashboard will be enabled." if [ "$MODE" = "debug" ]; then bash $PWD/grafana.sh -m debug else @@ -1005,7 +1007,7 @@ if [ "$ENABLE_GRAFANA_DSH" = "yes" ]; then fi #Docker Etherpad if [ "$ENABLE_DOCKERPAD" = "yes" ]; then - echo "Docker Etherpad will be enabled." + echo -e "\nDocker Etherpad will be enabled." if [ "$MODE" = "debug" ]; then bash $PWD/etherpad.sh -m debug else -- 2.34.1 From 0f39230327c7be3f621415879fa84926296bfa33 Mon Sep 17 00:00:00 2001 From: Ark74 Date: Mon, 5 Oct 2020 03:19:03 -0500 Subject: [PATCH 20/54] More echo updates --- jra_nextcloud.sh | 5 +++-- tools/jibri-conf-upgrade.sh | 4 +++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/jra_nextcloud.sh b/jra_nextcloud.sh index 15e3ee7..119d7ca 100644 --- a/jra_nextcloud.sh +++ b/jra_nextcloud.sh @@ -22,12 +22,13 @@ if ! [ $(id -u) = 0 ]; then fi clear -echo ' +echo -e '\n ######################################################################## Jibri Recordings Access via Nextcloud ######################################################################## by Software, IT & Networks Ltd -' +\n' + while [[ -z "$NC_DOMAIN" ]] do read -p "Please enter the domain to use for Nextcloud: " -r NC_DOMAIN diff --git a/tools/jibri-conf-upgrade.sh b/tools/jibri-conf-upgrade.sh index 0f93920..9928a98 100644 --- a/tools/jibri-conf-upgrade.sh +++ b/tools/jibri-conf-upgrade.sh @@ -32,7 +32,9 @@ fi echo "Checking for updates...." apt -q2 update -apt install -y apt-show-versions jq +apt install -y \ + apt-show-versions \ + jq echo -e "\n# Check for jibri\n" if [ "$(dpkg-query -W -f='${Status}' jibri 2>/dev/null | grep -c "ok installed")" == "1" ]; then -- 2.34.1 From 7ed92d783b929c82cf25dcc1b1aad2c52ee32ac5 Mon Sep 17 00:00:00 2001 From: Ark74 Date: Mon, 5 Oct 2020 03:45:01 -0500 Subject: [PATCH 21/54] Actually write sed changes --- add-jibri-node.sh | 4 ++-- quick_jibri_installer.sh | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/add-jibri-node.sh b/add-jibri-node.sh index 7154183..f9afa86 100644 --- a/add-jibri-node.sh +++ b/add-jibri-node.sh @@ -99,9 +99,9 @@ check_var JB_NAME "$JB_NAME" check_var JB_AUTH_PASS "$JB_AUTH_PASS" check_var JB_REC_PASS "$JB_REC_PASS" -#Rename hostname for each jibri node +# Rename hostname for each jibri node hostnamectl set-hostname "jbnode${ADDUP}.${MAIN_SRV_DOMAIN}" -sed "1i ${PUBLIC_IP} jbnode${ADDUP}.${MAIN_SRV_DOMAIN}" /etc/hosts +sed -i "1i ${PUBLIC_IP} jbnode${ADDUP}.${MAIN_SRV_DOMAIN}" /etc/hosts # Jitsi-Meet Repo echo "Add Jitsi repo" diff --git a/quick_jibri_installer.sh b/quick_jibri_installer.sh index 22bbb92..6e158c5 100644 --- a/quick_jibri_installer.sh +++ b/quick_jibri_installer.sh @@ -349,6 +349,10 @@ CERTBOT_REPO=$(apt-cache policy | grep http | grep certbot | head -n 1 | awk '{p CERTBOT_REL_FILE="http://ppa.launchpad.net/certbot/certbot/ubuntu/dists/$(lsb_release -sc)/Release" GC_SDK_REL_FILE="http://packages.cloud.google.com/apt/dists/cloud-sdk-$(lsb_release -sc)/Release" +# Rename hostname for jitsi server +#hostnamectl set-hostname "jibri.${DOMAIN}" +#sed -i "1i ${PUBLIC_IP} jibri.${DOMAIN}" /etc/hosts + #Sysadmin email while [[ -z $SYSADMIN_EMAIL ]] do -- 2.34.1 From aef27e6aeb59bdeea25eb834bf40865ad583e727 Mon Sep 17 00:00:00 2001 From: Ark74 Date: Mon, 5 Oct 2020 03:51:06 -0500 Subject: [PATCH 22/54] Add check system resources for additional jibri node --- add-jibri-node.sh | 44 ++++++++++++++++++++++++++++++++++++++++ quick_jibri_installer.sh | 2 +- 2 files changed, 45 insertions(+), 1 deletion(-) diff --git a/add-jibri-node.sh b/add-jibri-node.sh index f9afa86..1b0327c 100644 --- a/add-jibri-node.sh +++ b/add-jibri-node.sh @@ -86,6 +86,50 @@ if [ ! "$THIS_SRV_DIST" = "$MAIN_SRV_DIST" ]; then exit fi +#Check system resources +echo "Verifying System Resources:" +if [ "$(nproc --all)" -lt 4 ];then + echo " +Warning!: The system do not meet the minimum CPU requirements for Jibri to run. +>> We recommend 4 cores/threads for Jibri! +" + CPU_MIN="N" +else + echo "CPU Cores/Threads: OK ($(nproc --all))" + CPU_MIN="Y" +fi +### Test RAM size (8GB min) ### +mem_available=$(grep MemTotal /proc/meminfo| grep -o '[0-9]\+') +if [ ${mem_available} -lt 7700000 ]; then + echo " +Warning!: The system do not meet the minimum RAM requirements for Jibri to run. +>> We recommend 8GB RAM for Jibri! +" + MEM_MIN="N" +else + echo "Memory: OK ($((mem_available/1024)) MiB)" + MEM_MIN="Y" +fi +if [ "$CPU_MIN" = "Y" ] && [ "$MEM_MIN" = "Y" ];then + echo "All requirements seems meet!" + echo " + - We hope you have a nice recording/streaming session + " +else + echo "CPU ($(nproc --all))/RAM ($((mem_available/1024)) MiB) does NOT meet minimum recommended requirements!" + echo "Even when you can use the videconference sessions, we advice to increase the resources in order to user Jibri." + while [[ "$CONTINUE_LOW_RES" != "yes" && "$CONTINUE_LOW_RES" != "no" ]] + do + read -p "> Do you want to continue?: (yes or no)"$'\n' -r CONTINUE_LOW_RES + if [ "$CONTINUE_LOW_RES" = "no" ]; then + echo "See you next time with more resources!..." + exit + elif [ "$CONTINUE_LOW_RES" = "yes" ]; then + echo "Please keep in mind that trying to use Jibri with low resources might fail." + fi + done +fi + echo " #----------------------------------------------------------------------- # Checking initial necessary variables... diff --git a/quick_jibri_installer.sh b/quick_jibri_installer.sh index 6e158c5..3e88205 100644 --- a/quick_jibri_installer.sh +++ b/quick_jibri_installer.sh @@ -144,7 +144,7 @@ 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 -n 1 -s -r -p "Press any key to continue..."$'\n' fi -#Check resources +#Check system resources echo "Verifying System Resources:" if [ "$(nproc --all)" -lt 4 ];then echo " -- 2.34.1 From d17547d6e61f3d7e94d79f8731d940dc364e98db Mon Sep 17 00:00:00 2001 From: Ark74 Date: Mon, 5 Oct 2020 06:24:12 -0500 Subject: [PATCH 23/54] Add current kernel query --- tools/test-jibri-env.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/test-jibri-env.sh b/tools/test-jibri-env.sh index bfb3725..4d8929b 100644 --- a/tools/test-jibri-env.sh +++ b/tools/test-jibri-env.sh @@ -61,7 +61,8 @@ apt -y install --only-upgrade jibri echo -e "\n# -- Test kernel modules --\n" if [ -z $SND_AL_MODULE ]; then - echo -e "No module snd_aloop detected. <== IMPORTANT!\nIf you just installed a new kernel, \ + echo -e "No module snd_aloop detected. <== IMPORTANT! \nCurrent kernel: $(uname -r)" + echo -e "\nIf you just installed a new kernel, \ please try rebooting.\nFor now wait 'til the end of the recommended kernel installation." echo "# Check and Install HWE kernel if possible..." if [ "$HWE_VIR_MOD" == "1" ]; then -- 2.34.1 From ccebec493baf606dd695c7745a8aefc24ba0006b Mon Sep 17 00:00:00 2001 From: Ark74 Date: Mon, 5 Oct 2020 06:38:05 -0500 Subject: [PATCH 24/54] Only look for domain if directory exists --- tools/jibri-conf-upgrade.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/jibri-conf-upgrade.sh b/tools/jibri-conf-upgrade.sh index 9928a98..f80cec9 100644 --- a/tools/jibri-conf-upgrade.sh +++ b/tools/jibri-conf-upgrade.sh @@ -45,7 +45,9 @@ else exit fi +if [ -d /etc/prosody/ ];then DOMAIN=$(ls /etc/prosody/conf.d/ | grep -v localhost | awk -F'.cfg' '{print $1}' | awk '!NF || !seen[$0]++') +fi CONF_JSON="/etc/jitsi/jibri/config.json" JIBRI_CONF="/etc/jitsi/jibri/jibri.conf" DIR_RECORD=/var/jbrecord -- 2.34.1 From 6423695526fdddb17326fa4d74b1563f4d5fc047 Mon Sep 17 00:00:00 2001 From: Ark74 Date: Mon, 5 Oct 2020 06:41:22 -0500 Subject: [PATCH 25/54] Add tools --- add-jibri-node.sh | 2 ++ jra_nextcloud.sh | 4 ++-- quick_jibri_installer.sh | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/add-jibri-node.sh b/add-jibri-node.sh index 1b0327c..c04f5c0 100644 --- a/add-jibri-node.sh +++ b/add-jibri-node.sh @@ -193,6 +193,8 @@ apt-get -y install \ htop \ inotify-tools \ rsync \ + ssh \ + sshpass \ unzip \ wget diff --git a/jra_nextcloud.sh b/jra_nextcloud.sh index 119d7ca..1306ae3 100644 --- a/jra_nextcloud.sh +++ b/jra_nextcloud.sh @@ -91,10 +91,10 @@ fi echo -e "\n# Check for jitsi-meet/jibri\n" if [ "$(dpkg-query -W -f='${Status}' jibri 2>/dev/null | grep -c "ok installed")" == "1" ] || \ [ -f /etc/prosody/conf.d/$DOMAIN.conf ]; then - echo "jibri is installed, checking version:" + echo "jitsi meet/jibri is installed, checking version:" apt-show-versions jibri else - echo "Wait!, jibri or jitsi-meet is not installed on this system using apt, exiting..." + echo "Wait!, jitsi-meet/jibri is not installed on this system using apt, exiting..." exit fi diff --git a/quick_jibri_installer.sh b/quick_jibri_installer.sh index 3e88205..e2b260a 100644 --- a/quick_jibri_installer.sh +++ b/quick_jibri_installer.sh @@ -228,6 +228,7 @@ apt-get -y install \ letsencrypt \ net-tools \ rsync \ + ssh \ unzip \ wget -- 2.34.1 From 3a3bd4b89cabfbe001b4d35175ee4470a83b3c8b Mon Sep 17 00:00:00 2001 From: Ark74 Date: Mon, 5 Oct 2020 07:26:10 -0500 Subject: [PATCH 26/54] Improve kernel detection --- tools/test-jibri-env.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tools/test-jibri-env.sh b/tools/test-jibri-env.sh index 4d8929b..19641a1 100644 --- a/tools/test-jibri-env.sh +++ b/tools/test-jibri-env.sh @@ -65,6 +65,14 @@ if [ -z $SND_AL_MODULE ]; then echo -e "\nIf you just installed a new kernel, \ please try rebooting.\nFor now wait 'til the end of the recommended kernel installation." echo "# Check and Install HWE kernel if possible..." + if $(uname -r | grep aws);then + KNL_HWE="$(apt-cache madison linux-image-generic-hwe-$(lsb_release -sr)|head -n1|awk '{print$3}'|cut -d "." -f1-4)" + KNL_MENU="$(awk -F\' '/menuentry / {print $2}' /boot/grub/grub.cfg | grep generic | grep -v recovery | awk '{print$3,$4}'|grep $KNL_HWE)" + if [ ! -z "$KNL_MENU" ];then + echo -e "Seems you are using an AWS kernel! \nYou might consider modify your grub (/etc/default/grub) to use the following:" && \ + echo "$KNL_MENU" + fi + fi if [ "$HWE_VIR_MOD" == "1" ]; then apt-get -y install \ linux-image-generic-hwe-$(lsb_release -sr) \ -- 2.34.1 From 27d9aa5064d88cd4aedfd99f3e3b19f5585ffa6b Mon Sep 17 00:00:00 2001 From: Ark74 Date: Mon, 5 Oct 2020 14:42:15 -0500 Subject: [PATCH 27/54] Drop change group ownership --- jra_nextcloud.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jra_nextcloud.sh b/jra_nextcloud.sh index 1306ae3..7563d32 100644 --- a/jra_nextcloud.sh +++ b/jra_nextcloud.sh @@ -448,7 +448,7 @@ sudo -u www-data php $NC_PATH/occ app:enable files_external sudo -u www-data php $NC_PATH/occ files_external:import /tmp/jra-nc-app-ef.json usermod -a -G jibri www-data -chown -R jibri:www-data $DIR_RECORD +#chown -R jibri:www-data $DIR_RECORD chmod -R 770 $DIR_RECORD chmod -R g+s $DIR_RECORD -- 2.34.1 From 792f7caa8275ccd236aabcaf1ed446b191e4dab9 Mon Sep 17 00:00:00 2001 From: Ark74 Date: Mon, 5 Oct 2020 16:10:28 -0500 Subject: [PATCH 28/54] Testing node self sync --- add-jibri-node.sh | 81 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) diff --git a/add-jibri-node.sh b/add-jibri-node.sh index c04f5c0..cd9980e 100644 --- a/add-jibri-node.sh +++ b/add-jibri-node.sh @@ -42,6 +42,8 @@ JibriBrewery=TBD JB_NAME=TBD JB_AUTH_PASS=TBD JB_REC_PASS=TBD +MJS_USER=TBD +MJS_USER_PASS=TBD THIS_SRV_DIST=$(lsb_release -sc) JITSI_REPO=$(apt-cache policy | grep http | grep jitsi | grep stable | awk '{print $3}' | head -n 1 | cut -d "/" -f1) START=0 @@ -53,6 +55,9 @@ CHD_VER="$(curl -sL https://chromedriver.storage.googleapis.com/LATEST_RELEASE)" GOOGL_REPO="/etc/apt/sources.list.d/dl_google_com_linux_chrome_deb.list" GCMP_JSON="/etc/opt/chrome/policies/managed/managed_policies.json" PUBLIC_IP="$(dig -4 @resolver1.opendns.com ANY myip.opendns.com +short)" +NJN_RAND_TAIL="$(tr -dc "a-zA-Z0-9" < /dev/urandom | fold -w 4 | head -n1)" +NJN_USER="jbnode${ADDUP}_${NJN_RAND_TAIL}" +NJN_USER_PASS="$(tr -dc "a-zA-Z0-9#_*=" < /dev/urandom | fold -w 32 | head -n1)" ### 1_VAR_DEF # sed limiters for add-jibri-node.sh variables @@ -354,6 +359,82 @@ jibri { } NEW_CONF +echo -e "\n---- Create random nodesync user ----" +useradd -m -g jibri $NJN_USER +echo "$NJN_USER:$NJN_USER_PASS" | chpasswd + +#Create ssh key +sudo su $NJN_USER -c "ssh-keygen -t rsa -f ~/.ssh/id_rsa -b 4096 -o -a 100 -q -N ''" +ssh $MJS_USER@$MAIN_SRV_DOMAIN sh -c "'cat >> .ssh/authorized_keys'" < /home/$NJN_USER/.ssh/id_rsa.pub + +echo -e "\n---- Setup Log system ----" +cat << INOT_RSYNC > /etc/jitsi/jibri/remote-jbsync.sh +#!/bin/bash + +# Log process +exec 3>&1 4>&2 +trap 'exec 2>&4 1>&3' 0 1 2 3 +exec 1>/var/log/$NJN_USER/remote_jnsync.log 2>&1 + +# Run sync +while true; do + inotifywait -t 60 -r -e modify,attrib,close_write,move,delete $DIR_RECORD + sudo su $NJN_USER -c "rsync -Aax --info=progress2 --remove-source-files --exclude '.*/' $DIR_RECORD/ $MJS_USER@$MAIN_SRV_DOMAIN:$DIR_RECORD" && \\ + find $DIR_RECORD -depth -type d -empty -not -path $DIR_RECORD -delete +done +INOT_RSYNC + + +mkdir /var/log/$NJN_USER + +cat << LOG_ROT >> /etc/logrotate.d/$NJN_USER +/var/log/$NJN_USER/*.log { + monthly + missingok + rotate 12 + compress + notifempty + create 0640 root root + sharedscripts + postrotate + service remote_jnsync restart + endscript +} +LOG_ROT + +echo -e "\n---- Create systemd service file ----" +cat << REMOTE_SYNC_SERVICE > /etc/systemd/system/remote_jnsync.service +[Unit] +Description = Sync Node to Main Jibri Service +After = network.target + +[Service] +PIDFile = /run/syncservice/remote_jnsync.pid +User = root +Group = root +WorkingDirectory = /var +ExecStartPre = /bin/mkdir /run/syncservice +ExecStartPre = /bin/chown -R root:root /run/syncservice +ExecStart = /bin/bash /etc/jitsi/jibri/remote-jbsync.sh +ExecReload = /bin/kill -s HUP \$MAINPID +ExecStop = /bin/kill -s TERM \$MAINPID +ExecStopPost = /bin/rm -rf /run/syncservice +PrivateTmp = true + +[Install] +WantedBy = multi-user.target +REMOTE_SYNC_SERVICE + +chmod 755 /etc/systemd/system/remote_jnsync.service +systemctl daemon-reload + +systemctl enable remote_jnsync.service +systemctl start remote_jnsync.service + +echo "Copying updated add-jibri-node.sh file to main server sync user..." +cp $PWD/add-jibri-node.sh /tmp +sudo su $NJN_USER -c "scp /tmp/add-jibri-node.sh $MJS_USER@$MAIN_SRV_DOMAIN:/home/$MJS_USER" + echo "Writting last node number..." sed -i "$(var_dlim 0_VAR),$(var_dlim 1_VAR){s|LAST=.*|LAST=$ADDUP|}" add-jibri-node.sh sed -i "$(var_dlim 0_LAST),$(var_dlim 1_LAST){s|LETS: .*|LETS: $(date -R)|}" add-jibri-node.sh -- 2.34.1 From 073a8243aba0f8e68442304e3bfe1410b6f0f3a5 Mon Sep 17 00:00:00 2001 From: Ark74 Date: Mon, 5 Oct 2020 16:11:06 -0500 Subject: [PATCH 29/54] Add user and user variables --- quick_jibri_installer.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/quick_jibri_installer.sh b/quick_jibri_installer.sh index e2b260a..2fc5f18 100644 --- a/quick_jibri_installer.sh +++ b/quick_jibri_installer.sh @@ -349,6 +349,9 @@ ENABLE_SA="yes" CERTBOT_REPO=$(apt-cache policy | grep http | grep certbot | head -n 1 | awk '{print $2}' | cut -d "/" -f4) CERTBOT_REL_FILE="http://ppa.launchpad.net/certbot/certbot/ubuntu/dists/$(lsb_release -sc)/Release" GC_SDK_REL_FILE="http://packages.cloud.google.com/apt/dists/cloud-sdk-$(lsb_release -sc)/Release" +MJS_RAND_TAIL="$(tr -dc "a-zA-Z0-9" < /dev/urandom | fold -w 4 | head -n1)" +MJS_USER="jbsync_$MJS_RAND_TAIL" +MJS_USER_PASS="$(tr -dc "a-zA-Z0-9#_*=" < /dev/urandom | fold -w 32 | head -n1)" # Rename hostname for jitsi server #hostnamectl set-hostname "jibri.${DOMAIN}" @@ -814,6 +817,15 @@ jibri { } } NEW_CONF +#Create receiver user +useradd -m -g jibri $MJS_USER +echo "$MJS_USER:$MJS_USER_PASS" | chpasswd + +#Create ssh key and restrict connections +sudo su $MJS_USER -c "ssh-keygen -t rsa -f ~/.ssh/id_rsa -b 4096 -o -a 100 -q -N ''" +#sudo su $MJS_USER -c "rm ~/.ssh/id_rsa.pub" +#sudo su $MJS_USER -c "cat ~/.ssh/authorized_keys" + #Setting varibales for add-jibri-node.sh sed -i "s|MAIN_SRV_DIST=.*|MAIN_SRV_DIST=\"$DIST\"|" add-jibri-node.sh @@ -823,6 +835,8 @@ sed -i "s|JB_NAME=.*|JB_NAME=\"$JB_NAME\"|" add-jibri-node.sh sed -i "s|JibriBrewery=.*|JibriBrewery=\"$JibriBrewery\"|" add-jibri-node.sh sed -i "s|JB_AUTH_PASS=.*|JB_AUTH_PASS=\"$JB_AUTH_PASS\"|" add-jibri-node.sh sed -i "s|JB_REC_PASS=.*|JB_REC_PASS=\"$JB_REC_PASS\"|" add-jibri-node.sh +sed -i "s|MJS_USER=.*|MJS_USER=\"$MJS_USER\"|" add-jibri-node.sh +sed -i "s|MJS_USER_PASS=.*|MJS_USER_PASS=\"$MJS_USER_PASS\"|" add-jibri-node.sh sed -i "$(var_dlim 0_LAST),$(var_dlim 1_LAST){s|LETS: .*|LETS: $(date -R)|}" add-jibri-node.sh echo "Last file edition at: $(grep "LETS:" add-jibri-node.sh|head -n1|awk -F'LETS:' '{print$2}')" -- 2.34.1 From c3d5edba2273bcd56d371407f481beb63fe2866d Mon Sep 17 00:00:00 2001 From: Ark74 Date: Mon, 5 Oct 2020 18:15:34 -0500 Subject: [PATCH 30/54] Add temp workaround --- add-jibri-node.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/add-jibri-node.sh b/add-jibri-node.sh index cd9980e..1f20046 100644 --- a/add-jibri-node.sh +++ b/add-jibri-node.sh @@ -366,6 +366,9 @@ echo "$NJN_USER:$NJN_USER_PASS" | chpasswd #Create ssh key sudo su $NJN_USER -c "ssh-keygen -t rsa -f ~/.ssh/id_rsa -b 4096 -o -a 100 -q -N ''" ssh $MJS_USER@$MAIN_SRV_DOMAIN sh -c "'cat >> .ssh/authorized_keys'" < /home/$NJN_USER/.ssh/id_rsa.pub +#Temp Workaround +echo "Please manually accept the connection by executing: ssh $MJS_USER@$MAIN_SRV_DOMAIN ...then exit" +su $NJN_USER echo -e "\n---- Setup Log system ----" cat << INOT_RSYNC > /etc/jitsi/jibri/remote-jbsync.sh -- 2.34.1 From c0d54d8d7e33335f175489bbb3abd7673389d3ac Mon Sep 17 00:00:00 2001 From: Ark74 Date: Mon, 5 Oct 2020 18:40:56 -0500 Subject: [PATCH 31/54] Fix if condition --- tools/test-jibri-env.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/test-jibri-env.sh b/tools/test-jibri-env.sh index 19641a1..0262c71 100644 --- a/tools/test-jibri-env.sh +++ b/tools/test-jibri-env.sh @@ -65,11 +65,11 @@ if [ -z $SND_AL_MODULE ]; then echo -e "\nIf you just installed a new kernel, \ please try rebooting.\nFor now wait 'til the end of the recommended kernel installation." echo "# Check and Install HWE kernel if possible..." - if $(uname -r | grep aws);then + if uname -r | grep -q aws;then KNL_HWE="$(apt-cache madison linux-image-generic-hwe-$(lsb_release -sr)|head -n1|awk '{print$3}'|cut -d "." -f1-4)" KNL_MENU="$(awk -F\' '/menuentry / {print $2}' /boot/grub/grub.cfg | grep generic | grep -v recovery | awk '{print$3,$4}'|grep $KNL_HWE)" if [ ! -z "$KNL_MENU" ];then - echo -e "Seems you are using an AWS kernel! \nYou might consider modify your grub (/etc/default/grub) to use the following:" && \ + echo -e "\nSeems you are using an AWS kernel <== IMPORTANT! \nYou might consider modify your grub (/etc/default/grub) to use the following:" && \ echo "$KNL_MENU" fi fi -- 2.34.1 From 79e9774c9e705b42e2667ed69dcec942880dffe3 Mon Sep 17 00:00:00 2001 From: Ark74 Date: Mon, 5 Oct 2020 18:41:21 -0500 Subject: [PATCH 32/54] Add new dependencies --- add-jibri-node.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/add-jibri-node.sh b/add-jibri-node.sh index 1f20046..c58cb89 100644 --- a/add-jibri-node.sh +++ b/add-jibri-node.sh @@ -191,15 +191,16 @@ apt-get update -q2 apt-get dist-upgrade -yq2 apt-get -y install \ + apt-show-versions \ bmon \ curl \ ffmpeg \ git \ htop \ inotify-tools \ + jq \ rsync \ ssh \ - sshpass \ unzip \ wget -- 2.34.1 From 7eb9d45117d43a78497b03177dba1f4e9b6d7955 Mon Sep 17 00:00:00 2001 From: Ark74 Date: Mon, 5 Oct 2020 21:10:29 -0500 Subject: [PATCH 33/54] Check other variables --- add-jibri-node.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/add-jibri-node.sh b/add-jibri-node.sh index c58cb89..150bc28 100644 --- a/add-jibri-node.sh +++ b/add-jibri-node.sh @@ -147,6 +147,8 @@ check_var JibriBrewery "$JibriBrewery" check_var JB_NAME "$JB_NAME" check_var JB_AUTH_PASS "$JB_AUTH_PASS" check_var JB_REC_PASS "$JB_REC_PASS" +check_var MJS_USER "$MJS_USER" +check_var MJS_USER_PASS "$MJS_USER_PASS" # Rename hostname for each jibri node hostnamectl set-hostname "jbnode${ADDUP}.${MAIN_SRV_DOMAIN}" @@ -366,6 +368,7 @@ echo "$NJN_USER:$NJN_USER_PASS" | chpasswd #Create ssh key sudo su $NJN_USER -c "ssh-keygen -t rsa -f ~/.ssh/id_rsa -b 4096 -o -a 100 -q -N ''" +echo "$NJN_USER:$NJN_USER_PASS" ssh $MJS_USER@$MAIN_SRV_DOMAIN sh -c "'cat >> .ssh/authorized_keys'" < /home/$NJN_USER/.ssh/id_rsa.pub #Temp Workaround echo "Please manually accept the connection by executing: ssh $MJS_USER@$MAIN_SRV_DOMAIN ...then exit" -- 2.34.1 From 10eb4ff83ddf6683d2128109581d4832edbde0e0 Mon Sep 17 00:00:00 2001 From: Ark74 Date: Tue, 6 Oct 2020 22:25:39 -0500 Subject: [PATCH 34/54] Rearrange add-jibri-node and test auth method --- add-jibri-node.sh | 96 +++++++++++++++++++++++++++++++---------------- 1 file changed, 64 insertions(+), 32 deletions(-) diff --git a/add-jibri-node.sh b/add-jibri-node.sh index 150bc28..1b035f7 100644 --- a/add-jibri-node.sh +++ b/add-jibri-node.sh @@ -58,6 +58,9 @@ PUBLIC_IP="$(dig -4 @resolver1.opendns.com ANY myip.opendns.com +short)" NJN_RAND_TAIL="$(tr -dc "a-zA-Z0-9" < /dev/urandom | fold -w 4 | head -n1)" NJN_USER="jbnode${ADDUP}_${NJN_RAND_TAIL}" NJN_USER_PASS="$(tr -dc "a-zA-Z0-9#_*=" < /dev/urandom | fold -w 32 | head -n1)" +GITHUB_RAW="https://raw.githubusercontent.com" +GIT_REPO="switnet-ltd/quick-jibri-installer" +TEST_JIBRI_ENV="$GITHUB_RAW/$GIT_REPO/unstable/tools/test-jibri-env.sh" ### 1_VAR_DEF # sed limiters for add-jibri-node.sh variables @@ -67,12 +70,12 @@ var_dlim() { check_var() { if [ -z "$2" ]; then - echo "$1 is not defined, please check. Exiting..." + echo -e "Check if variable $1 is set: \xE2\x9C\x96 \nExiting..." exit else - echo "$1 is set to: $2" + echo -e "Check if variable $1 is set: \xE2\x9C\x94" fi - } +} if [ -z "$LAST" ]; then echo "There is an error on the LAST definition, please report." @@ -168,25 +171,6 @@ else echo "Jitsi $JITSI_REPO repository already installed" 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 " -#----------------------------------------------------------------------- -# Your audio driver might not be able to load, once the installation -# is complete and server restarted, please run: \`lsmod | grep snd_aloop' -# to make sure it did. If not, any feedback for your setup is welcome. -#-----------------------------------------------------------------------" -read -n 1 -s -r -p "Press any key to continue..."$'\n' -fi -} - # Requirements echo "We'll start by installing system requirements this may take a while please be patient..." apt-get update -q2 @@ -196,6 +180,7 @@ apt-get -y install \ apt-show-versions \ bmon \ curl \ + expect \ ffmpeg \ git \ htop \ @@ -206,6 +191,35 @@ apt-get -y install \ unzip \ wget +check_snd_driver() { +# ALSA - Loopback +echo "snd-aloop" | tee -a /etc/modules +modprobe snd-aloop +if [ "$(lsmod | grep snd_aloop | head -n 1 | cut -d " " -f1)" = "snd_aloop" ]; then + echo " +#----------------------------------------------------------------------- +# Audio driver seems - OK. +#-----------------------------------------------------------------------" +else + echo " +#----------------------------------------------------------------------- +# Your audio driver might not be able to load. +# We'll check the state of this Jibri with our 'test-jibri-env.sh' tool. +#-----------------------------------------------------------------------" +read -n 1 -s -r -p "Press any key to continue..."$'\n' +curl -s \ +$TEST_JIBRI_ENV \ +> /tmp/test-jibri-env.sh +#Test tool + if [ "$MODE" = "debug" ]; then + bash /tmp/test-jibri-env.sh -m debug + else + bash /tmp/test-jibri-env.sh + fi +rm /tmp/test-jibri-env.sh +fi +} + echo "# Check and Install HWE kernel if possible..." HWE_VIR_MOD=$(apt-cache madison linux-modules-extra-virtual-hwe-$(lsb_release -sr) 2>/dev/null|head -n1|grep -c "extra-virtual-hwe") if [ "$HWE_VIR_MOD" == "1" ]; then @@ -217,8 +231,6 @@ if [ "$HWE_VIR_MOD" == "1" ]; then linux-modules-extra-$(uname -r) fi -check_snd_driver - echo " #-------------------------------------------------- # Install Jibri @@ -368,11 +380,29 @@ echo "$NJN_USER:$NJN_USER_PASS" | chpasswd #Create ssh key sudo su $NJN_USER -c "ssh-keygen -t rsa -f ~/.ssh/id_rsa -b 4096 -o -a 100 -q -N ''" -echo "$NJN_USER:$NJN_USER_PASS" +echo "Remote pass: $MJS_USER_PASS" ssh $MJS_USER@$MAIN_SRV_DOMAIN sh -c "'cat >> .ssh/authorized_keys'" < /home/$NJN_USER/.ssh/id_rsa.pub +sudo su $NJN_USER -c "ssh-keyscan -t rsa $MAIN_SRV_DOMAIN >> /home/$NJN_USER/.ssh/known_hosts" #Temp Workaround -echo "Please manually accept the connection by executing: ssh $MJS_USER@$MAIN_SRV_DOMAIN ...then exit" -su $NJN_USER +#cat << CONFIRM_SSH_LOGIN > /tmp/${NJN_USER}_login +##!/usr/local/bin/expect +#spawn sftp -b cmdFile user@yourserver.com +#expect "password:" +#send "shhh!\n"; +#interact +#set -x +#expect { + #spawn ssh $MJS_USER@$MAIN_SRV_DOMAIN + #"(Are you sure you want to continue connecting yes/no)?" { send "yes\r"; exp_continue } +#} +#set +x +#read -n 1 -s -r -p "Press any key to continue..."$'\n' +#exit +#CONFIRM_SSH_LOGIN +#sudo -u $NJN_USER bash /tmp/${NJN_USER}_login +#rm /tmp/${NJN_USER}_login +#echo "Please manually accept the connection by executing: ssh $MJS_USER@$MAIN_SRV_DOMAIN ...then exit" +#su $NJN_USER echo -e "\n---- Setup Log system ----" cat << INOT_RSYNC > /etc/jitsi/jibri/remote-jbsync.sh @@ -386,7 +416,7 @@ exec 1>/var/log/$NJN_USER/remote_jnsync.log 2>&1 # Run sync while true; do inotifywait -t 60 -r -e modify,attrib,close_write,move,delete $DIR_RECORD - sudo su $NJN_USER -c "rsync -Aax --info=progress2 --remove-source-files --exclude '.*/' $DIR_RECORD/ $MJS_USER@$MAIN_SRV_DOMAIN:$DIR_RECORD" && \\ + sudo su $NJN_USER -c "rsync -Aax --info=progress2 --remove-source-files --exclude '.*/' $DIR_RECORD/ $MJS_USER@$MAIN_SRV_DOMAIN:$DIR_RECORD" find $DIR_RECORD -depth -type d -empty -not -path $DIR_RECORD -delete done INOT_RSYNC @@ -438,10 +468,6 @@ systemctl daemon-reload systemctl enable remote_jnsync.service systemctl start remote_jnsync.service -echo "Copying updated add-jibri-node.sh file to main server sync user..." -cp $PWD/add-jibri-node.sh /tmp -sudo su $NJN_USER -c "scp /tmp/add-jibri-node.sh $MJS_USER@$MAIN_SRV_DOMAIN:/home/$MJS_USER" - echo "Writting last node number..." sed -i "$(var_dlim 0_VAR),$(var_dlim 1_VAR){s|LAST=.*|LAST=$ADDUP|}" add-jibri-node.sh sed -i "$(var_dlim 0_LAST),$(var_dlim 1_LAST){s|LETS: .*|LETS: $(date -R)|}" add-jibri-node.sh @@ -452,6 +478,12 @@ systemctl enable jibri systemctl enable jibri-xorg systemctl enable jibri-icewm +echo "Copying updated add-jibri-node.sh file to main server sync user..." +cp $PWD/add-jibri-node.sh /tmp +sudo -u $NJN_USER scp /tmp/add-jibri-node.sh $MJS_USER@$MAIN_SRV_DOMAIN:/home/$MJS_USER/ + +check_snd_driver + echo " ######################################################################## Node addition complete!! -- 2.34.1 From 3dc0e2b4aa5eabfdb27a2c207f2a66ed133b5f04 Mon Sep 17 00:00:00 2001 From: Ark74 Date: Tue, 6 Oct 2020 22:29:13 -0500 Subject: [PATCH 35/54] Rearrange check function and 'test-jibri-env.sh' to main installer --- quick_jibri_installer.sh | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/quick_jibri_installer.sh b/quick_jibri_installer.sh index 2fc5f18..f23651b 100644 --- a/quick_jibri_installer.sh +++ b/quick_jibri_installer.sh @@ -62,8 +62,9 @@ Installing nginx webserver! fi } check_snd_driver() { +# ALSA - Loopback +echo "snd-aloop" | tee -a /etc/modules modprobe snd-aloop -echo "snd-aloop" >> /etc/modules if [ "$(lsmod | grep snd_aloop | head -n 1 | cut -d " " -f1)" = "snd_aloop" ]; then echo " #----------------------------------------------------------------------- @@ -72,11 +73,16 @@ if [ "$(lsmod | grep snd_aloop | head -n 1 | cut -d " " -f1)" = "snd_aloop" ]; t else echo " #----------------------------------------------------------------------- -# Your audio driver might not be able to load, once the installation -# is complete and server restarted, please run: \`lsmod | grep snd_aloop' -# to make sure it did. If not, any feedback for your setup is welcome. +# Your audio driver might not be able to load. +# We'll check the state of this Jibri with our 'test-jibri-env.sh' tool. #-----------------------------------------------------------------------" read -n 1 -s -r -p "Press any key to continue..."$'\n' +#Test tool + if [ "$MODE" = "debug" ]; then + bash $PWD/tools/test-jibri-env.sh -m debug + else + bash $PWD/tools/test-jibri-env.sh + fi fi } # sed limiters for add-jibri-node.sh variables @@ -283,9 +289,6 @@ 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 CHD_VER=$(curl -sL https://chromedriver.storage.googleapis.com/LATEST_RELEASE) GCMP_JSON="/etc/opt/chrome/policies/managed/managed_policies.json" @@ -1041,6 +1044,8 @@ else echo "Local host already in place..." fi +check_snd_driver + echo " ######################################################################## Installation complete!! -- 2.34.1 From 6a048315aeb9c2755ca81a09d84aea3238522f24 Mon Sep 17 00:00:00 2001 From: Ark74 Date: Wed, 7 Oct 2020 05:11:40 -0500 Subject: [PATCH 36/54] Clean workarounds --- add-jibri-node.sh | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/add-jibri-node.sh b/add-jibri-node.sh index 1b035f7..e056b00 100644 --- a/add-jibri-node.sh +++ b/add-jibri-node.sh @@ -383,26 +383,6 @@ sudo su $NJN_USER -c "ssh-keygen -t rsa -f ~/.ssh/id_rsa -b 4096 -o -a 100 -q -N echo "Remote pass: $MJS_USER_PASS" ssh $MJS_USER@$MAIN_SRV_DOMAIN sh -c "'cat >> .ssh/authorized_keys'" < /home/$NJN_USER/.ssh/id_rsa.pub sudo su $NJN_USER -c "ssh-keyscan -t rsa $MAIN_SRV_DOMAIN >> /home/$NJN_USER/.ssh/known_hosts" -#Temp Workaround -#cat << CONFIRM_SSH_LOGIN > /tmp/${NJN_USER}_login -##!/usr/local/bin/expect -#spawn sftp -b cmdFile user@yourserver.com -#expect "password:" -#send "shhh!\n"; -#interact -#set -x -#expect { - #spawn ssh $MJS_USER@$MAIN_SRV_DOMAIN - #"(Are you sure you want to continue connecting yes/no)?" { send "yes\r"; exp_continue } -#} -#set +x -#read -n 1 -s -r -p "Press any key to continue..."$'\n' -#exit -#CONFIRM_SSH_LOGIN -#sudo -u $NJN_USER bash /tmp/${NJN_USER}_login -#rm /tmp/${NJN_USER}_login -#echo "Please manually accept the connection by executing: ssh $MJS_USER@$MAIN_SRV_DOMAIN ...then exit" -#su $NJN_USER echo -e "\n---- Setup Log system ----" cat << INOT_RSYNC > /etc/jitsi/jibri/remote-jbsync.sh -- 2.34.1 From 02074e7a338944b17b8292578400b13993875fa1 Mon Sep 17 00:00:00 2001 From: Ark74 Date: Wed, 7 Oct 2020 05:13:32 -0500 Subject: [PATCH 37/54] Allowing password auth for initial node validation --- quick_jibri_installer.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/quick_jibri_installer.sh b/quick_jibri_installer.sh index f23651b..5a7cdee 100644 --- a/quick_jibri_installer.sh +++ b/quick_jibri_installer.sh @@ -826,6 +826,10 @@ echo "$MJS_USER:$MJS_USER_PASS" | chpasswd #Create ssh key and restrict connections sudo su $MJS_USER -c "ssh-keygen -t rsa -f ~/.ssh/id_rsa -b 4096 -o -a 100 -q -N ''" +#Allow password authentication +sed -i "s|PasswordAuthentication .*|PasswordAuthentication yes|" /etc/ssh/sshd_config +systemctl restart sshd + #sudo su $MJS_USER -c "rm ~/.ssh/id_rsa.pub" #sudo su $MJS_USER -c "cat ~/.ssh/authorized_keys" -- 2.34.1 From 5c2f0576c84bee224a89f78b4ac0c09d7e80be09 Mon Sep 17 00:00:00 2001 From: Ark74 Date: Wed, 7 Oct 2020 05:21:04 -0500 Subject: [PATCH 38/54] Update check snd driver --- add-jibri-node.sh | 6 ++---- quick_jibri_installer.sh | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/add-jibri-node.sh b/add-jibri-node.sh index e056b00..488f21c 100644 --- a/add-jibri-node.sh +++ b/add-jibri-node.sh @@ -206,10 +206,7 @@ else # Your audio driver might not be able to load. # We'll check the state of this Jibri with our 'test-jibri-env.sh' tool. #-----------------------------------------------------------------------" -read -n 1 -s -r -p "Press any key to continue..."$'\n' -curl -s \ -$TEST_JIBRI_ENV \ -> /tmp/test-jibri-env.sh +curl -s $TEST_JIBRI_ENV > /tmp/test-jibri-env.sh #Test tool if [ "$MODE" = "debug" ]; then bash /tmp/test-jibri-env.sh -m debug @@ -217,6 +214,7 @@ $TEST_JIBRI_ENV \ bash /tmp/test-jibri-env.sh fi rm /tmp/test-jibri-env.sh +read -n 1 -s -r -p "Press any key to continue..."$'\n' fi } diff --git a/quick_jibri_installer.sh b/quick_jibri_installer.sh index 5a7cdee..89962f2 100644 --- a/quick_jibri_installer.sh +++ b/quick_jibri_installer.sh @@ -76,13 +76,13 @@ else # Your audio driver might not be able to load. # We'll check the state of this Jibri with our 'test-jibri-env.sh' tool. #-----------------------------------------------------------------------" -read -n 1 -s -r -p "Press any key to continue..."$'\n' #Test tool if [ "$MODE" = "debug" ]; then bash $PWD/tools/test-jibri-env.sh -m debug else bash $PWD/tools/test-jibri-env.sh fi +read -n 1 -s -r -p "Press any key to continue..."$'\n' fi } # sed limiters for add-jibri-node.sh variables -- 2.34.1 From 7ff3f961cd1c2d46362edbeab6edf9d3875d86f9 Mon Sep 17 00:00:00 2001 From: Ark74 Date: Wed, 7 Oct 2020 13:17:56 -0500 Subject: [PATCH 39/54] Removing sensitive file from node. --- add-jibri-node.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/add-jibri-node.sh b/add-jibri-node.sh index 488f21c..bddc94f 100644 --- a/add-jibri-node.sh +++ b/add-jibri-node.sh @@ -192,7 +192,7 @@ apt-get -y install \ wget check_snd_driver() { -# ALSA - Loopback +echo -e "\n# Checking ALSA - Loopback module..." echo "snd-aloop" | tee -a /etc/modules modprobe snd-aloop if [ "$(lsmod | grep snd_aloop | head -n 1 | cut -d " " -f1)" = "snd_aloop" ]; then @@ -376,7 +376,8 @@ echo -e "\n---- Create random nodesync user ----" useradd -m -g jibri $NJN_USER echo "$NJN_USER:$NJN_USER_PASS" | chpasswd -#Create ssh key +echo -e "\n---- We'll connect to main server ----" +read -n 1 -s -r -p "Press any key to continue..."$'\n' sudo su $NJN_USER -c "ssh-keygen -t rsa -f ~/.ssh/id_rsa -b 4096 -o -a 100 -q -N ''" echo "Remote pass: $MJS_USER_PASS" ssh $MJS_USER@$MAIN_SRV_DOMAIN sh -c "'cat >> .ssh/authorized_keys'" < /home/$NJN_USER/.ssh/id_rsa.pub @@ -456,9 +457,10 @@ systemctl enable jibri systemctl enable jibri-xorg systemctl enable jibri-icewm -echo "Copying updated add-jibri-node.sh file to main server sync user..." +echo -e "\nSending updated add-jibri-node.sh file to main server sync user..." cp $PWD/add-jibri-node.sh /tmp sudo -u $NJN_USER scp /tmp/add-jibri-node.sh $MJS_USER@$MAIN_SRV_DOMAIN:/home/$MJS_USER/ +rm $PWD/add-jibri-node.sh /tmp/add-jibri-node.sh check_snd_driver -- 2.34.1 From 748cc905b973cfb260191915629cf3478937c5b0 Mon Sep 17 00:00:00 2001 From: Ark74 Date: Wed, 7 Oct 2020 13:19:20 -0500 Subject: [PATCH 40/54] minor visual style --- quick_jibri_installer.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quick_jibri_installer.sh b/quick_jibri_installer.sh index 89962f2..d3884c7 100644 --- a/quick_jibri_installer.sh +++ b/quick_jibri_installer.sh @@ -62,7 +62,7 @@ Installing nginx webserver! fi } check_snd_driver() { -# ALSA - Loopback +echo -e "\n# Checking ALSA - Loopback module..." echo "snd-aloop" | tee -a /etc/modules modprobe snd-aloop if [ "$(lsmod | grep snd_aloop | head -n 1 | cut -d " " -f1)" = "snd_aloop" ]; then -- 2.34.1 From f1185d95d5daa1cd8f63df882071264f8bf76c34 Mon Sep 17 00:00:00 2001 From: Ark74 Date: Wed, 7 Oct 2020 16:58:51 -0500 Subject: [PATCH 41/54] Only try to upgrade if necessary, also make sure the recommended kernel is installed. --- tools/test-jibri-env.sh | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/tools/test-jibri-env.sh b/tools/test-jibri-env.sh index 0262c71..6a54700 100644 --- a/tools/test-jibri-env.sh +++ b/tools/test-jibri-env.sh @@ -56,23 +56,16 @@ else exit fi -echo -e "\nAttempting (any possible) jibri upgrade!" +if [ "$(apt-show-versions jibri | grep -c "uptodate")" = "1" ]; then +echo -e "Jibri is already up to date: \xE2\x9C\x94" +else +echo -e "\nAttempting jibri upgrade!" apt -y install --only-upgrade jibri +fi echo -e "\n# -- Test kernel modules --\n" if [ -z $SND_AL_MODULE ]; then - echo -e "No module snd_aloop detected. <== IMPORTANT! \nCurrent kernel: $(uname -r)" - echo -e "\nIf you just installed a new kernel, \ -please try rebooting.\nFor now wait 'til the end of the recommended kernel installation." - echo "# Check and Install HWE kernel if possible..." - if uname -r | grep -q aws;then - KNL_HWE="$(apt-cache madison linux-image-generic-hwe-$(lsb_release -sr)|head -n1|awk '{print$3}'|cut -d "." -f1-4)" - KNL_MENU="$(awk -F\' '/menuentry / {print $2}' /boot/grub/grub.cfg | grep generic | grep -v recovery | awk '{print$3,$4}'|grep $KNL_HWE)" - if [ ! -z "$KNL_MENU" ];then - echo -e "\nSeems you are using an AWS kernel <== IMPORTANT! \nYou might consider modify your grub (/etc/default/grub) to use the following:" && \ - echo "$KNL_MENU" - fi - fi +#First make sure the recommended kernel is installed. if [ "$HWE_VIR_MOD" == "1" ]; then apt-get -y install \ linux-image-generic-hwe-$(lsb_release -sr) \ @@ -81,6 +74,18 @@ please try rebooting.\nFor now wait 'til the end of the recommended kernel insta apt-get -y install \ linux-modules-extra-$(uname -r) fi + echo -e "No module snd_aloop detected. \xE2\x9C\x96 <== IMPORTANT! \nCurrent kernel: $(uname -r)" + echo -e "\nIf you just installed a new kernel, \ +please try rebooting.\nFor now wait 'til the end of the recommended kernel installation." + echo "# Check and Install HWE kernel if possible..." + if uname -r | grep -q aws;then + KNL_HWE="$(apt-cache madison linux-image-generic-hwe-$(lsb_release -sr)|head -n1|awk '{print$3}'|cut -d "." -f1-4)" + KNL_MENU="$(awk -F\' '/menuentry / {print $2}' /boot/grub/grub.cfg | grep generic | grep -v recovery | awk '{print$3,$4}'|grep $KNL_HWE)" + if [ ! -z "$KNL_MENU" ];then + echo -e "\nSeems you are using an AWS kernel \xE2\x9C\x96 <== IMPORTANT! \nYou might consider modify your grub (/etc/default/grub) to use the following:" && \ + echo -e "\n > $KNL_MENU" + fi + fi else echo -e "Great!\nModule snd-aloop found!" fi -- 2.34.1 From 92e6e36a79d2c776ab71d7b649574687d65043b5 Mon Sep 17 00:00:00 2001 From: Ark74 Date: Thu, 8 Oct 2020 10:38:39 -0500 Subject: [PATCH 42/54] Add recommendation on resources and jibri nodes. --- README.md | 46 +++++++++++++++++++++++++++++++--------- add-jibri-node.sh | 7 +++--- quick_jibri_installer.sh | 38 ++++++++++++++++++++++++++++++++- 3 files changed, 77 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index e70e88f..111df8b 100644 --- a/README.md +++ b/README.md @@ -1,49 +1,75 @@ # Quick Jibri Installer -Bash installer for Jibri on **\*buntu LTS** based systems using **nginx** as default webserver. +Bash installer for Jibri on **Ubuntu LTS** based systems using **nginx** as default webserver. ## Usage +As for our current latest release, as we have integrated more and more features, we highly recommend to use a purpose specific-newly spawn server to host the jitsi-meet framework, making sure you stick to the requirements and recommendations as much as possible, in order to avoid issues. + + +### Main Server +Login into your clean server, clone git repository and run the installer, ``` git clone https://github.com/switnet-ltd/quick-jibri-installer cd quick-jibri-installer bash quick-jibri-installer.sh ``` -Please check more details on our wiki. + +### Add Jibri node + +Copy the modified `add-jibri-node.sh` file from your early cloned installation directory once it's completed to the new server meant to be a jibri node using your preferred method, then run it + +**WARNING:** This file contains sensitive information from your setup, please handle with care. + +``` +bash add-jibri-node.sh +``` + + +Check more details on our wiki. ## Requirements * Clean VM/VPS/Server using Ubuntu LTS * Valid domain with DNS record, **mandatory** for SSL certs via Let's Encrypt. * Ports open for ACME (SSL) interaction & validation. -* Minimum recommended for video recording: 8 GB RAM / 4 Cores. +* Highly recommended: 8 GB RAM / 4 Cores. * Webcam ### Jigasi Transcript * SIP account * Google Cloud Account with Billing setup. + ### Jibri Recodings Access via Nextcloud * Valid domain with DNS record for Nextcloud SSL. +## Kernel warning +For AWS users or any cloud service provider that might use their own kernel on their products (servers/vm/vps), might cause Jibri failure to start due not allowing `snd_aloop` module. + +Make sure that you update your grub to boot the right one. + +Feel free to use our (new) `test-jibri-env.sh` tool to find some details on your current setup. ## Features -* Enabled Session (video) Recording using Jibri +* Enabled Session Recording using Jibri * Enabled Jitsi Electron app detection server side. * Standalone SSL Certbot/LE implementation * Jigasi Transcript - Speech to Text powered by Google API * JRA (Jibri Recordings Access) via Nextcloud * Improved recurring updater * Customized brandless mode - * (New) Setting up custom interface_config.js -* (New) Grafana Dashboard -* (New) Lobby Rooms - Secure Rooms -* (New) Conference Duration - Secure Rooms + * Setting up custom interface_config.js +* Grafana Dashboard +* Lobby Rooms - Secure Rooms +* Conference Duration - Secure Rooms +* (New) Automatic Jibri nodes network sync ([see more](https://github.com/switnet-ltd/quick-jibri-installer/wiki/Jibri-Nodes)). +## Tools (New) +* (New) Jibri Environment Tester + * (New) Jibri Conf Upgrader (late 2020). ## Optional custom changes * Optional default language * Option to enable Secure Rooms * Option to enable Welcome Page -* Option to enable Local audio recording using flac. -* Option to use Rodentia static avatar (icon credit: sixsixfive) - Legacy ## Custom changes * Start with video muted by default diff --git a/add-jibri-node.sh b/add-jibri-node.sh index bddc94f..8b43979 100644 --- a/add-jibri-node.sh +++ b/add-jibri-node.sh @@ -125,7 +125,8 @@ if [ "$CPU_MIN" = "Y" ] && [ "$MEM_MIN" = "Y" ];then " else echo "CPU ($(nproc --all))/RAM ($((mem_available/1024)) MiB) does NOT meet minimum recommended requirements!" - echo "Even when you can use the videconference sessions, we advice to increase the resources in order to user Jibri." + echo "Since this is a Jibri node there is no point on having the necessary resources." + echo "We highly advice to increase the resources in order to install this Jibri node." while [[ "$CONTINUE_LOW_RES" != "yes" && "$CONTINUE_LOW_RES" != "no" ]] do read -p "> Do you want to continue?: (yes or no)"$'\n' -r CONTINUE_LOW_RES @@ -133,7 +134,7 @@ else echo "See you next time with more resources!..." exit elif [ "$CONTINUE_LOW_RES" = "yes" ]; then - echo "Please keep in mind that trying to use Jibri with low resources might fail." + echo "Please keep in mind that we might not support underpowered nodes." fi done fi @@ -155,7 +156,7 @@ check_var MJS_USER_PASS "$MJS_USER_PASS" # Rename hostname for each jibri node hostnamectl set-hostname "jbnode${ADDUP}.${MAIN_SRV_DOMAIN}" -sed -i "1i ${PUBLIC_IP} jbnode${ADDUP}.${MAIN_SRV_DOMAIN}" /etc/hosts +sed -i "1i 127.0.0.1 jbnode${ADDUP}.${MAIN_SRV_DOMAIN}" /etc/hosts # Jitsi-Meet Repo echo "Add Jitsi repo" diff --git a/quick_jibri_installer.sh b/quick_jibri_installer.sh index d3884c7..442bf75 100644 --- a/quick_jibri_installer.sh +++ b/quick_jibri_installer.sh @@ -189,7 +189,38 @@ else echo "See you next time with more resources!..." exit elif [ "$CONTINUE_LOW_RES" = "yes" ]; then - echo "Please keep in mind that trying to use Jibri with low resources might fail." + echo "We highly recommend to increase the server resources." + echo "Otherwise, please think about adding dedicated jibri nodes instead." + fi + done +fi + +if [ "$CONTINUE_LOW_RES" = "yes" ]; then +echo -e "\nThis server will likely have issues due the lack of resources. +If you plan to enable other components such as, + + - JRA via Nextcloud + - Jigasi Transcriber + - Additional Jibri Nodes + - others. + +We higly recommend to increase resources of this server. + +For now we advice to disable the Jibri service locally and add an external +Jibri node once this installation has finished, using our script: + + >> add-jibri-node.sh + +So you can add a Jibri server on a instance with enough resources.\n" + + while [[ "$DISABLE_LOCAL_JIBRI" != "yes" && "$DISABLE_LOCAL_JIBRI" != "no" ]] + do + read -p "> Do you want to disable local jibri service?: (yes or no)"$'\n' -r DISABLE_LOCAL_JIBRI + if [ "$DISABLE_LOCAL_JIBRI" = "no" ]; then + echo "Please keep in mind that we might not support underpowered servers." + exit + elif [ "$DISABLE_LOCAL_JIBRI" = "yes" ]; then + echo "Please think about adding dedicated jibri nodes see more at the wiki." fi done fi @@ -955,6 +986,11 @@ systemctl enable jibri systemctl enable jibri-xorg systemctl enable jibri-icewm restart_services +if [ "$DISABLE_LOCAL_JIBRI" = "yes" ]; then + + systemctl stop jibri* + systemctl disable jibri* +fi enable_letsencrypt -- 2.34.1 From bbb36f46445276e6759c80764c8177ce80b0c608 Mon Sep 17 00:00:00 2001 From: Ark74 Date: Thu, 8 Oct 2020 10:51:08 -0500 Subject: [PATCH 43/54] Clean some commented lines --- add-jibri-node.sh | 1 - jra_nextcloud.sh | 1 - quick_jibri_installer.sh | 3 --- 3 files changed, 5 deletions(-) diff --git a/add-jibri-node.sh b/add-jibri-node.sh index 8b43979..ecf2c37 100644 --- a/add-jibri-node.sh +++ b/add-jibri-node.sh @@ -181,7 +181,6 @@ apt-get -y install \ apt-show-versions \ bmon \ curl \ - expect \ ffmpeg \ git \ htop \ diff --git a/jra_nextcloud.sh b/jra_nextcloud.sh index 7563d32..0546d80 100644 --- a/jra_nextcloud.sh +++ b/jra_nextcloud.sh @@ -448,7 +448,6 @@ sudo -u www-data php $NC_PATH/occ app:enable files_external sudo -u www-data php $NC_PATH/occ files_external:import /tmp/jra-nc-app-ef.json usermod -a -G jibri www-data -#chown -R jibri:www-data $DIR_RECORD chmod -R 770 $DIR_RECORD chmod -R g+s $DIR_RECORD diff --git a/quick_jibri_installer.sh b/quick_jibri_installer.sh index 442bf75..9876685 100644 --- a/quick_jibri_installer.sh +++ b/quick_jibri_installer.sh @@ -861,9 +861,6 @@ sudo su $MJS_USER -c "ssh-keygen -t rsa -f ~/.ssh/id_rsa -b 4096 -o -a 100 -q -N sed -i "s|PasswordAuthentication .*|PasswordAuthentication yes|" /etc/ssh/sshd_config systemctl restart sshd -#sudo su $MJS_USER -c "rm ~/.ssh/id_rsa.pub" -#sudo su $MJS_USER -c "cat ~/.ssh/authorized_keys" - #Setting varibales for add-jibri-node.sh sed -i "s|MAIN_SRV_DIST=.*|MAIN_SRV_DIST=\"$DIST\"|" add-jibri-node.sh -- 2.34.1 From 7f302560d7c56e6b8902d5c08a5c83c7d4ec6a6b Mon Sep 17 00:00:00 2001 From: Ark74 Date: Thu, 8 Oct 2020 22:49:17 -0500 Subject: [PATCH 44/54] Fix mixed system variable --- quick_jibri_installer.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/quick_jibri_installer.sh b/quick_jibri_installer.sh index 9876685..31b22e8 100644 --- a/quick_jibri_installer.sh +++ b/quick_jibri_installer.sh @@ -405,7 +405,7 @@ https://github.com/jitsi/jitsi-meet/blob/master/lang/languages.json Jitsi Meet web interface will be set to use such language. " -read -p "Please set your language (Press enter to default to 'en'):"$'\n' -r LANG +read -p "Please set your language (Press enter to default to 'en'):"$'\n' -r JB_LANG #Drop unsecure TLS while [[ "$DROP_TLS1" != "yes" && "$DROP_TLS1" != "no" ]] do @@ -732,12 +732,12 @@ sed -i "s|LOC_REC=.*|LOC_REC=\"on\"|" jitsi-updater.sh fi #Setup main language -if [ -z $LANG ] || [ "$LANG" = "en" ]; then +if [ -z $JB_LANG ] || [ "$JB_LANG" = "en" ]; then echo "Leaving English (en) as default language..." sed -i "s|// defaultLanguage: 'en',|defaultLanguage: 'en',|" $MEET_CONF else - echo "Changing default language to: $LANG" - sed -i "s|// defaultLanguage: 'en',|defaultLanguage: \'$LANG\',|" $MEET_CONF + echo "Changing default language to: $JB_LANG" + sed -i "s|// defaultLanguage: 'en',|defaultLanguage: \'$JB_LANG\',|" $MEET_CONF fi #Check config file -- 2.34.1 From f25b238a4019a80f24eeafe7d6269869cc53718a Mon Sep 17 00:00:00 2001 From: Ark74 Date: Thu, 8 Oct 2020 23:40:46 -0500 Subject: [PATCH 45/54] Rearrange variables and check for jitsi-meet already installed. --- jra_nextcloud.sh | 65 ++++++++++++++++++++++++++++-------------------- 1 file changed, 38 insertions(+), 27 deletions(-) diff --git a/jra_nextcloud.sh b/jra_nextcloud.sh index 0546d80..6d824aa 100644 --- a/jra_nextcloud.sh +++ b/jra_nextcloud.sh @@ -20,7 +20,14 @@ if ! [ $(id -u) = 0 ]; then echo "You need to be root or have sudo privileges!" exit 0 fi - +exit_if_not_installed() { +if [ "$(dpkg-query -W -f='${Status}' $1 2>/dev/null | grep -c "ok installed")" != "1" ]; then + echo " This instance doesn't have $1 installed, exiting..." + echo " If you think this is an error, please report to: + -> https://github.com/switnet-ltd/quick-jibri-installer/issues " + exit +fi +} clear echo -e '\n ######################################################################## @@ -28,12 +35,40 @@ echo -e '\n ######################################################################## by Software, IT & Networks Ltd \n' +exit_if_not_installed jitsi-meet + +DISTRO_RELEASE="$(lsb_release -sc)" +DOMAIN=$(ls /etc/prosody/conf.d/ | grep -v localhost | awk -F'.cfg' '{print $1}' | awk '!NF || !seen[$0]++') +PHP_REPO=$(apt-cache policy | grep http | grep php | head -n 1 | awk '{print $2}' | cut -d "/" -f5) +PHPVER="7.4" +PSGVER="$(apt-cache madison postgresql | head -n1 | awk '{print $3}' | cut -d "+" -f1)" +PHP_FPM_DIR="/etc/php/$PHPVER/fpm" +PHP_INI="$PHP_FPM_DIR/php.ini" +PHP_CONF="/etc/php/$PHPVER/fpm/pool.d/www.conf" +NC_NGINX_CONF="/etc/nginx/sites-available/$NC_DOMAIN.conf" +NC_NGINX_SSL_PORT="$(grep "listen 44" /etc/nginx/sites-enabled/$DOMAIN.conf | awk '{print$2}')" +NC_REPO="https://download.nextcloud.com/server/releases" +NCVERSION="$(curl -s -m 900 $NC_REPO/ | sed --silent 's/.*href="nextcloud-\([^"]\+\).zip.asc".*/\1/p' | sort --version-sort | tail -1)" +STABLEVERSION="nextcloud-$NCVERSION" +NC_PATH="/var/www/nextcloud" +NC_CONFIG="$NC_PATH/config/config.php" +NC_DB_USER="nextcloud_user" +NC_DB="nextcloud_db" +NC_DB_PASSWD="$(tr -dc "a-zA-Z0-9#_*=" < /dev/urandom | fold -w 14 | head -n1)" +DIR_RECORD="$(grep -nr RECORDING /home/jibri/finalize_recording.sh|head -n1|cut -d "=" -f2)" +REDIS_CONF="/etc/redis/redis.conf" +JITSI_MEET_PROXY="/etc/nginx/modules-enabled/60-jitsi-meet.conf" +if [ -f $JITSI_MEET_PROXY ];then +PREAD_PROXY=$(grep -nr "preread_server_name" $JITSI_MEET_PROXY | cut -d ":" -f1) +fi while [[ -z "$NC_DOMAIN" ]] do read -p "Please enter the domain to use for Nextcloud: " -r NC_DOMAIN -if [ -z "$NC_DOMAIN" ]; then +if [ -z "$NC_DOMAIN" ];then echo "-- This field is mandatory." +elif [ "$NC_DOMAIN" = "$DOMAIN" ]; then + echo "-- You can not use the same domain for both, Jitsi Meet and JRA via Nextcloud." fi done while [[ -z "$NC_USER" ]] @@ -63,30 +98,6 @@ elif [ "$ENABLE_HSTS" = "yes" ]; then echo "-- HSTS will be enabled." fi done -DISTRO_RELEASE="$(lsb_release -sc)" -DOMAIN=$(ls /etc/prosody/conf.d/ | grep -v localhost | awk -F'.cfg' '{print $1}' | awk '!NF || !seen[$0]++') -PHP_REPO=$(apt-cache policy | grep http | grep php | head -n 1 | awk '{print $2}' | cut -d "/" -f5) -PHPVER="7.4" -PSGVER="$(apt-cache madison postgresql | head -n1 | awk '{print $3}' | cut -d "+" -f1)" -PHP_FPM_DIR="/etc/php/$PHPVER/fpm" -PHP_INI="$PHP_FPM_DIR/php.ini" -PHP_CONF="/etc/php/$PHPVER/fpm/pool.d/www.conf" -NC_NGINX_CONF="/etc/nginx/sites-available/$NC_DOMAIN.conf" -NC_NGINX_SSL_PORT="$(grep "listen 44" /etc/nginx/sites-enabled/$DOMAIN.conf | awk '{print$2}')" -NC_REPO="https://download.nextcloud.com/server/releases" -NCVERSION="$(curl -s -m 900 $NC_REPO/ | sed --silent 's/.*href="nextcloud-\([^"]\+\).zip.asc".*/\1/p' | sort --version-sort | tail -1)" -STABLEVERSION="nextcloud-$NCVERSION" -NC_PATH="/var/www/nextcloud" -NC_CONFIG="$NC_PATH/config/config.php" -NC_DB_USER="nextcloud_user" -NC_DB="nextcloud_db" -NC_DB_PASSWD="$(tr -dc "a-zA-Z0-9#_*=" < /dev/urandom | fold -w 14 | head -n1)" -DIR_RECORD="$(grep -nr RECORDING /home/jibri/finalize_recording.sh|head -n1|cut -d "=" -f2)" -REDIS_CONF="/etc/redis/redis.conf" -JITSI_MEET_PROXY="/etc/nginx/modules-enabled/60-jitsi-meet.conf" -if [ -f $JITSI_MEET_PROXY ];then -PREAD_PROXY=$(grep -nr "preread_server_name" $JITSI_MEET_PROXY | cut -d ":" -f1) -fi echo -e "\n# Check for jitsi-meet/jibri\n" if [ "$(dpkg-query -W -f='${Status}' jibri 2>/dev/null | grep -c "ok installed")" == "1" ] || \ @@ -101,7 +112,7 @@ fi exit_ifinstalled() { if [ "$(dpkg-query -W -f='${Status}' $1 2>/dev/null | grep -c "ok installed")" == "1" ]; then echo " This instance already has $1 installed, exiting..." - echo " Please report to: + echo " If you think this is an error, please report to: -> https://github.com/switnet-ltd/quick-jibri-installer/issues " exit fi -- 2.34.1 From 001c7427952d228787d246cba70de91a6ff837bd Mon Sep 17 00:00:00 2001 From: Ark74 Date: Fri, 9 Oct 2020 02:46:43 -0500 Subject: [PATCH 46/54] Rewrite sentence --- add-jibri-node.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/add-jibri-node.sh b/add-jibri-node.sh index ecf2c37..6e6e121 100644 --- a/add-jibri-node.sh +++ b/add-jibri-node.sh @@ -125,7 +125,7 @@ if [ "$CPU_MIN" = "Y" ] && [ "$MEM_MIN" = "Y" ];then " else echo "CPU ($(nproc --all))/RAM ($((mem_available/1024)) MiB) does NOT meet minimum recommended requirements!" - echo "Since this is a Jibri node there is no point on having the necessary resources." + echo "Since this is a Jibri node installation there is no point on not having the necessary resources." echo "We highly advice to increase the resources in order to install this Jibri node." while [[ "$CONTINUE_LOW_RES" != "yes" && "$CONTINUE_LOW_RES" != "no" ]] do -- 2.34.1 From 26ca5c2e02e50b5c47754a40fd997ca759834168 Mon Sep 17 00:00:00 2001 From: Ark74 Date: Sat, 10 Oct 2020 06:27:45 -0500 Subject: [PATCH 47/54] Add small improvements --- add-jibri-node.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/add-jibri-node.sh b/add-jibri-node.sh index 6e6e121..dd7d571 100644 --- a/add-jibri-node.sh +++ b/add-jibri-node.sh @@ -380,6 +380,7 @@ echo -e "\n---- We'll connect to main server ----" read -n 1 -s -r -p "Press any key to continue..."$'\n' sudo su $NJN_USER -c "ssh-keygen -t rsa -f ~/.ssh/id_rsa -b 4096 -o -a 100 -q -N ''" echo "Remote pass: $MJS_USER_PASS" +ssh-keyscan -t rsa $MAIN_SRV_DOMAIN >> ~/.ssh/known_hosts ssh $MJS_USER@$MAIN_SRV_DOMAIN sh -c "'cat >> .ssh/authorized_keys'" < /home/$NJN_USER/.ssh/id_rsa.pub sudo su $NJN_USER -c "ssh-keyscan -t rsa $MAIN_SRV_DOMAIN >> /home/$NJN_USER/.ssh/known_hosts" @@ -457,13 +458,13 @@ systemctl enable jibri systemctl enable jibri-xorg systemctl enable jibri-icewm -echo -e "\nSending updated add-jibri-node.sh file to main server sync user..." +check_snd_driver + +echo -e "\nSending updated add-jibri-node.sh file to main server sync user...\n" cp $PWD/add-jibri-node.sh /tmp sudo -u $NJN_USER scp /tmp/add-jibri-node.sh $MJS_USER@$MAIN_SRV_DOMAIN:/home/$MJS_USER/ rm $PWD/add-jibri-node.sh /tmp/add-jibri-node.sh -check_snd_driver - echo " ######################################################################## Node addition complete!! -- 2.34.1 From 21f1ef1c4dd4aa60900e3dab3769fba2935214f0 Mon Sep 17 00:00:00 2001 From: Ark74 Date: Sat, 10 Oct 2020 06:30:19 -0500 Subject: [PATCH 48/54] Add google software check, also add a simple score system. --- tools/test-jibri-env.sh | 67 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 61 insertions(+), 6 deletions(-) diff --git a/tools/test-jibri-env.sh b/tools/test-jibri-env.sh index 6a54700..3d3f3b2 100644 --- a/tools/test-jibri-env.sh +++ b/tools/test-jibri-env.sh @@ -39,15 +39,39 @@ SND_AL_MODULE=$(lsmod | awk '{print$1}'| grep snd_aloop) HWE_VIR_MOD=$(apt-cache madison linux-modules-extra-virtual-hwe-$(lsb_release -sr) 2>/dev/null|head -n1|grep -c "extra-virtual-hwe") CONF_JSON="/etc/jitsi/jibri/config.json" JIBRI_CONF="/etc/jitsi/jibri/jibri.conf" +CHD_VER="$(/usr/local/bin/chromedriver --version 2>/dev/null| awk '{print$1,$2}')" +GOOGL_VER="$(/usr/bin/google-chrome --version 2>/dev/null)" -echo -e "\n# -- Check repository --\n" +check_google_binaries() { +if [ -z "$2" ]; then + echo "Warning: No $1 doesn't seem installed" +else + echo $2 +fi +} + +#T1 +echo -e "\n#1 -- Check repository --\n" if [ -z $JITSI_REPO ]; then echo "No repository detected, wait whaaaat?..." + while [[ "$CONT_TEST" != "yes" && "$CONT_TEST" != "no" ]] + do + read -p "> Do you still want to continue the test?: (yes or no)"$'\n' -r CONT_TEST + if [ "$CONT_TEST" = "no" ]; then + echo "Exiting..." + exit + elif [ "$CONT_TEST" = "yes" ]; then + echo "Hmm, seems there won't be anything to test, continuing anyway..." + T=0 + fi + done else echo "This installation is using the \"$JITSI_REPO\" repository." + T1=1 fi -echo -e "\n# -- Check latest updates for jibri --\n" +#T2 +echo -e "\n#2 -- Check latest updates for jibri --\n" if [ "$(dpkg-query -W -f='${Status}' jibri 2>/dev/null | grep -c "ok installed")" == "1" ]; then echo "Jibri is installed, checking version:" apt-show-versions jibri @@ -62,8 +86,22 @@ else echo -e "\nAttempting jibri upgrade!" apt -y install --only-upgrade jibri fi +T2=1 -echo -e "\n# -- Test kernel modules --\n" +#T3 +echo -e "\n#3 -- Check Google Chrome/driver software. --\n" +check_google_binaries "Chromedriver" "$CHD_VER" +check_google_binaries "Google Chrome" "$GOOGL_VER" +if [ ! -z "$CHD_VER" ] && [ ! -z "$GOOGL_VER" ]; then +T3=1 +elif [ -z "$CHD_VER" ] || [ -z "$GOOGL_VER" ]; then +T3=0 +else +T3=0 +fi + +#T4 +echo -e "\n#4 -- Test kernel modules --\n" if [ -z $SND_AL_MODULE ]; then #First make sure the recommended kernel is installed. if [ "$HWE_VIR_MOD" == "1" ]; then @@ -74,7 +112,7 @@ if [ -z $SND_AL_MODULE ]; then apt-get -y install \ linux-modules-extra-$(uname -r) fi - echo -e "No module snd_aloop detected. \xE2\x9C\x96 <== IMPORTANT! \nCurrent kernel: $(uname -r)" + echo -e "\nNo module snd_aloop detected. \xE2\x9C\x96 <== IMPORTANT! \nCurrent kernel: $(uname -r)\n" echo -e "\nIf you just installed a new kernel, \ please try rebooting.\nFor now wait 'til the end of the recommended kernel installation." echo "# Check and Install HWE kernel if possible..." @@ -86,10 +124,14 @@ please try rebooting.\nFor now wait 'til the end of the recommended kernel insta echo -e "\n > $KNL_MENU" fi fi + T4=0 else echo -e "Great!\nModule snd-aloop found!" + T4=1 fi -echo -e "\n# -- Test .asoundrc file --\n" + +#T5 +echo -e "\n#5 -- Test .asoundrc file --\n" ASRC_MASTER="https://raw.githubusercontent.com/jitsi/jibri/master/resources/debian-package/etc/jitsi/jibri/asoundrc" ASRC_INSTALLED="/home/jibri/.asoundrc" ASRC_MASTER_MD5SUM=$(curl -sL $ASRC_MASTER | md5sum | cut -d ' ' -f 1) @@ -97,11 +139,14 @@ ASRC_INSTALLED_MD5SUM=$(md5sum $ASRC_INSTALLED | cut -d ' ' -f 1) if [ "$ASRC_MASTER_MD5SUM" == "$ASRC_INSTALLED_MD5SUM" ]; then echo "Seems to be using the latest asoundrc file available!" + T5=1 else echo "asoundrc files differ, if you have errors, you might wanna check this file!" + T5=0 fi -echo -e "\n# -- Old or new config --\n" +#T6 +echo -e "\n#6 -- Old or new config --\n" echo -e "What config version is this using?" if [ -f ${CONF_JSON}_disabled ] && \ @@ -109,15 +154,25 @@ if [ -f ${CONF_JSON}_disabled ] && \ [ -f $JIBRI_CONF-dpkg-file ]; then echo -e "\n> This jibri config has been upgraded already.\n\nIf you think there maybe an error on checking you current jibri configuration.\nPlease report this to \ https://github.com/switnet-ltd/quick-jibri-installer/issues\n" +T6=1 elif [ ! -f $CONF_JSON ] && \ [ -f $JIBRI_CONF ] && \ [ -f ${JIBRI_CONF}-dpkg-file ]; then echo -e "\n> This jibri seems to be running the lastest configuration already.\n\nIf you think there maybe an error on checking you current jibri configuration.\nPlease report this to \ https://github.com/switnet-ltd/quick-jibri-installer/issues\n" +T6=1 elif [ -f ${CONF_JSON} ] && \ [ -f $JIBRI_CONF ]; then echo -e "\n> This jibri config seems to be candidate for upgrading.\nIf you think there maybe an error on checking you current jibri configuration.\nPlease report this to \ https://github.com/switnet-ltd/quick-jibri-installer/issues\n" +T6=0 fi +TEST_TOTAL=$((T1 + T2 + T3 + T4 + T5 + T6)) +echo " +########################### + \ +Score: $TEST_TOTAL out of 6 +########################### +" echo -e "\nJibri Test complete, thanks for testing.\n" -- 2.34.1 From d28d498c61047ee5ec5e25b8893f719c01150f64 Mon Sep 17 00:00:00 2001 From: Ark74 Date: Sat, 10 Oct 2020 18:04:45 -0500 Subject: [PATCH 49/54] Add usage description for user information --- add-jibri-node.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/add-jibri-node.sh b/add-jibri-node.sh index dd7d571..5a111ab 100644 --- a/add-jibri-node.sh +++ b/add-jibri-node.sh @@ -468,7 +468,13 @@ rm $PWD/add-jibri-node.sh /tmp/add-jibri-node.sh echo " ######################################################################## Node addition complete!! - for customized support: http://switnet.net + + The updated version of this file has been sent to the main server + at the sync user home directory, please use that one in order to + install new nodes. For security reason this version has been deleted + from this very node. + + For customized support: http://switnet.net ######################################################################## " -- 2.34.1 From 148ddb940ede757b1d1549142d112406f410f465 Mon Sep 17 00:00:00 2001 From: Ark74 Date: Sat, 10 Oct 2020 20:40:58 -0500 Subject: [PATCH 50/54] Improve echo display --- quick_jibri_installer.sh | 50 ++++++++++++++-------------------------- 1 file changed, 17 insertions(+), 33 deletions(-) diff --git a/quick_jibri_installer.sh b/quick_jibri_installer.sh index 31b22e8..8804513 100644 --- a/quick_jibri_installer.sh +++ b/quick_jibri_installer.sh @@ -125,8 +125,8 @@ Featuring: Learn more about these at, Main repository: https://github.com/switnet-ltd/quick-jibri-installer -Wiki and documentation: https://github.com/switnet-ltd/quick-jibri-installer/wiki\n' \ -&& \ +Wiki and documentation: https://github.com/switnet-ltd/quick-jibri-installer/wiki\n' + read -n 1 -s -r -p "Press any key to continue..."$'\n' #Check if user is root @@ -220,7 +220,7 @@ So you can add a Jibri server on a instance with enough resources.\n" echo "Please keep in mind that we might not support underpowered servers." exit elif [ "$DISABLE_LOCAL_JIBRI" = "yes" ]; then - echo "Please think about adding dedicated jibri nodes see more at the wiki." + echo "You can add dedicated jibri nodes later, see more at the wiki." fi done fi @@ -587,24 +587,17 @@ echo ' echo "#Set and upgrade certbot PPA if posssible..." if [ "$CERTBOT_REPO" = "certbot" ]; then - echo " -Cerbot repository already on the system! -Checking for updates... -" + echo -e "\nCerbot repository already on the system!\nChecking for updates...\n" apt-get -q2 update apt-get -yq2 dist-upgrade elif [ "$(curl -s -o /dev/null -w "%{http_code}" $CERTBOT_REL_FILE )" == "200" ]; then - echo " -Adding cerbot (formerly letsencrypt) PPA repository for latest updates -" + echo -e "\nAdding cerbot (formerly letsencrypt) PPA repository for latest updates\n" 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-get -q2 update apt-get -yq2 dist-upgrade elif [ "$(curl -s -o /dev/null -w "%{http_code}" $CERTBOT_REL_FILE )" == "404" ]; then - echo " -Certbot PPA is not available for $(lsb_release -sc) just yet, it won't be installed... -" + echo -e "\nCertbot PPA is not available for $(lsb_release -sc) just yet, it won't be installed...\n" fi else @@ -673,18 +666,13 @@ if [ ! -z $L10N_ME ]; then sed -i "s|LOCAL_USER=.*|LOCAL_USER=\"$L10N_ME\"|" jm-bm.sh fi if [ ! -f $MOD_LIST_FILE ]; then -echo " --> Adding external module to list prosody users... -" +echo -e "\n-> Adding external module to list prosody users...\n" curl -s $MOD_LISTU > $MOD_LIST_FILE -echo "Now you can check registered users with: -prosodyctl mod_listusers -" +echo -e "Now you can check registered users with:\nprosodyctl mod_listusers\n" else -echo "Prosody support for listing users seems to be enabled. -check with: prosodyctl mod_listusers -" +echo -e "Prosody support for listing users seems to be enabled. +check with: prosodyctl mod_listusers\n" fi ### Prosody users @@ -741,14 +729,10 @@ else fi #Check config file -echo " -# Checking $MEET_CONF file for errors -" +echo -e "\n# Checking $MEET_CONF file for errors\n" CHECKJS=$(esvalidate $MEET_CONF| cut -d ":" -f2) if [[ -z "$CHECKJS" ]]; then -echo " -# The $MEET_CONF configuration seems correct. =) -" +echo -e "\n# The $MEET_CONF configuration seems correct. =)\n" else echo " Watch out!, there seems to be an issue on $MEET_CONF line: @@ -900,11 +884,11 @@ if [ "$ENABLE_SA" = "yes" ] && [ -f $WS_CONF ]; then fi #nginx -tlsv1/1.1 if [ "$DROP_TLS1" = "yes" ] && [ "$DIST" != "xenial" ];then - echo "Dropping TLSv1/1.1 in favor of v1.3" + echo -e "\nDropping TLSv1/1.1 in favor of v1.3" 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" = "xenial" ];then - echo "Only dropping TLSv1/1.1" + echo -e "\nOnly dropping TLSv1/1.1" sed -i "s|TLSv1 TLSv1.1||" /etc/nginx/nginx.conf sed -i "s| TLSv1.3||" $WS_CONF elif [ "$DROP_TLS1" = "no" ];then @@ -914,7 +898,7 @@ echo "No contidion meet, please report to https://github.com/switnet-ltd/quick-jibri-installer/issues " fi -echo "Disable \"Blur my background\" until new notice" +echo -e"\nDisable \"Blur my background\" until new notice\n" sed -i "s|'videobackgroundblur', ||" $INT_CONF #================== Setup prosody conf file ================= @@ -955,7 +939,7 @@ fi #====================== #Secure room initial user if [ "$ENABLE_SC" = "yes" ]; then -echo "Secure rooms are being enabled..." +echo -e "\nSecure rooms are being enabled..." 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." @@ -992,7 +976,7 @@ fi enable_letsencrypt if dpkg-compare prosody gt 0.11.0 && [ "$ENABLE_SC" = "yes" ]; then -echo "Waiting prosody restart, wait 15s..." +echo "Waiting prosody restart to continue configuration, 15s..." wait_seconds 15 #Move mucs when using secure rooms - https://community.jitsi.org/t/27752/112 sed -i "s| lobby_muc = \"lobby.|-- lobby_muc = \"lobby.|" $PROSODY_FILE -- 2.34.1 From 6ca6eca358748ccd9db6c26c8cef6f1fa3c6e895 Mon Sep 17 00:00:00 2001 From: Ark74 Date: Sat, 10 Oct 2020 20:43:13 -0500 Subject: [PATCH 51/54] Move into apt-get --- tools/test-jibri-env.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/test-jibri-env.sh b/tools/test-jibri-env.sh index 3d3f3b2..8e2fc38 100644 --- a/tools/test-jibri-env.sh +++ b/tools/test-jibri-env.sh @@ -31,8 +31,8 @@ if ! [ $(id -u) = 0 ]; then fi echo "Checking for updates...." -apt -q2 update -apt -yq2 install apt-show-versions +apt-get -q2 update +apt-get -yq2 install apt-show-versions JITSI_REPO=$(apt-cache policy | grep http | grep jitsi | grep stable | awk '{print $3}' | head -n 1 | cut -d "/" -f1) SND_AL_MODULE=$(lsmod | awk '{print$1}'| grep snd_aloop) -- 2.34.1 From 116c568f444662651403e904fbf7591778137d1c Mon Sep 17 00:00:00 2001 From: Ark74 Date: Sat, 10 Oct 2020 22:58:00 -0500 Subject: [PATCH 52/54] Fix undefined variable --- jra_nextcloud.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jra_nextcloud.sh b/jra_nextcloud.sh index 6d824aa..9b0195e 100644 --- a/jra_nextcloud.sh +++ b/jra_nextcloud.sh @@ -45,7 +45,6 @@ PSGVER="$(apt-cache madison postgresql | head -n1 | awk '{print $3}' | cut -d "+ PHP_FPM_DIR="/etc/php/$PHPVER/fpm" PHP_INI="$PHP_FPM_DIR/php.ini" PHP_CONF="/etc/php/$PHPVER/fpm/pool.d/www.conf" -NC_NGINX_CONF="/etc/nginx/sites-available/$NC_DOMAIN.conf" NC_NGINX_SSL_PORT="$(grep "listen 44" /etc/nginx/sites-enabled/$DOMAIN.conf | awk '{print$2}')" NC_REPO="https://download.nextcloud.com/server/releases" NCVERSION="$(curl -s -m 900 $NC_REPO/ | sed --silent 's/.*href="nextcloud-\([^"]\+\).zip.asc".*/\1/p' | sort --version-sort | tail -1)" @@ -71,6 +70,7 @@ elif [ "$NC_DOMAIN" = "$DOMAIN" ]; then echo "-- You can not use the same domain for both, Jitsi Meet and JRA via Nextcloud." fi done +NC_NGINX_CONF="/etc/nginx/sites-available/$NC_DOMAIN.conf" while [[ -z "$NC_USER" ]] do read -p "Nextcloud user: " -r NC_USER @@ -374,7 +374,7 @@ NC_NGINX systemctl stop nginx letsencrypt certonly --standalone --renew-by-default --agree-tos -d $NC_DOMAIN if [ -f /etc/letsencrypt/live/$NC_DOMAIN/fullchain.pem ];then - ln -s /etc/nginx/sites-available/$NC_DOMAIN.conf /etc/nginx/sites-enabled/ + ln -s $NC_NGINX_CONF /etc/nginx/sites-enabled/ else echo "There are issues on getting the SSL certs..." read -n 1 -s -r -p "Press any key to continue" -- 2.34.1 From e96a50e262ec0652427722ca0dc771c822945289 Mon Sep 17 00:00:00 2001 From: Ark74 Date: Sun, 11 Oct 2020 01:26:05 -0500 Subject: [PATCH 53/54] Continue script on user request even when is not advisable. --- quick_jibri_installer.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/quick_jibri_installer.sh b/quick_jibri_installer.sh index 8804513..f037f73 100644 --- a/quick_jibri_installer.sh +++ b/quick_jibri_installer.sh @@ -218,7 +218,6 @@ So you can add a Jibri server on a instance with enough resources.\n" read -p "> Do you want to disable local jibri service?: (yes or no)"$'\n' -r DISABLE_LOCAL_JIBRI if [ "$DISABLE_LOCAL_JIBRI" = "no" ]; then echo "Please keep in mind that we might not support underpowered servers." - exit elif [ "$DISABLE_LOCAL_JIBRI" = "yes" ]; then echo "You can add dedicated jibri nodes later, see more at the wiki." fi @@ -968,9 +967,10 @@ systemctl enable jibri-xorg systemctl enable jibri-icewm restart_services if [ "$DISABLE_LOCAL_JIBRI" = "yes" ]; then - systemctl stop jibri* - systemctl disable jibri* + systemctl disable jibri + systemctl disable jibri-xorg + systemctl disable jibri-icewm fi enable_letsencrypt -- 2.34.1 From 5252c1f76bb3ab4823dce75f2082294a18936192 Mon Sep 17 00:00:00 2001 From: Ark74 Date: Sun, 11 Oct 2020 02:16:36 -0500 Subject: [PATCH 54/54] Last echo display updates. --- add-jibri-node.sh | 1 + quick_jibri_installer.sh | 10 ++++------ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/add-jibri-node.sh b/add-jibri-node.sh index 5a111ab..d1d360a 100644 --- a/add-jibri-node.sh +++ b/add-jibri-node.sh @@ -469,6 +469,7 @@ echo " ######################################################################## Node addition complete!! + IMPORTANT: The updated version of this file has been sent to the main server at the sync user home directory, please use that one in order to install new nodes. For security reason this version has been deleted diff --git a/quick_jibri_installer.sh b/quick_jibri_installer.sh index f037f73..0152007 100644 --- a/quick_jibri_installer.sh +++ b/quick_jibri_installer.sh @@ -217,9 +217,9 @@ So you can add a Jibri server on a instance with enough resources.\n" do read -p "> Do you want to disable local jibri service?: (yes or no)"$'\n' -r DISABLE_LOCAL_JIBRI if [ "$DISABLE_LOCAL_JIBRI" = "no" ]; then - echo "Please keep in mind that we might not support underpowered servers." + echo -e "Please keep in mind that we might not support underpowered servers.\n" elif [ "$DISABLE_LOCAL_JIBRI" = "yes" ]; then - echo "You can add dedicated jibri nodes later, see more at the wiki." + echo -e "You can add dedicated jibri nodes later, see more at the wiki.\n" fi done fi @@ -227,9 +227,7 @@ fi add_prosody_repo # Jitsi-Meet Repo -echo " -Add Jitsi repo -" +echo -e "\nAdd Jitsi repo\n" if [ "$JITSI_REPO" = "stable" ]; then echo "Jitsi stable repository already installed" else @@ -897,7 +895,7 @@ echo "No contidion meet, please report to https://github.com/switnet-ltd/quick-jibri-installer/issues " fi -echo -e"\nDisable \"Blur my background\" until new notice\n" +echo -e "\nDisable \"Blur my background\" until new notice\n" sed -i "s|'videobackgroundblur', ||" $INT_CONF #================== Setup prosody conf file ================= -- 2.34.1