2020-01-26 02:54:12 +08:00
|
|
|
# This is a library of functions for
|
|
|
|
#
|
|
|
|
# /etc/bigbluebutton/bbb-conf/apply-config.sh
|
2019-02-11 01:48:50 +08:00
|
|
|
#
|
2020-01-26 02:54:12 +08:00
|
|
|
# which (if exists) will be run by `bbb-conf --setip` and `bbb-conf --restart` before restarting
|
|
|
|
# BigBlueButton.
|
2019-02-11 01:48:50 +08:00
|
|
|
#
|
2020-09-13 23:47:28 +08:00
|
|
|
# The purpose of apply-config.sh is to make it easy to apply your configuration changes to a BigBlueButton server
|
2019-03-08 01:50:54 +08:00
|
|
|
# before BigBlueButton starts
|
2019-02-11 01:48:50 +08:00
|
|
|
#
|
|
|
|
|
2022-03-21 07:44:51 +08:00
|
|
|
### duplicated code: see deb-helper.sh and bbb-conf
|
|
|
|
if [ -e "/sys/class/net/venet0:0" ]; then
|
|
|
|
# IP detection for OpenVZ environment
|
|
|
|
_dev="venet0:0"
|
2019-02-11 01:48:50 +08:00
|
|
|
else
|
2022-03-21 07:44:51 +08:00
|
|
|
_dev=$(awk '$2 == 00000000 { print $1 }' /proc/net/route | head -1)
|
|
|
|
fi
|
|
|
|
_ips=$(LANG=C ip -4 -br address show dev "$_dev" | awk '{ $1=$2=""; print $0 }')
|
|
|
|
_ips=${_ips/127.0.0.1\/8/}
|
|
|
|
read -r IP _ <<< "$_ips"
|
|
|
|
IP=${IP/\/*} # strip subnet provided by ip address
|
|
|
|
if [ -z "$IP" ]; then
|
|
|
|
read -r IP _ <<< "$(hostname -I)"
|
2019-02-11 01:48:50 +08:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -f /usr/share/bbb-web/WEB-INF/classes/bigbluebutton.properties ]; then
|
|
|
|
SERVLET_DIR=/usr/share/bbb-web
|
|
|
|
fi
|
|
|
|
|
2021-03-12 10:32:00 +08:00
|
|
|
BBB_WEB_ETC_CONFIG=/etc/bigbluebutton/bbb-web.properties
|
|
|
|
|
2022-09-19 04:05:39 +08:00
|
|
|
# We'll create a newline file to ensure bigbluebutton.properties ends with a newline
|
|
|
|
tmpfile=$(mktemp /tmp/carriage-return.XXXXXX)
|
|
|
|
echo "\n" > $tmpfile
|
|
|
|
|
2019-02-11 01:48:50 +08:00
|
|
|
PROTOCOL=http
|
|
|
|
if [ -f $SERVLET_DIR/WEB-INF/classes/bigbluebutton.properties ]; then
|
2022-09-19 04:05:39 +08:00
|
|
|
SERVER_URL=$(cat $SERVLET_DIR/WEB-INF/classes/bigbluebutton.properties $tmpfile $BBB_WEB_ETC_CONFIG | grep -v '#' | sed -n '/^bigbluebutton.web.serverURL/{s/.*\///;p}' | tail -n 1)
|
|
|
|
if cat $SERVLET_DIR/WEB-INF/classes/bigbluebutton.properties $tmpfile $BBB_WEB_ETC_CONFIG | grep -v '#' | grep ^bigbluebutton.web.serverURL | tail -n 1 | grep -q https; then
|
2019-02-11 01:48:50 +08:00
|
|
|
PROTOCOL=https
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2022-09-19 04:05:39 +08:00
|
|
|
HOST=$(cat $SERVLET_DIR/WEB-INF/classes/bigbluebutton.properties $tmpfile $BBB_WEB_ETC_CONFIG | grep -v '#' | sed -n '/^bigbluebutton.web.serverURL/{s/.*\///;p}' | tail -n 1)
|
2020-01-26 02:54:12 +08:00
|
|
|
|
2023-03-31 03:00:21 +08:00
|
|
|
HTML5_CONFIG=/etc/bigbluebutton/bbb-html5.yml
|
2023-03-31 05:42:54 +08:00
|
|
|
if [ ! -f "${HTML5_CONFIG}" ]; then
|
2023-03-31 03:00:21 +08:00
|
|
|
touch $HTML5_CONFIG
|
|
|
|
fi
|
2019-02-11 01:48:50 +08:00
|
|
|
|
|
|
|
#
|
|
|
|
# Enable Looging of the HTML5 client for debugging
|
|
|
|
#
|
|
|
|
enableHTML5ClientLog() {
|
2019-02-12 15:58:47 +08:00
|
|
|
echo " - Enable HTML5 client log to /var/log/nginx/html5-client.log"
|
2019-02-11 01:48:50 +08:00
|
|
|
|
2023-04-28 04:37:26 +08:00
|
|
|
yq e -i '.public.clientLog.external.enabled = true' $HTML5_CONFIG
|
|
|
|
yq e -i ".public.clientLog.external.url = \"$PROTOCOL://$HOST/html5log\"" $HTML5_CONFIG
|
|
|
|
yq e -i '.public.app.askForFeedbackOnLogout = true' $HTML5_CONFIG
|
2019-02-11 01:48:50 +08:00
|
|
|
|
2022-03-15 10:01:37 +08:00
|
|
|
cat > /usr/share/bigbluebutton/nginx/html5-client-log.nginx << HERE
|
2019-02-11 01:48:50 +08:00
|
|
|
location /html5log {
|
2019-03-08 01:50:54 +08:00
|
|
|
access_log /var/log/nginx/html5-client.log postdata;
|
|
|
|
echo_read_request_body;
|
2019-02-11 01:48:50 +08:00
|
|
|
}
|
|
|
|
HERE
|
|
|
|
|
|
|
|
cat > /etc/nginx/conf.d/html5-client-log.conf << HERE
|
|
|
|
log_format postdata '\$remote_addr [\$time_iso8601] \$request_body';
|
|
|
|
HERE
|
2019-03-08 01:50:54 +08:00
|
|
|
|
|
|
|
# We need nginx-full to enable postdata log_format
|
2019-02-11 01:48:50 +08:00
|
|
|
if ! dpkg -l | grep -q nginx-full; then
|
|
|
|
apt-get install -y nginx-full
|
|
|
|
fi
|
|
|
|
|
2019-02-12 15:58:47 +08:00
|
|
|
touch /var/log/nginx/html5-client.log
|
|
|
|
chown bigbluebutton:bigbluebutton /var/log/nginx/html5-client.log
|
|
|
|
|
2019-02-11 01:48:50 +08:00
|
|
|
#
|
|
|
|
# You can monitor the live HTML5 client logs with the command
|
|
|
|
#
|
2019-03-08 01:50:54 +08:00
|
|
|
# tail -f /var/log/nginx/html5-client.log | sed -u 's/\\x22/"/g' | sed -u 's/\\x5C//g'
|
2019-02-11 01:48:50 +08:00
|
|
|
}
|
|
|
|
|
2019-04-04 10:26:10 +08:00
|
|
|
#
|
|
|
|
# Enable firewall rules to open only
|
|
|
|
#
|
|
|
|
enableUFWRules() {
|
|
|
|
echo " - Enable Firewall and opening 22/tcp, 80/tcp, 443/tcp and 16384:32768/udp"
|
|
|
|
|
|
|
|
if ! which ufw > /dev/null; then
|
|
|
|
apt-get install -y ufw
|
|
|
|
fi
|
|
|
|
|
|
|
|
ufw allow OpenSSH
|
|
|
|
ufw allow "Nginx Full"
|
|
|
|
ufw allow 16384:32768/udp
|
2022-12-25 02:04:59 +08:00
|
|
|
|
2023-02-24 21:28:51 +08:00
|
|
|
# Check if haproxy is running on this server and, if so, open port 3478 on ufw
|
|
|
|
|
|
|
|
if systemctl is-enabled haproxy> /dev/null 2>&1; then
|
|
|
|
if systemctl -q is-active haproxy; then
|
|
|
|
echo " - Local haproxy detected and running -- opening port 3478"
|
|
|
|
ufw allow 3478
|
|
|
|
# echo " - Forcing FireFox to use turn server"
|
2023-04-28 04:37:26 +08:00
|
|
|
# yq e -i '.public.kurento.forceRelayOnFirefox = true' $HTML5_CONFIG
|
2023-02-24 21:28:51 +08:00
|
|
|
else
|
|
|
|
if grep -q 3478 /etc/ufw/user.rules; then
|
|
|
|
echo " - Local haproxy not running -- closing port 3478"
|
|
|
|
ufw delete allow 3478
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
if grep -q 3478 /etc/ufw/user.rules; then
|
|
|
|
echo " - Local haproxy not running -- closing port 3478"
|
|
|
|
ufw delete allow 3478
|
|
|
|
fi
|
2022-12-25 02:04:59 +08:00
|
|
|
fi
|
|
|
|
|
2019-04-04 10:26:10 +08:00
|
|
|
ufw --force enable
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-03-08 01:50:54 +08:00
|
|
|
notCalled() {
|
|
|
|
#
|
|
|
|
# This function is not called.
|
|
|
|
|
|
|
|
# Instead, it gives you the ability to copy the following text and paste it into the shell to create a starting point for
|
|
|
|
# apply-config.sh.
|
|
|
|
#
|
|
|
|
# By creating apply-config.sh manually, it will not be overwritten by any package updates. You can call functions in this
|
2023-02-25 01:19:01 +08:00
|
|
|
# library for common BigBlueButton configuration tasks.
|
2019-03-08 01:50:54 +08:00
|
|
|
|
2023-02-25 01:19:01 +08:00
|
|
|
## Start Copying Here
|
2019-03-08 01:50:54 +08:00
|
|
|
cat > /etc/bigbluebutton/bbb-conf/apply-config.sh << HERE
|
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# Pull in the helper functions for configuring BigBlueButton
|
2019-03-16 07:29:30 +08:00
|
|
|
source /etc/bigbluebutton/bbb-conf/apply-lib.sh
|
2019-02-11 01:48:50 +08:00
|
|
|
|
2019-04-04 10:26:10 +08:00
|
|
|
# Available configuration options
|
|
|
|
|
|
|
|
#enableHTML5ClientLog
|
|
|
|
#enableUFWRules
|
2019-03-08 01:50:54 +08:00
|
|
|
|
2020-10-19 03:30:13 +08:00
|
|
|
|
2020-12-13 01:15:14 +08:00
|
|
|
# Shorten the FreeSWITCH "you have been muted" and "you have been unmuted" prompts
|
|
|
|
# cp -r /etc/bigbluebutton/bbb-conf/sounds /opt/freeswitch/share/freeswitch
|
2020-12-05 03:56:16 +08:00
|
|
|
|
2019-03-08 01:50:54 +08:00
|
|
|
HERE
|
|
|
|
chmod +x /etc/bigbluebutton/bbb-conf/apply-config.sh
|
|
|
|
## Stop Copying HERE
|
|
|
|
}
|
2019-02-11 01:48:50 +08:00
|
|
|
|