Bob Mottram 8 vuotta sitten
vanhempi
commit
b39c34fbb6
1 muutettua tiedostoa jossa 44 lisäystä ja 130 poistoa
  1. 44
    130
      src/freedombone-app-jitsi

+ 44
- 130
src/freedombone-app-jitsi Näytä tiedosto

@@ -46,29 +46,15 @@ JITSI_PORT=5280
46 46
 JITSI_DOMAIN_NAME=
47 47
 JITSI_CODE=
48 48
 JITSI_ONION_HOSTNAME=
49
-JITSI_VIDEOBRIDGE_ONION_HOSTNAME=
50 49
 JITSI_AUTH_ONION_HOSTNAME=
51 50
 
52
-# repos
53
-JITSI_MEET_REPO="https://github.com/jitsi/jitsi-meet"
54
-JITSI_MEET_COMMIT='4d335e086be74fd9074ff302ff56401beb62bf80'
55
-
56
-# secrets
57
-JITSI_VIDEOBRIDGE_SECRET=
58
-JITSI_FOCUS_SECRET=
59
-JITSI_CONFERENCE_SECRET=
60
-
61 51
 jitsi_variables=(ONION_ONLY
62 52
                  JITSI_DOMAIN_NAME
63 53
                  JITSI_CODE
64 54
                  JITSI_MEET_REPO
65 55
                  JITSI_MEET_COMMIT
66 56
                  DEFAULT_DOMAIN_NAME
67
-                 JITSI_VIDEOBRIDGE_SECRET
68
-                 JITSI_FOCUS_SECRET
69
-                 JITSI_CONFERENCE_SECRET
70 57
                  JITSI_ONION_HOSTNAME
71
-                 JITSI_VIDEOBRIDGE_ONION_HOSTNAME
72 58
                  MY_USERNAME)
73 59
 
74 60
 function change_password_jitsi {
@@ -118,17 +104,17 @@ function create_jitsi_subdomains {
118 104
         fi
119 105
     fi
120 106
 
121
-    JITSI_VIDEOBRIDGE_ONION_HOSTNAME=$(add_jitsi_onion_domain jitsi-videobridge ${VIDEOBRIDGE_PORT} ${JITSI_VIDEOBRIDGE_ONION_PORT})
122
-    JITSI_AUTH_ONION_HOSTNAME=$(add_jitsi_onion_domain jitsi-auth 5222 ${JITSI_AUTH_ONION_PORT})
123
-    JITSI_FOCUS_ONION_HOSTNAME=$(add_jitsi_onion_domain jitsi-focus 5222 ${JITSI_FOCUS_ONION_PORT})
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})
124 110
 }
125 111
 
126 112
 function remove_jitsi_subdomains {
127 113
     function_check remove_onion_service
128 114
     remove_onion_service jitsi ${JITSI_ONION_PORT}
129
-    remove_onion_service jitsi-videobridge ${JITSI_VIDEOBRIDGE_ONION_PORT}
130
-    remove_onion_service jitsi-auth ${JITSI_AUTH_ONION_PORT}
131
-    remove_onion_service jitsi-focus ${JITSI_FOCUS_ONION_PORT}
115
+    #remove_onion_service jitsi-videobridge ${JITSI_VIDEOBRIDGE_ONION_PORT}
116
+    #remove_onion_service jitsi-auth ${JITSI_AUTH_ONION_PORT}
117
+    #remove_onion_service jitsi-focus ${JITSI_FOCUS_ONION_PORT}
132 118
 }
133 119
 
