2
0

10-config 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #!/usr/bin/with-contenv bash
  2. if [[ ! -f /config/saslauthd.conf ]]; then
  3. cp /defaults/saslauthd.conf /config/
  4. fi
  5. if [[ ! -f /etc/saslauthd.conf ]]; then
  6. tpl /config/saslauthd.conf > /etc/saslauthd.conf
  7. mkdir -pm777 /var/run/saslauthd
  8. adduser prosody sasl
  9. echo >> /etc/ldap/ldap.conf "TLS_REQCERT allow"
  10. fi
  11. PROSODY_CFG="/config/prosody.cfg.lua"
  12. if [[ ! -d /config/data ]]; then
  13. mkdir -pm 750 /config/data
  14. fi
  15. if [[ "$(stat -c %U /config)" != "prosody" ]]; then
  16. chown -R prosody /config
  17. fi
  18. if [[ "$(stat -c %U /prosody-plugins)" != "prosody" ]]; then
  19. chown -R prosody /prosody-plugins
  20. fi
  21. if [[ "$(stat -c %U /prosody-plugins-custom)" != "prosody" ]]; then
  22. chown -R prosody /prosody-plugins-custom
  23. fi
  24. if [[ ! -f $PROSODY_CFG ]]; then
  25. cp -r /defaults/* /config
  26. tpl /defaults/prosody.cfg.lua > $PROSODY_CFG
  27. tpl /defaults/conf.d/jitsi-meet.cfg.lua > /config/conf.d/jitsi-meet.cfg.lua
  28. prosodyctl --config $PROSODY_CFG register $JICOFO_AUTH_USER $XMPP_AUTH_DOMAIN $JICOFO_AUTH_PASSWORD
  29. prosodyctl --config $PROSODY_CFG register $JVB_AUTH_USER $XMPP_AUTH_DOMAIN $JVB_AUTH_PASSWORD
  30. if [[ ! -z $JIBRI_XMPP_USER ]] && [[ ! -z $JIBRI_XMPP_PASSWORD ]]; then
  31. prosodyctl --config $PROSODY_CFG register $JIBRI_XMPP_USER $XMPP_AUTH_DOMAIN $JIBRI_XMPP_PASSWORD
  32. fi
  33. if [[ ! -z $JIBRI_RECORDER_USER ]] && [[ ! -z $JIBRI_RECORDER_PASSWORD ]]; then
  34. prosodyctl --config $PROSODY_CFG register $JIBRI_RECORDER_USER $XMPP_RECORDER_DOMAIN $JIBRI_RECORDER_PASSWORD
  35. fi
  36. if [[ ! -z $JIGASI_XMPP_USER ]] && [[ ! -z $JIGASI_XMPP_PASSWORD ]]; then
  37. prosodyctl --config $PROSODY_CFG register $JIGASI_XMPP_USER $XMPP_AUTH_DOMAIN $JIGASI_XMPP_PASSWORD
  38. fi
  39. fi
  40. mkdir -p /config/certs
  41. if [[ ! -f /config/certs/$XMPP_DOMAIN.crt ]]; then
  42. # echo for using all default values
  43. echo | prosodyctl --config $PROSODY_CFG cert generate $XMPP_DOMAIN
  44. fi
  45. if [[ ! -f /config/certs/$XMPP_AUTH_DOMAIN.crt ]]; then
  46. # echo for using all default values
  47. echo | prosodyctl --config $PROSODY_CFG cert generate $XMPP_AUTH_DOMAIN
  48. fi
  49. # certs will be created in /config/data
  50. mv /config/data/*.{crt,key} /config/certs/ || true
  51. rm -f /config/data/*.cnf