freedombone-app-jitsi 19KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539
  1. #!/bin/bash
  2. #
  3. # .---. . .
  4. # | | |
  5. # |--- .--. .-. .-. .-.| .-. .--.--. |.-. .-. .--. .-.
  6. # | | (.-' (.-' ( | ( )| | | | )( )| | (.-'
  7. # ' ' --' --' -' - -' ' ' -' -' -' ' - --'
  8. #
  9. # Freedom in the Cloud
  10. #
  11. # Jitsi meet + videobridge
  12. #
  13. # Instructions: https://github.com/jitsi/jitsi-meet/blob/master/doc/manual-install.md
  14. #
  15. # License
  16. # =======
  17. #
  18. # Copyright (C) 2016 Bob Mottram <bob@freedombone.net>
  19. #
  20. # This program is free software: you can redistribute it and/or modify
  21. # it under the terms of the GNU Affero General Public License as published by
  22. # the Free Software Foundation, either version 3 of the License, or
  23. # (at your option) any later version.
  24. #
  25. # This program is distributed in the hope that it will be useful,
  26. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  27. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  28. # GNU Affero General Public License for more details.
  29. #
  30. # You should have received a copy of the GNU Affero General Public License
  31. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  32. VARIANTS=""
  33. IN_DEFAULT_INSTALL=0
  34. SHOW_ON_ABOUT=0
  35. VIDEOBRIDGE_PORT=5347
  36. JITSI_ONION_PORT=8102
  37. JITSI_VIDEOBRIDGE_ONION_PORT=8103
  38. JITSI_AUTH_ONION_PORT=8104
  39. JITSI_FOCUS_ONION_PORT=8105
  40. # domains
  41. JITSI_DOMAIN_NAME=
  42. JITSI_CODE=
  43. JITSI_ONION_HOSTNAME=
  44. JITSI_VIDEOBRIDGE_ONION_HOSTNAME=
  45. JITSI_AUTH_ONION_HOSTNAME=
  46. # repos
  47. JITSI_MEET_REPO="https://github.com/jitsi/jitsi-meet"
  48. JITSI_MEET_COMMIT='4d335e086be74fd9074ff302ff56401beb62bf80'
  49. JICOFO_REPO="https://github.com/jitsi/jicofo"
  50. JICOFO_COMMIT='91f08b13b34a4fddedc65901c44fce15905d6a1f'
  51. # secrets
  52. JITSI_VIDEOBRIDGE_SECRET=
  53. JITSI_FOCUS_SECRET=
  54. JITSI_CONFERENCE_SECRET=
  55. jitsi_variables=(ONION_ONLY
  56. JITSI_DOMAIN_NAME
  57. JITSI_CODE
  58. JITSI_MEET_REPO
  59. JITSI_MEET_COMMIT
  60. DEFAULT_DOMAIN_NAME
  61. JITSI_VIDEOBRIDGE_SECRET
  62. JITSI_FOCUS_SECRET
  63. JITSI_CONFERENCE_SECRET
  64. JITSI_ONION_HOSTNAME
  65. JITSI_VIDEOBRIDGE_ONION_HOSTNAME
  66. MY_USERNAME)
  67. function change_password_jitsi {
  68. echo -n ''
  69. }
  70. function can_install_videobridge {
  71. check_architecture=$(uname -a)
  72. if [[ "$check_architecture" == *"amd64"* || "$check_architecture" == *"i386"* ]]; then
  73. echo "1"
  74. else
  75. echo "0"
  76. fi
  77. }
  78. function add_jitsi_onion_domain {
  79. jitsi_subdomain_name="$1"
  80. jitsi_subdomain_port="$2"
  81. jitsi_subdomain_onion_port="$3"
  82. new_domain=$(add_onion_service "${jitsi_subdomain_name}" ${jitsi_subdomain_port} ${jitsi_subdomain_onion_port})
  83. if ! grep -q "Jitsi ${jitsi_subdomain_name} onion domain" /home/${MY_USERNAME}/README; then
  84. echo $"Jitsi ${jitsi_subdomain_name} onion domain: ${new_domain}" >> /home/${MY_USERNAME}/README
  85. echo '' >> /home/${MY_USERNAME}/README
  86. chown ${MY_USERNAME}:${MY_USERNAME} /home/${MY_USERNAME}/README
  87. chmod 600 /home/${MY_USERNAME}/README
  88. else
  89. if [ -f /home/${MY_USERNAME}/README ]; then
  90. sed -i "s|Jitsi ${jitsi_subdomain_name} onion domain.*|Jitsi ${jitsi_subdomain_name} onion domain: ${new_domain}|g" /home/${MY_USERNAME}/README
  91. fi
  92. fi
  93. echo "${new_domain}"
  94. }
  95. function create_jitsi_subdomains {
  96. JITSI_ONION_HOSTNAME=$(add_onion_service jitsi 80 ${JITSI_ONION_PORT})
  97. if ! grep -q "Jitsi onion domain" /home/${MY_USERNAME}/README; then
  98. echo $"Jitsi onion domain: ${JITSI_ONION_HOSTNAME}" >> /home/${MY_USERNAME}/README
  99. echo '' >> /home/${MY_USERNAME}/README
  100. chown ${MY_USERNAME}:${MY_USERNAME} /home/${MY_USERNAME}/README
  101. chmod 600 /home/${MY_USERNAME}/README
  102. else
  103. if [ -f /home/${MY_USERNAME}/README ]; then
  104. sed -i "s|Jitsi onion domain.*|Jitsi onion domain: ${JITSI_ONION_HOSTNAME}|g" /home/${MY_USERNAME}/README
  105. fi
  106. fi
  107. JITSI_VIDEOBRIDGE_ONION_HOSTNAME=$(add_jitsi_onion_domain jitsi-videobridge ${VIDEOBRIDGE_PORT} ${JITSI_VIDEOBRIDGE_ONION_PORT})
  108. JITSI_AUTH_ONION_HOSTNAME=$(add_jitsi_onion_domain jitsi-auth 5222 ${JITSI_AUTH_ONION_PORT})
  109. JITSI_FOCUS_ONION_HOSTNAME=$(add_jitsi_onion_domain jitsi-focus 5222 ${JITSI_FOCUS_ONION_PORT})
  110. }
  111. function remove_jitsi_subdomains {
  112. function_check remove_onion_service
  113. remove_onion_service jitsi ${JITSI_ONION_PORT}
  114. remove_onion_service jitsi-videobridge ${JITSI_VIDEOBRIDGE_ONION_PORT}
  115. remove_onion_service jitsi-auth ${JITSI_AUTH_ONION_PORT}
  116. remove_onion_service jitsi-focus ${JITSI_FOCUS_ONION_PORT}
  117. }
  118. function remove_user_jitsi {
  119. remove_username="$1"
  120. }
  121. function add_user_jitsi {
  122. new_username="$1"
  123. new_user_password="$2"
  124. }
  125. function install_interactive_jitsi {
  126. if [ ! ${ONION_ONLY} ]; then
  127. ONION_ONLY='no'
  128. fi
  129. if [[ ${ONION_ONLY} != "no" ]]; then
  130. JITSI_DOMAIN_NAME='jitsi.local'
  131. write_config_param "JITSI_DOMAIN_NAME" "$JITSI_DOMAIN_NAME"
  132. else
  133. function_check interactive_site_details
  134. interactive_site_details "jitsi" "JITSI_DOMAIN_NAME" "JITSI_CODE"
  135. fi
  136. APP_INSTALLED=1
  137. }
  138. function configure_interactive_jitsi {
  139. echo -n ''
  140. }
  141. function reconfigure_jitsi {
  142. echo -n ''
  143. }
  144. function upgrade_jitsi {
  145. echo -n ''
  146. }
  147. function backup_local_jitsi {
  148. echo -n ''
  149. }
  150. function restore_local_jitsi {
  151. echo -n ''
  152. }
  153. function backup_remote_jitsi {
  154. echo -n ''
  155. }
  156. function restore_remote_jitsi {
  157. echo -n ''
  158. }
  159. function remove_jitsi {
  160. read_config_param JITSI_DOMAIN_NAME
  161. if [ ${#JITSI_DOMAIN_NAME} -eq 0 ]; then
  162. return
  163. fi
  164. if [ -f /etc/nginx/sites-available/${JITSI_DOMAIN_NAME} ]; then
  165. nginx_dissite ${JITSI_DOMAIN_NAME}
  166. if [ -d /var/www/${JITSI_DOMAIN_NAME} ]; then
  167. rm -rf /var/www/${JITSI_DOMAIN_NAME}
  168. fi
  169. rm /etc/nginx/sites-available/${JITSI_DOMAIN_NAME}
  170. function_check remove_certs
  171. remove_certs ${JITSI_DOMAIN_NAME}
  172. systemctl reload nginx
  173. fi
  174. remove_jitsi_subdomains
  175. systemctl stop prosody
  176. if [ -f /etc/prosody/conf.d/${JITSI_DOMAIN_NAME}.cfg.lua ]; then
  177. rm /etc/prosody/conf.d/${JITSI_DOMAIN_NAME}.cfg.lua
  178. fi
  179. if [ -f /etc/prosody/conf.avail/${JITSI_DOMAIN_NAME}.cfg.lua ]; then
  180. rm /etc/prosody/conf.avail/${JITSI_DOMAIN_NAME}.cfg.lua
  181. fi
  182. prosodyctl unregister focus auth.${JITSI_DOMAIN_NAME}
  183. systemctl start prosody
  184. remove_nodejs jitsi
  185. # remove jicofo
  186. if [ -f /etc/systemd/system/jicofo.service ]; then
  187. systemctl stop jicofo
  188. systemctl disable jicofo
  189. rm /etc/systemd/system/jicofo.service
  190. fi
  191. if [ -d ${INSTALL_DIR}/jicofo ]; then
  192. rm -rf ${INSTALL_DIR}/jicofo
  193. fi
  194. # remove videobridge
  195. #firewall_remove ${VIDEOBRIDGE_PORT}
  196. apt-get -yq remove --purge jitsi-videobridge
  197. if [ -d /etc/jitsi ]; then
  198. rm -rf /etc/jitsi
  199. fi
  200. deluser -r jitsi
  201. if [ -d /usr/share/jitsi-videobridge ]; then
  202. rm -rf /usr/share/jitsi-videobridge
  203. fi
  204. sed -i "/jitsi/d" /etc/apt/sources.list
  205. apt-get update
  206. remove_app jitsi
  207. remove_completion_param install_jitsi
  208. sed -i '/jitsi/d' ${COMPLETION_FILE}
  209. sed -i '/Jitsi/d' /home/${MY_USERNAME}/README
  210. function_check remove_ddns_domain
  211. remove_ddns_domain $JITSI_DOMAIN_NAME
  212. }
  213. function install_jitsi_videobridge {
  214. apt-get -yq install wget debconf-utils
  215. echo 'deb http://download.jitsi.org/nightly/deb unstable/' >> /etc/apt/sources.list
  216. wget -qO - https://download.jitsi.org/nightly/deb/unstable/archive.key | apt-key add -
  217. apt-get update
  218. debconf-set-selections <<< "jitsi-videobridge jitsi-videobridge/jvb-hostname string jitsi-videobridge.${JITSI_VIDEOBRIDGE_ONION_HOSTNAME}"
  219. apt-get -yq install jitsi-videobridge
  220. if [ ! -d /etc/jitsi ]; then
  221. echo $'Videobridge package failed to install'
  222. exit 63983
  223. fi
  224. #firewall_add videobridge ${VIDEOBRIDGE_PORT}
  225. }
  226. function install_jitsi_jicofo {
  227. apt-get -yq install default-jdk ant
  228. if [ ! -d ${INSTALL_DIR} ]; then
  229. mkdir -p ${INSTALL_DIR}
  230. fi
  231. function_check git_clone
  232. git_clone ${JICOFO_REPO} ${INSTALL_DIR}/jicofo
  233. if [ ! -d ${INSTALL_DIR}/jicofo ]; then
  234. exit 63829
  235. fi
  236. cd ${INSTALL_DIR}/jicofo
  237. git checkout ${JICOFO_COMMIT} -b ${JICOFO_COMMIT}
  238. set_completion_param "jitsi jicofo commit" "${JICOFO_COMMIT}"
  239. check_architecture=$(uname -a)
  240. if [[ "$check_architecture" == *"amd64"* ]]; then
  241. ant dist.lin64
  242. jicofo_dir=${INSTALL_DIR}/jicofo/dist/lin64
  243. else
  244. ant dist.lin
  245. jicofo_dir=${INSTALL_DIR}/jicofo/dist/lin
  246. fi
  247. if [ ! -d ${jicofo_dir} ]; then
  248. echo $'Jicofo working directory not found'
  249. exit 62825
  250. fi
  251. # TODO does this have to be run as root?
  252. echo '[Unit]' > /etc/systemd/system/jicofo.service
  253. echo 'Description=Jicofo (Jitsi Conference Focus)' >> /etc/systemd/system/jicofo.service
  254. echo 'After=syslog.target network.target tor.service' >> /etc/systemd/system/jicofo.service
  255. echo '' >> /etc/systemd/system/jicofo.service
  256. echo '[Service]' >> /etc/systemd/system/jicofo.service
  257. echo 'Type=simple' >> /etc/systemd/system/jicofo.service
  258. echo 'User=root' >> /etc/systemd/system/jicofo.service
  259. echo 'Group=root' >> /etc/systemd/system/jicofo.service
  260. echo "WorkingDirectory=${jicofo_dir}" >> /etc/systemd/system/jicofo.service
  261. echo "ExecStart=/usr/bin/torify ./jicofo.sh --domain=${JITSI_ONION_HOSTNAME} --secret=\"${JITSI_FOCUS_SECRET}\" --user_domain=${JITSI_AUTH_ONION_HOSTNAME} --user_name=focus --user_password=\"${JITSI_CONFERENCE_SECRET}\"" >> /etc/systemd/system/jicofo.service
  262. echo 'Restart=on-failure' >> /etc/systemd/system/jicofo.service
  263. echo 'SuccessExitStatus=3 4' >> /etc/systemd/system/jicofo.service
  264. echo 'RestartForceExitStatus=3 4' >> /etc/systemd/system/jicofo.service
  265. echo '' >> /etc/systemd/system/jicofo.service
  266. echo '[Install]' >> /etc/systemd/system/jicofo.service
  267. echo 'WantedBy=multi-user.target' >> /etc/systemd/system/jicofo.service
  268. chmod +x /etc/systemd/system/jicofo.service
  269. systemctl enable jicofo
  270. systemctl start jicofo
  271. }
  272. function install_jitsi_xmpp {
  273. if [ ! -d /etc/prosody/conf.avail ]; then
  274. echo $'Missing directory /etc/prosody/conf.avail'
  275. exit 62382
  276. fi
  277. cp /var/www/${JITSI_DOMAIN_NAME}/htdocs/prosody-plugins/*.lua /usr/lib/prosody/modules
  278. cp -r /var/www/${JITSI_DOMAIN_NAME}/htdocs/prosody-plugins/token /usr/lib/prosody/modules/
  279. update_default_domain
  280. prosody_config=/etc/prosody/conf.avail/${JITSI_DOMAIN_NAME}.cfg.lua
  281. echo "VirtualHost \"${JITSI_DOMAIN_NAME}\"" > $prosody_config
  282. echo 'authentication = "anonymous"' >> $prosody_config
  283. echo 'ssl = {' >> $prosody_config
  284. echo " key = \"/etc/prosody/certs/${JITSI_DOMAIN_NAME}.key\";" >> $prosody_config
  285. echo " certificate = \"/etc/prosody/certs/${JITSI_DOMAIN_NAME}.pem\";" >> $prosody_config
  286. echo " dhparam = \"/etc/prosody/certs/${JITSI_DOMAIN_NAME}.dhparam\";" >> $prosody_config
  287. echo ' options = {"no_sslv2", "no_sslv3" };' >> $prosody_config
  288. echo '}' >> $prosody_config
  289. echo '' >> $prosody_config
  290. echo 'modules_enabled = {' >> $prosody_config
  291. echo ' "bosh";' >> $prosody_config
  292. echo ' "pubsub";' >> $prosody_config
  293. echo ' "tls";' >> $prosody_config
  294. echo ' "onions";' >> $prosody_config
  295. echo ' "saslauth";' >> $prosody_config
  296. echo '}' >> $prosody_config
  297. echo '' >> $prosody_config
  298. echo "VirtualHost \"${JITSI_ONION_HOSTNAME}\"" > $prosody_config
  299. echo ' authentication = "anonymous"' >> $prosody_config
  300. echo '' >> $prosody_config
  301. echo "VirtualHost \"${JITSI_AUTH_ONION_HOSTNAME}\"" >> $prosody_config
  302. echo ' authentication = "internal_plain"' >> $prosody_config
  303. echo '' >> $prosody_config
  304. echo "admins = { \"focus@${JITSI_AUTH_ONION_HOSTNAME}\" }" >> $prosody_config
  305. echo '' >> $prosody_config
  306. echo "Component \"${JITSI_CONFERENCE_ONION_HOSTNAME}\" \"muc\"" >> $prosody_config
  307. echo "Component \"${JITSI_VIDEOBRIDGE_ONION_HOSTNAME}\"" >> $prosody_config
  308. echo " component_secret = \"${JITSI_VIDEOBRIDGE_SECRET}\"" >> $prosody_config
  309. echo "Component \"${JITSI_FOCUS_ONION_HOSTNAME}\"" >> $prosody_config
  310. echo " component_secret = \"${JITSI_FOCUS_SECRET}\"" >> $prosody_config
  311. ln -s /etc/prosody/conf.avail/${JITSI_DOMAIN_NAME}.cfg.lua /etc/prosody/conf.d/${JITSI_DOMAIN_NAME}.cfg.lua
  312. prosodyctl register focus ${JITSI_AUTH_ONION_HOSTNAME} "${JITSI_CONFERENCE_SECRET}"
  313. }
  314. function install_jitsi_meet {
  315. if [ ${#JITSI_DOMAIN_NAME} -eq 0 ]; then
  316. exit 367839
  317. fi
  318. function_check install_nodejs
  319. install_nodejs jitsi
  320. if [ ! -d /var/www/${JITSI_DOMAIN_NAME} ]; then
  321. mkdir -p /var/www/${JITSI_DOMAIN_NAME}
  322. fi
  323. if [ ! -d /var/www/${JITSI_DOMAIN_NAME}/htdocs ]; then
  324. function_check git_clone
  325. git_clone ${JITSI_MEET_REPO} /var/www/${JITSI_DOMAIN_NAME}/htdocs
  326. if [ ! -d /var/www/${JITSI_DOMAIN_NAME}/htdocs ]; then
  327. echo $'Unable to clone jitsi meet repo'
  328. exit 345673
  329. fi
  330. fi
  331. cd /var/www/${JITSI_DOMAIN_NAME}/htdocs
  332. git checkout ${JITSI_MEET_COMMIT} -b ${JITSI_MEET_COMMIT}
  333. set_completion_param "jitsi commit" "${JITSI_MEET_COMMIT}"
  334. install_jitsi_xmpp
  335. chmod a+w /var/www/${JITSI_DOMAIN_NAME}/htdocs
  336. npm install -g browserify@13.1.1
  337. npm install
  338. make
  339. jitsi_nginx_site=/etc/nginx/sites-available/$JITSI_DOMAIN_NAME
  340. if [[ $ONION_ONLY == "no" ]]; then
  341. function_check nginx_http_redirect
  342. nginx_http_redirect $JITSI_DOMAIN_NAME
  343. echo 'server {' >> $jitsi_nginx_site
  344. echo ' listen 443 ssl;' >> $jitsi_nginx_site
  345. echo " server_name ${JITSI_DOMAIN_NAME};" >> $jitsi_nginx_site
  346. echo '' >> $jitsi_nginx_site
  347. echo ' # Security' >> $jitsi_nginx_site
  348. function_check nginx_ssl
  349. nginx_ssl $JITSI_DOMAIN_NAME
  350. function_check nginx_disable_sniffing
  351. nginx_disable_sniffing $JITSI_DOMAIN_NAME
  352. echo ' add_header Strict-Transport-Security max-age=15768000;' >> $jitsi_nginx_site
  353. echo '' >> $jitsi_nginx_site
  354. echo ' # Logs' >> $jitsi_nginx_site
  355. echo ' access_log off;' >> $jitsi_nginx_site
  356. echo ' error_log off;' >> $jitsi_nginx_site
  357. echo '' >> $jitsi_nginx_site
  358. echo ' # Root' >> $jitsi_nginx_site
  359. echo " root /var/www/${JITSI_DOMAIN_NAME}/htdocs;" >> $jitsi_nginx_site
  360. echo '' >> $jitsi_nginx_site
  361. echo ' index index.html;' >> $jitsi_nginx_site
  362. echo '' >> $jitsi_nginx_site
  363. echo ' location ~ ^/([a-zA-Z0-9=\?]+)$ {' >> $jitsi_nginx_site
  364. echo ' rewrite ^/(.*)$ / break;' >> $jitsi_nginx_site
  365. echo ' }' >> $jitsi_nginx_site
  366. echo '' >> $jitsi_nginx_site
  367. echo ' location / {' >> $jitsi_nginx_site
  368. function_check nginx_limits
  369. nginx_limits $JITSI_DOMAIN_NAME '15m'
  370. echo ' }' >> $jitsi_nginx_site
  371. echo '' >> $jitsi_nginx_site
  372. echo ' location /http-bind {' >> $jitsi_nginx_site
  373. echo ' proxy_pass http://localhost:5280/http-bind;' >> $jitsi_nginx_site
  374. echo ' proxy_set_header X-Forwarded-For $remote_addr;' >> $jitsi_nginx_site
  375. echo ' proxy_set_header Host $http_host;' >> $jitsi_nginx_site
  376. echo ' }' >> $jitsi_nginx_site
  377. echo '}' >> $jitsi_nginx_site
  378. else
  379. echo -n '' > $jitsi_nginx_site
  380. fi
  381. echo 'server {' >> $jitsi_nginx_site
  382. echo " listen 127.0.0.1:$JITSI_ONION_PORT default_server;" >> $jitsi_nginx_site
  383. echo " server_name ${JITSI_DOMAIN_NAME};" >> $jitsi_nginx_site
  384. echo '' >> $jitsi_nginx_site
  385. function_check nginx_disable_sniffing
  386. nginx_disable_sniffing $JITSI_DOMAIN_NAME
  387. echo '' >> $jitsi_nginx_site
  388. echo ' # Logs' >> $jitsi_nginx_site
  389. echo ' access_log off;' >> $jitsi_nginx_site
  390. echo ' error_log off;' >> $jitsi_nginx_site
  391. echo '' >> $jitsi_nginx_site
  392. echo ' # Root' >> $jitsi_nginx_site
  393. echo " root /var/www/${JITSI_DOMAIN_NAME}/htdocs;" >> $jitsi_nginx_site
  394. echo '' >> $jitsi_nginx_site
  395. echo ' index index.html;' >> $jitsi_nginx_site
  396. echo '' >> $jitsi_nginx_site
  397. echo ' location ~ ^/([a-zA-Z0-9=\?]+)$ {' >> $jitsi_nginx_site
  398. echo ' rewrite ^/(.*)$ / break;' >> $jitsi_nginx_site
  399. echo ' }' >> $jitsi_nginx_site
  400. echo '' >> $jitsi_nginx_site
  401. echo ' location / {' >> $jitsi_nginx_site
  402. function_check nginx_limits
  403. nginx_limits $JITSI_DOMAIN_NAME '15m'
  404. echo ' }' >> $jitsi_nginx_site
  405. echo '' >> $jitsi_nginx_site
  406. echo ' location /http-bind {' >> $jitsi_nginx_site
  407. echo ' proxy_pass http://localhost:5280/http-bind;' >> $jitsi_nginx_site
  408. echo ' proxy_set_header X-Forwarded-For $remote_addr;' >> $jitsi_nginx_site
  409. echo ' proxy_set_header Host $http_host;' >> $jitsi_nginx_site
  410. echo ' }' >> $jitsi_nginx_site
  411. echo '}' >> $jitsi_nginx_site
  412. function_check create_site_certificate
  413. create_site_certificate ${JITSI_DOMAIN_NAME} 'yes'
  414. if [ -f /etc/ssl/certs/${JITSI_DOMAIN_NAME}.crt ]; then
  415. mv /etc/ssl/certs/${JITSI_DOMAIN_NAME}.crt /etc/ssl/certs/${JITSI_DOMAIN_NAME}.pem
  416. fi
  417. if [ -f /etc/ssl/certs/${JITSI_DOMAIN_NAME}.pem ]; then
  418. chown jitsi: /etc/ssl/certs/${JITSI_DOMAIN_NAME}.pem
  419. fi
  420. if [ -f /etc/ssl/private/${JITSI_DOMAIN_NAME}.key ]; then
  421. chown jitsi: /etc/ssl/private/${JITSI_DOMAIN_NAME}.key
  422. fi
  423. function_check nginx_ensite
  424. nginx_ensite ${JITSI_DOMAIN_NAME}
  425. set_completion_param "jitsi domain" "$JITSI_DOMAIN_NAME"
  426. chown -R www-data:www-data /var/www/${JITSI_DOMAIN_NAME}/htdocs
  427. systemctl restart nginx
  428. }
  429. function install_jitsi {
  430. if [[ "$(can_install_videobridge)" == "0" ]]; then
  431. echo $'jitsi meet/videobridge can only be installed on i386 or amd64 architectures'
  432. exit 83562
  433. fi
  434. if [ ! ${JITSI_DOMAIN_NAME} ]; then
  435. echo $'No domain name was given for jitsi'
  436. exit 47682
  437. fi
  438. if [ ! -d /etc/prosody ]; then
  439. echo $'xmpp must be installed before installing jitsi'
  440. exit 62394
  441. fi
  442. if [[ "${JITSI_DOMAIN_NAME}" == "${DEFAULT_DOMAIN_NAME}" ]]; then
  443. echo $'The jitsi domain name should not be the same as the main domain name'
  444. exit 78372
  445. fi
  446. if [ ! ${JITSI_VIDEOBRIDGE_SECRET} ]; then
  447. JITSI_VIDEOBRIDGE_SECRET="$(create_password 30)"
  448. fi
  449. if [ ! ${JITSI_FOCUS_SECRET} ]; then
  450. JITSI_FOCUS_SECRET="$(create_password 30)"
  451. fi
  452. if [ ! ${JITSI_CONFERENCE_SECRET} ]; then
  453. JITSI_CONFERENCE_SECRET="$(create_password 30)"
  454. fi
  455. create_jitsi_subdomains
  456. install_jitsi_videobridge
  457. install_jitsi_jicofo
  458. install_jitsi_meet
  459. function_check add_ddns_domain
  460. add_ddns_domain $JITSI_DOMAIN_NAME
  461. APP_INSTALLED=1
  462. }