134 120
 function remove_user_jitsi {
@@ -223,7 +209,7 @@ function remove_jitsi {
223 209
 
224 210
     # remove videobridge
225 211
     #firewall_remove ${VIDEOBRIDGE_PORT}
226
-    apt-get -yq remove --purge jitsi-videobridge jicofo
212
+    apt-get -yq remove --purge jitsi-videobridge jicofo jitsi-meet
227 213
     if [ -d /etc/jitsi ]; then
228 214
         rm -rf /etc/jitsi
229 215
     fi
@@ -243,48 +229,6 @@ function remove_jitsi {
243 229
     remove_ddns_domain $JITSI_DOMAIN_NAME
244 230
 }
245 231
 
246
-function install_jitsi_videobridge {
247
-    apt-get -yq install wget debconf-utils
248
-    echo 'deb http://download.jitsi.org/nightly/deb unstable/' >> /etc/apt/sources.list
249
-    wget -qO - https://download.jitsi.org/nightly/deb/unstable/archive.key | apt-key add -
250
-    apt-get update
251
-
252
-    debconf-set-selections <<< "jitsi-videobridge jitsi-videobridge/jvb-hostname string jitsi-videobridge.${JITSI_VIDEOBRIDGE_ONION_HOSTNAME}"
253
-    apt-get -yq install jitsi-videobridge
254
-    if [ ! -d /etc/jitsi ]; then
255
-        echo $'Videobridge package failed to install'
256
-        exit 63983
257
-    fi
258
-    #firewall_add videobridge ${VIDEOBRIDGE_PORT}
259
-}
260
-
261
-function install_jitsi_jicofo {
262
-    apt-get -yq install jicofo
263
-    if [ ! -f /usr/share/jicofo/jicofo.sh ]; then
264
-        echo $'jicofo package install failed'
265
-        exit 6238345
266
-    fi
267
-
268
-    systemctl stop jicofo
269
-
270
-    jicofo_config=/etc/jitsi/jicofo/config
271
-    sed -i "s|JICOFO_HOST=.*|JICOFO_HOST=localhost|g" $jicofo_config
272
-    sed -i "s|JICOFO_HOSTNAME=.*|JICOFO_HOSTNAME=${JITSI_VIDEOBRIDGE_ONION_HOSTNAME}|g" $jicofo_config
273
-    sed -i "s|JICOFO_SECRET=.*|JICOFO_SECRET=${JITSI_VIDEOBRIDGE_SECRET}|g" $jicofo_config
274
-    sed -i "s|JICOFO_PORT=.*|JICOFO_PORT=${VIDEOBRIDGE_PORT}|g" $jicofo_config
275
-    sed -i "s|JICOFO_AUTH_DOMAIN=.*|JICOFO_AUTH_DOMAIN=${JITSI_AUTH_ONION_HOSTNAME}|g" $jicofo_config
276
-    sed -i "s|JICOFO_AUTH_USER=.*|JICOFO_AUTH_USER=focus|g" $jicofo_config
277
-    sed -i "s|JICOFO_AUTH_PASSWORD=.*|JICOFO_AUTH_PASSWORD=${JITSI_FOCUS_SECRET}|g" $jicofo_config
278
-
279
-    if [ ! -f /etc/init.d/jicofo ]; then
280
-        echo $'jicofo daemon not found'
281
-        exit 737279
282
-    fi
283
-    sed -i 's|exec $DAEMON|exec /usr/bin/torify $DAEMON|g' /etc/init.d/jicofo
284
-    systemctl daemon-reload
285
-    systemctl start jicofo
286
-}
287
-
288 232
 function install_jitsi_xmpp {
289 233
     if [ ! -d /etc/prosody/conf.avail ]; then
290 234
         echo $'Missing directory /etc/prosody/conf.avail'
@@ -340,37 +284,48 @@ function install_jitsi_xmpp {
340 284
     prosodyctl register focus ${JITSI_AUTH_ONION_HOSTNAME} "${JITSI_CONFERENCE_SECRET}"
341 285
 }
342 286
 
343
-function install_jitsi_meet {
344
-    if [ ${#JITSI_DOMAIN_NAME} -eq 0 ]; then
345
-        exit 367839
287
+function install_jitsi {
288
+    if [[ "$(can_install_videobridge)" == "0" ]]; then
289
+        echo $'jitsi meet/videobridge can only be installed on i386 or amd64 architectures'
290
+        exit 83562
346 291
     fi
347 292
 
348
-    function_check install_nodejs
349
-    install_nodejs jitsi
293
+    if [ ! ${JITSI_DOMAIN_NAME} ]; then
294
+        echo $'No domain name was given for jitsi'
295
+        exit 47682
296
+    fi
350 297
 
351
-    if [ ! -d /var/www/${JITSI_DOMAIN_NAME} ]; then
352
-        mkdir -p /var/www/${JITSI_DOMAIN_NAME}
298
+    if [ ! -d /etc/prosody ]; then
299
+        echo $'xmpp must be installed before installing jitsi'
300
+        exit 62394
353 301
     fi
354
-    if [ ! -d /var/www/${JITSI_DOMAIN_NAME}/htdocs ]; then
355
-        function_check git_clone
356
-        git_clone ${JITSI_MEET_REPO} /var/www/${JITSI_DOMAIN_NAME}/htdocs
357
-        if [ ! -d /var/www/${JITSI_DOMAIN_NAME}/htdocs ]; then
358
-            echo $'Unable to clone jitsi meet repo'
359
-            exit 345673
360
-        fi
302
+
303
+    if [[ "${JITSI_DOMAIN_NAME}" == "${DEFAULT_DOMAIN_NAME}" ]]; then
304
+        echo $'The jitsi domain name should not be the same as the main domain name'
305
+        exit 78372
361 306
     fi
362 307
 
363
-    cd /var/www/${JITSI_DOMAIN_NAME}/htdocs
364
-    git checkout ${JITSI_MEET_COMMIT} -b ${JITSI_MEET_COMMIT}
365
-    set_completion_param "jitsi commit" "${JITSI_MEET_COMMIT}"
308
+    # add jitsi repo
309
+    apt-get -yq install wget debconf-utils
310
+    echo 'deb http://download.jitsi.org/nightly/deb unstable/' >> /etc/apt/sources.list
311
+    wget -qO - https://download.jitsi.org/nightly/deb/unstable/archive.key | apt-key add -
312
+    apt-get update
366 313
 
367
-    install_jitsi_xmpp
314
+    # create onion domains
315
+    create_jitsi_subdomains
368 316
 
369
-    chmod a+w /var/www/${JITSI_DOMAIN_NAME}/htdocs
317
+    # videobridge
318
+    debconf-set-selections <<< "jitsi-videobridge jitsi-videobridge/jvb-hostname string localhost"
319
+    apt-get -yq install jitsi-videobridge
320
+    if [ ! -d /etc/jitsi ]; then
321
+        echo $'Videobridge package failed to install'
322
+        exit 63983
323
+    fi
324
+    firewall_add videobridge ${VIDEOBRIDGE_PORT}
370 325
 
371
-    npm install -g browserify@13.1.1
372
-    npm install
373
-    make
326
+    # meet
327
+    debconf-set-selections <<< "jitsi-meet jitsi-meet/cert-choice multiselect 2"
328
+    apt-get -yq install jitsi-meet
374 329
 
375 330
     jitsi_nginx_site=/etc/nginx/sites-available/$JITSI_DOMAIN_NAME
376 331
     if [[ $ONION_ONLY == "no" ]]; then
@@ -394,7 +349,7 @@ function install_jitsi_meet {
394 349
         echo '  error_log off;' >> $jitsi_nginx_site
395 350
         echo '' >> $jitsi_nginx_site
396 351
         echo '  # Root' >> $jitsi_nginx_site
397
-        echo "  root /var/www/${JITSI_DOMAIN_NAME}/htdocs;" >> $jitsi_nginx_site
352
+        echo "  root /usr/share/jitsi-meet;" >> $jitsi_nginx_site
398 353
         echo '' >> $jitsi_nginx_site
399 354
         echo '  index index.html;' >> $jitsi_nginx_site
400 355
         echo '' >> $jitsi_nginx_site
@@ -432,7 +387,7 @@ function install_jitsi_meet {
432 387
     echo '  error_log off;' >> $jitsi_nginx_site
433 388
     echo '' >> $jitsi_nginx_site
434 389
     echo '  # Root' >> $jitsi_nginx_site
435
-    echo "  root /var/www/${JITSI_DOMAIN_NAME}/htdocs;" >> $jitsi_nginx_site
390
+    echo "  root /usr/share/jitsi-meet;" >> $jitsi_nginx_site
436 391
     echo '' >> $jitsi_nginx_site
437 392
     echo '  index index.html;' >> $jitsi_nginx_site
438 393
     echo '' >> $jitsi_nginx_site
@@ -458,12 +413,8 @@ function install_jitsi_meet {
458 413
     if [ -f /etc/ssl/certs/${JITSI_DOMAIN_NAME}.crt ]; then
459 414
         mv /etc/ssl/certs/${JITSI_DOMAIN_NAME}.crt /etc/ssl/certs/${JITSI_DOMAIN_NAME}.pem
460 415
     fi
461
-    if [ -f /etc/ssl/certs/${JITSI_DOMAIN_NAME}.pem ]; then
462
-        chown jitsi: /etc/ssl/certs/${JITSI_DOMAIN_NAME}.pem
463
-    fi
464
-    if [ -f /etc/ssl/private/${JITSI_DOMAIN_NAME}.key ]; then
465
-        chown jitsi: /etc/ssl/private/${JITSI_DOMAIN_NAME}.key
466
-    fi
416
+
417
+    # install_jitsi_xmpp
467 418
 
468 419
     function_check nginx_ensite
469 420
     nginx_ensite ${JITSI_DOMAIN_NAME}
@@ -472,43 +423,6 @@ function install_jitsi_meet {
472 423
 
473 424
     chown -R www-data:www-data /var/www/${JITSI_DOMAIN_NAME}/htdocs
474 425
     systemctl restart nginx
475
-}
476
-
477
-function install_jitsi {
478
-    if [[ "$(can_install_videobridge)" == "0" ]]; then
479
-        echo $'jitsi meet/videobridge can only be installed on i386 or amd64 architectures'
480
-        exit 83562
481
-    fi
482
-
483
-    if [ ! ${JITSI_DOMAIN_NAME} ]; then
484
-        echo $'No domain name was given for jitsi'
485
-        exit 47682
486
-    fi
487
-
488
-    if [ ! -d /etc/prosody ]; then
489
-        echo $'xmpp must be installed before installing jitsi'
490
-        exit 62394
491
-    fi
492
-
493
-    if [[ "${JITSI_DOMAIN_NAME}" == "${DEFAULT_DOMAIN_NAME}" ]]; then
494
-        echo $'The jitsi domain name should not be the same as the main domain name'
495
-        exit 78372
496
-    fi
497
-
498
-    if [ ! ${JITSI_VIDEOBRIDGE_SECRET} ]; then
499
-        JITSI_VIDEOBRIDGE_SECRET="$(create_password 30)"
500
-    fi
501
-    if [ ! ${JITSI_FOCUS_SECRET} ]; then
502
-        JITSI_FOCUS_SECRET="$(create_password 30)"
503
-    fi
504
-    if [ ! ${JITSI_CONFERENCE_SECRET} ]; then
505
-        JITSI_CONFERENCE_SECRET="$(create_password 30)"
506
-    fi
507
-
508
-    create_jitsi_subdomains
509
-    install_jitsi_videobridge
510
-    install_jitsi_jicofo
511
-    install_jitsi_meet
512 426
 
513 427
     function_check add_ddns_domain
514 428
     add_ddns_domain $JITSI_DOMAIN_NAME