Browse Source

jitsi app

Bob Mottram 8 years ago
parent
commit
d31474df79
4 changed files with 547 additions and 1 deletions
  1. 3
    0
      src/freedombone-app-etherpad
  2. 529
    0
      src/freedombone-app-jitsi
  3. 2
    1
      src/freedombone-upgrade
  4. 13
    0
      src/freedombone-utils-web

+ 3
- 0
src/freedombone-app-etherpad View File

@@ -491,6 +491,9 @@ function install_etherpad {
491 491
     echo 'Group=etherpad' >> /etc/systemd/system/etherpad.service
492 492
     echo "WorkingDirectory=/var/www/$ETHERPAD_DOMAIN_NAME/htdocs" >> /etc/systemd/system/etherpad.service
493 493
     echo "ExecStart=/var/www/$ETHERPAD_DOMAIN_NAME/htdocs/bin/run.sh" >> /etc/systemd/system/etherpad.service
494
+    echo 'Restart=on-failure' >> /etc/systemd/system/etherpad.service
495
+    echo 'SuccessExitStatus=3 4' >> /etc/systemd/system/etherpad.service
496
+    echo 'RestartForceExitStatus=3 4' >> /etc/systemd/system/etherpad.service
494 497
     echo '' >> /etc/systemd/system/etherpad.service
495 498
     echo '[Install]' >> /etc/systemd/system/etherpad.service
496 499
     echo 'WantedBy=multi-user.target' >> /etc/systemd/system/etherpad.service

+ 529
- 0
src/freedombone-app-jitsi View File

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

+ 2
- 1
src/freedombone-upgrade View File

@@ -55,7 +55,8 @@ read_repo_servers
55 55
 ${PROJECT_NAME}-mirrors
56 56
 
57 57
 if [ ! -d $PROJECT_DIR ]; then
58
-    git_clone $PROJECT_REPO $PROJECT_DIR
58
+    # TODO after stockholm merge change this to git_clone
59
+    git clone $PROJECT_REPO $PROJECT_DIR
59 60
 fi
60 61
 
61 62
 if [ -d $PROJECT_DIR ]; then

+ 13
- 0
src/freedombone-utils-web View File

@@ -654,6 +654,19 @@ function update_default_domain {
654 654
     echo $'Updating default domain'
655 655
     if [[ $ONION_ONLY == 'no' ]]; then
656 656
         if [ -d /etc/prosody ]; then
657
+            read_config_param "JITSI_DOMAIN_NAME"
658
+            if [ ${#JITSI_DOMAIN_NAME} -gt 0 ]; then
659
+                if [ -f /etc/ssl/private/${JITSI_DOMAIN_NAME}.key ]; then
660
+                    cp /etc/ssl/private/${JITSI_DOMAIN_NAME}.key /etc/prosody/certs/${JITSI_DOMAIN_NAME}.key
661
+                fi
662
+                if [ -f /etc/ssl/certs/${JITSI_DOMAIN_NAME}.crt ]; then
663
+                    cp /etc/ssl/certs/${JITSI_DOMAIN_NAME}.crt /etc/prosody/certs/${JITSI_DOMAIN_NAME}.pem
664
+                fi
665
+                if [ -f /etc/ssl/certs/${JITSI_DOMAIN_NAME}.pem ]; then
666
+                    cp /etc/ssl/certs/${JITSI_DOMAIN_NAME}.pem /etc/prosody/certs/${JITSI_DOMAIN_NAME}.pem
667
+                fi
668
+            fi
669
+
657 670
             if [ ! -d /etc/prosody/certs ]; then
658 671
                 mkdir /etc/prosody/certs
659 672
             fi