#!/usr/bin/with-contenv bash if [[ ! -f /etc/saslauthd.conf ]]; then tpl /defaults/saslauthd.conf > /etc/saslauthd.conf mkdir -pm777 /var/run/saslauthd adduser prosody sasl echo >> /etc/ldap/ldap.conf "TLS_REQCERT allow" fi PROSODY_CFG="/config/prosody.cfg.lua" if [[ ! -d /config/data ]]; then mkdir -pm 750 /config/data fi if [[ "$(stat -c %U /config)" != "prosody" ]]; then chown -R prosody /config fi if [[ "$(stat -c %U /prosody-plugins)" != "prosody" ]]; then chown -R prosody /prosody-plugins fi if [[ "$(stat -c %U /prosody-plugins-custom)" != "prosody" ]]; then chown -R prosody /prosody-plugins-custom fi mkdir /config/certs cp -r /defaults/* /config tpl /defaults/prosody.cfg.lua > $PROSODY_CFG tpl /defaults/conf.d/jitsi-meet.cfg.lua > /config/conf.d/jitsi-meet.cfg.lua if [[ -z $JICOFO_AUTH_PASSWORD ]]; then echo 'FATAL ERROR: Jicofo auth password must be set' exit 1 fi # Defaults [ -z "${JIBRI_RECORDER_USER}" ] && export JIBRI_RECORDER_USER=recorder [ -z "${JIBRI_XMPP_USER}" ] && export JIBRI_XMPP_USER=jibri [ -z "${JIGASI_XMPP_USER}" ] && export JIGASI_XMPP_USER=jigasi [ -z "${JVB_AUTH_USER}" ] && export JVB_AUTH_USER=jvb [ -z "${XMPP_DOMAIN}" ] && export XMPP_DOMAIN=meet.jitsi [ -z "${XMPP_AUTH_DOMAIN}" ] && export XMPP_AUTH_DOMAIN=auth.meet.jitsi [ -z "${XMPP_RECORDER_DOMAIN}" ] && export XMPP_RECORDER_DOMAIN=recorder.meet.jitsi prosodyctl --config $PROSODY_CFG register focus $XMPP_AUTH_DOMAIN $JICOFO_AUTH_PASSWORD prosodyctl --config $PROSODY_CFG mod_roster_command subscribe focus.$XMPP_DOMAIN focus@$XMPP_AUTH_DOMAIN if [[ -z $JVB_AUTH_PASSWORD ]]; then echo 'FATAL ERROR: JVB auth password must be set' exit 1 fi OLD_JVB_AUTH_PASSWORD=passw0rd if [[ "$JVB_AUTH_PASSWORD" == "$OLD_JVB_AUTH_PASSWORD" ]]; then echo 'FATAL ERROR: JVB auth password must be changed, check the README' exit 1 fi prosodyctl --config $PROSODY_CFG register $JVB_AUTH_USER $XMPP_AUTH_DOMAIN $JVB_AUTH_PASSWORD if [[ ! -z $JIBRI_XMPP_PASSWORD ]]; then OLD_JIBRI_XMPP_PASSWORD=passw0rd if [[ "$JIBRI_XMPP_PASSWORD" == "$OLD_JIBRI_XMPP_PASSWORD" ]]; then echo 'FATAL ERROR: Jibri auth password must be changed, check the README' exit 1 fi prosodyctl --config $PROSODY_CFG register $JIBRI_XMPP_USER $XMPP_AUTH_DOMAIN $JIBRI_XMPP_PASSWORD fi if [[ ! -z $JIBRI_RECORDER_PASSWORD ]]; then OLD_JIBRI_RECORDER_PASSWORD=passw0rd if [[ "$JIBRI_RECORDER_PASSWORD" == "$OLD_JIBRI_RECORDER_PASSWORD" ]]; then echo 'FATAL ERROR: Jibri recorder password must be changed, check the README' exit 1 fi prosodyctl --config $PROSODY_CFG register $JIBRI_RECORDER_USER $XMPP_RECORDER_DOMAIN $JIBRI_RECORDER_PASSWORD fi if [[ ! -z $JIGASI_XMPP_PASSWORD ]]; then OLD_JIGASI_XMPP_PASSWORD=passw0rd if [[ "$JIGASI_XMPP_PASSWORD" == "$OLD_JIGASI_XMPP_PASSWORD" ]]; then echo 'FATAL ERROR: Jigasi auth password must be changed, check the README' exit 1 fi prosodyctl --config $PROSODY_CFG register $JIGASI_XMPP_USER $XMPP_AUTH_DOMAIN $JIGASI_XMPP_PASSWORD fi if [[ ! -f /config/certs/$XMPP_DOMAIN.crt ]]; then # echo for using all default values echo | prosodyctl --config $PROSODY_CFG cert generate $XMPP_DOMAIN fi if [[ ! -f /config/certs/$XMPP_AUTH_DOMAIN.crt ]]; then # echo for using all default values echo | prosodyctl --config $PROSODY_CFG cert generate $XMPP_AUTH_DOMAIN fi # certs will be created in /config/data mv /config/data/*.{crt,key} /config/certs/ || true rm -f /config/data/*.cnf