Merge pull request #5751 from ffdixon/bbb-conf-webhooks

Improve checking of webhooks and ffmpeg
This commit is contained in:
Fred Dixon 2018-06-24 15:30:29 -04:00 committed by GitHub
commit e8b640da1f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -707,9 +707,12 @@ if [ $SECRET ]; then
need_root
change_var_salt ${SERVLET_DIR}/bigbluebutton/WEB-INF/classes/bigbluebutton.properties securitySalt $SECRET
if [ -f /usr/local/bigbluebutton/bbb-webhooks/config_local.coffee ]; then
sed -i "s|\(^[ \t]*config.bbb.sharedSecret[ =]*\).*|\1\"$SECRET\"|g" /usr/local/bigbluebutton/bbb-webhooks/config_local.coffee
fi
if [ -f /usr/local/bigbluebutton/bbb-webhooks/config_local.coffee ]; then
sed -i "s|\(^[ \t]*config.bbb.sharedSecret[ =]*\).*|\1\"$SECRET\"|g" /usr/local/bigbluebutton/bbb-webhooks/config_local.coffee
fi
if [ -f /usr/local/bigbluebutton/bbb-webhooks/config_local.js ]; then
sed -i "s|\(^[ \t]*config.bbb.sharedSecret[ =]*\).*|\1\"$SECRET\"|g" /usr/local/bigbluebutton/bbb-webhooks/config_local.js
fi
if [ -f /usr/local/bigbluebutton/bbb-webhooks/extra/post_catcher.js ]; then
sed -i "s|\(^[ \t]*var shared_secret[ =]*\)[^;]*|\1\"$SECRET\"|g" /usr/local/bigbluebutton/bbb-webhooks/extra/post_catcher.js
@ -891,26 +894,34 @@ check_configuration() {
BBB_SECRET=$(cat ${SERVLET_DIR}/bigbluebutton/WEB-INF/classes/bigbluebutton.properties | grep -v '#' | tr -d '\r' | sed -n '/securitySalt/{s/.*=//;p}')
NGINX_IP=$(cat /etc/nginx/sites-available/bigbluebutton | grep -v '#' | sed -n '/server_name/{s/.*server_name[ ]*//;s/;//;p}' | cut -d' ' -f1)
if [ -f /usr/lib/systemd/system/bbb-webhooks.service ]; then
WEBHOOKS_SECRET=$(cat /usr/local/bigbluebutton/bbb-webhooks/config_local.coffee | grep '^[ \t]*config.bbb.sharedSecret[ =]*' | cut -d '"' -f2)
if [ "$BBB_SECRET" != "$WEBHOOKS_SECRET" ]; then
echo "# Warning: Webhooks API Shared Secret mismatch: "
echo "# ${SERVLET_DIR}/bigbluebutton/WEB-INF/classes/bigbluebutton.properties = $BBB_SECRET"
echo "# /usr/local/bigbluebutton/bbb-webhooks/config_local.coffee = $WEBHOOKS_SECRET"
echo
fi
WEBHOOKS_PROXY_PORT=$(cat /etc/bigbluebutton/nginx/webhooks.nginx | grep -v '#' | grep '^[ \t]*proxy_pass[ \t]*' | sed 's|.*http[s]\?://[^:]*:\([^;]*\);.*|\1|g')
WEBHOOKS_APP_PORT=$(cat /usr/local/bigbluebutton/bbb-webhooks/config_local.coffee | grep '^[ \t]*config.server.port[ =]*' | cut -d '=' -f2 | xargs)
if [ -f /usr/lib/systemd/system/bbb-webhooks.service ]; then
if [ -f /usr/local/bigbluebutton/bbb-webhooks/config_local.js ]; then
WEBHOOKS_SECRET=$(cat /usr/local/bigbluebutton/bbb-webhooks/config_local.js | grep '^[ \t]*config.bbb.sharedSecret[ =]*' | cut -d '"' -f2)
WEBHOOKS_CONF=/usr/local/bigbluebutton/bbb-webhooks/config_local.js
fi
if [ -f /usr/local/bigbluebutton/bbb-webhooks/config_local.coffee ]; then
WEBHOOKS_SECRET=$(cat /usr/local/bigbluebutton/bbb-webhooks/config_local.coffee | grep '^[ \t]*config.bbb.sharedSecret[ =]*' | cut -d '"' -f2)
WEBHOOKS_CONF=/usr/local/bigbluebutton/bbb-webhooks/config_local.coffee
fi
if [ "$BBB_SECRET" != "$WEBHOOKS_SECRET" ]; then
echo "# Warning: Webhooks API Shared Secret mismatch: "
echo "# ${SERVLET_DIR}/bigbluebutton/WEB-INF/classes/bigbluebutton.properties = $BBB_SECRET"
echo "# $WEBHOOKS_CONF = $WEBHOOKS_SECRET"
echo
fi
WEBHOOKS_PROXY_PORT=$(cat /etc/bigbluebutton/nginx/webhooks.nginx | grep -v '#' | grep '^[ \t]*proxy_pass[ \t]*' | sed 's|.*http[s]\?://[^:]*:\([^;]*\);.*|\1|g')
WEBHOOKS_APP_PORT=$(cat $WEBHOOKS_CONF | grep config.server.port | sed "s/.*config.server.port[ =\"]*//g" | sed 's/[;\"]*//g')
if [ "$WEBHOOKS_PROXY_PORT" != "$WEBHOOKS_APP_PORT" ]; then
echo "# Warning: Webhooks port mismatch: "
echo "# /etc/bigbluebutton/nginx/webhooks.nginx = $WEBHOOKS_PROXY_PORT"
echo "# $WEBHOOKS_CONF = $WEBHOOKS_APP_PORT"
echo
fi
fi
if [ "$WEBHOOKS_PROXY_PORT" != "$WEBHOOKS_APP_PORT" ]; then
echo "# Warning: Webhooks port mismatch: "
echo "# /etc/bigbluebutton/nginx/webhooks.nginx = $WEBHOOKS_PROXY_PORT"
echo "# /usr/local/bigbluebutton/bbb-webhooks/config_local.coffee = $WEBHOOKS_APP_PORT"
echo
fi
fi
if [ -f ${SERVLET_DIR}/lti/WEB-INF/classes/lti-config.properties ]; then
LTI_SECRET=$(cat ${SERVLET_DIR}/lti/WEB-INF/classes/lti-config.properties | grep -v '#' | tr -d '\r' | sed -n '/^bigbluebuttonSalt/{s/.*=//;p}')
@ -1185,7 +1196,7 @@ check_state() {
#
# Check if ffmpeg is installed, and whether it is a supported version
#
FFMPEG_VERSION=$(ffmpeg -version 2>/dev/null | grep ffmpeg | cut -d ' ' -f3)
FFMPEG_VERSION=$(ffmpeg -version 2>/dev/null | grep ffmpeg | cut -d ' ' -f3 | sed 's/--.*//g' | tr -d '\n')
case "$FFMPEG_VERSION" in
4.0.*)
# This is the current supported version; OK.
@ -1595,6 +1606,7 @@ if [ $CHECK ]; then
echo
echo "/usr/local/bigbluebutton/core/scripts/bigbluebutton.yml (record and playback)"
echo " playback host: $PLAYBACK_IP"
echo " ffmpeg: $(ffmpeg -version 2>/dev/null | grep ffmpeg | cut -d ' ' -f3 | sed 's/--.*//g' | tr -d '\n')
fi
if [ -f /usr/local/bigbluebutton/bbb-webrtc-sfu/config/default.yml ]; then
@ -1612,7 +1624,6 @@ if [ $CHECK ]; then
echo " recordWebcams: $KURENTO_RECORD_WEBCAMS"
echo " Node: $(node -v)"
echo " mongoDB: $(/usr/bin/mongod --version | grep "db version" | sed 's/db version //g')"
echo " ffmpeg: $(ffmpeg -version 2>/dev/null | grep ffmpeg | cut -d ' ' -f3)"
fi
check_state