Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

jitsi-meet-tokens.postinst 3.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. #!/bin/bash
  2. # postinst script for jitsi-meet-tokens
  3. #
  4. # see: dh_installdeb(1)
  5. set -e
  6. # summary of how this script can be called:
  7. # * <postinst> `configure' <most-recently-configured-version>
  8. # * <old-postinst> `abort-upgrade' <new version>
  9. # * <conflictor's-postinst> `abort-remove' `in-favour' <package>
  10. # <new-version>
  11. # * <postinst> `abort-remove'
  12. # * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
  13. # <failed-install-package> <version> `removing'
  14. # <conflicting-package> <version>
  15. # for details, see http://www.debian.org/doc/debian-policy/ or
  16. # the debian-policy package
  17. case "$1" in
  18. configure)
  19. if [ -f "/etc/jitsi/videobridge/config" ] ; then
  20. . /etc/jitsi/videobridge/config
  21. fi
  22. if [ -f "/etc/jitsi/jicofo/config" ] ; then
  23. . /etc/jitsi/jicofo/config
  24. fi
  25. # loading debconf
  26. . /usr/share/debconf/confmodule
  27. db_get jitsi-meet-tokens/appid
  28. if [ "$RET" = "false" ] ; then
  29. echo "Application ID is mandatory"
  30. exit 1
  31. fi
  32. APP_ID=$RET
  33. db_get jitsi-meet-tokens/appsecret
  34. if [ "$RET" = "false" ] ; then
  35. echo "Application secret is mandatory"
  36. fi
  37. APP_SECRET=$RET
  38. # We can adjust Prosody config only if there is Jvb or Jicofo domain configured
  39. PROSODY_HOST_CONFIG="/etc/prosody/conf.avail/$JVB_HOSTNAME.cfg.lua"
  40. if [ ! -f "$PROSODY_HOST_CONFIG" ] ; then
  41. PROSODY_HOST_CONFIG="/etc/prosody/conf.avail/$JICOFO_HOSTNAME.cfg.lua"
  42. fi
  43. # Store config filename for purge
  44. db_set jitsi-meet-prosody/prosody_config $PROSODY_HOST_CONFIG
  45. db_stop
  46. if [ -f "$PROSODY_HOST_CONFIG" ] ; then
  47. if grep -q "plugin_paths" "$PROSODY_HOST_CONFIG"; then
  48. # enable tokens in prosody host config
  49. sed -i 's/--plugin_paths/plugin_paths/g' $PROSODY_HOST_CONFIG
  50. sed -i 's/authentication = "anonymous"/authentication = "token"/g' $PROSODY_HOST_CONFIG
  51. sed -i 's/ --allow_unencrypted_plain_auth/ allow_unencrypted_plain_auth/g' $PROSODY_HOST_CONFIG
  52. sed -i "s/ --app_id=example_app_id/ app_id=$APP_ID/g" $PROSODY_HOST_CONFIG
  53. sed -i "s/ --app_secret=example_app_secret/ app_secret=$APP_SECRET/g" $PROSODY_HOST_CONFIG
  54. sed -i 's/ --modules_enabled = { "token_verification" }/ modules_enabled = { "token_verification" }/g' $PROSODY_HOST_CONFIG
  55. # Configure Jicofo properties
  56. JICOFO_CONFIG="/etc/jitsi/jicofo/sip-communicator.properties"
  57. if ! grep -q "org.jitsi.jicofo.auth.jwt.APP_ID" $JICOFO_CONFIG && \
  58. ! grep -q "org.jitsi.jicofo.auth.jwt.APP_SECRET" $JICOFO_CONFIG; then
  59. echo "org.jitsi.jicofo.auth.jwt.APP_ID=$APP_ID" >> $JICOFO_CONFIG
  60. echo "org.jitsi.jicofo.auth.jwt.APP_SECRET=$APP_SECRET" >> $JICOFO_CONFIG
  61. # Restart Jicofo
  62. if [ -x "/etc/init.d/jicofo" ]; then
  63. invoke-rc.d jicofo restart
  64. fi
  65. fi
  66. if [ -x "/etc/init.d/prosody" ]; then
  67. invoke-rc.d prosody reload
  68. fi
  69. else
  70. echo "Failed apply auto-config to $PROSODY_HOST_CONFIG which most likely comes from not supported version of jitsi-meet"
  71. fi
  72. else
  73. echo "Prosody config not found at $PROSODY_HOST_CONFIG - unable to auto-configure token authentication"
  74. fi
  75. ;;
  76. abort-upgrade|abort-remove|abort-deconfigure)
  77. ;;
  78. *)
  79. echo "postinst called with unknown argument \`$1'" >&2
  80. exit 1
  81. ;;
  82. esac
  83. # dh_installdeb will replace this with shell code automatically
  84. # generated by other debhelper scripts.
  85. #DEBHELPER#
  86. exit 0