瀏覽代碼

debian: updates around coturn package and order of install (#5729)

* debian: Update coturn udp port to non-privileged one.

* debian: Turnserver config requires jitsi-meet-web-config files.

* doc: Updates doc, removing `--no-install-recommends`.

* debian: Moves checks and configs to default to prosody 0.11.

* debian: Disable room locking on internal muc.

* add scripts for deploying coturn with certbot

* turnserver: Removes unused variable showing error.

* debian: updates let's encrypt and coturn scripts.

* debian: Detect failure to retrieve external ip address.

* debian: Always configure turn when the turnserver package is installed.

Co-authored-by: Julien Fastré <julien.fastre@champs-libres.coop>
j8
Дамян Минков 5 年之前
父節點
當前提交
ffdd4f2eed
No account linked to committer's email address

+ 1
- 1
config.js 查看文件

@@ -342,7 +342,7 @@ var config = {
342 342
         // The STUN servers that will be used in the peer to peer connections
343 343
         stunServers: [
344 344
 
345
-            // { urls: 'stun:jitsi-meet.example.com:443' },
345
+            // { urls: 'stun:jitsi-meet.example.com:4446' },
346 346
             { urls: 'stun:meet-jit-si-turnrelay.jitsi.net:443' }
347 347
         ],
348 348
 

+ 1
- 0
debian/control 查看文件

@@ -53,5 +53,6 @@ Description: Prosody token authentication plugin for Jitsi Meet
53 53
 Package: jitsi-meet-turnserver
54 54
 Architecture: all
55 55
 Breaks: apache2
56
+Pre-Depends: jitsi-meet-web-config
56 57
 Depends: ${misc:Depends}, nginx (>= 1.13.10) | nginx-full (>= 1.13.10) | nginx-extras (>= 1.13.10), jitsi-meet-prosody, coturn, dnsutils
57 58
 Description: Configures coturn to be used with Jitsi Meet

+ 6
- 7
debian/jitsi-meet-prosody.postinst 查看文件

@@ -137,7 +137,7 @@ case "$1" in
137 137
         # as we are migrating configs
138 138
         if [ -f $PROSODY_HOST_CONFIG ] && ! grep -q "internal.auth.$JVB_HOSTNAME" $PROSODY_HOST_CONFIG; then
139 139
             echo -e "\nComponent \"internal.auth.$JVB_HOSTNAME\" \"muc\"" >> $PROSODY_HOST_CONFIG
140
-            echo -e "    storage = \"null\"" >> $PROSODY_HOST_CONFIG
140
+            echo -e "    storage = \"memory\"" >> $PROSODY_HOST_CONFIG
141 141
             echo -e "    modules_enabled = { \"ping\"; }" >> $PROSODY_HOST_CONFIG
142 142
             echo -e "    admins = { \"$JICOFO_AUTH_USER@auth.$JVB_HOSTNAME\", \"jvb@auth.$JVB_HOSTNAME\" }" >> $PROSODY_HOST_CONFIG
143 143
         fi
@@ -151,14 +151,13 @@ case "$1" in
151 151
             ln -sf /var/lib/prosody/$JVB_HOSTNAME.crt /etc/prosody/certs/$JVB_HOSTNAME.crt
152 152
         fi
153 153
 
154
-        PR11_INSTALL_CHECK="$(dpkg-query -f '${Status}' -W 'prosody-0.11' 2>/dev/null | awk '{print $3}' || true)"
154
+        PRTRUNK_INSTALL_CHECK="$(dpkg-query -f '${Status}' -W 'prosody-trunk' 2>/dev/null | awk '{print $3}' || true)"
155 155
         PR10_INSTALL_CHECK="$(dpkg-query -f '${Status}' -W 'prosody-0.10' 2>/dev/null | awk '{print $3}' || true)"
156 156
         PR_VER_INSTALLED=$(dpkg-query -f='${Version}\n' --show prosody  2>/dev/null || true)
157
-        if [ "$PR11_INSTALL_CHECK" = "installed" ] \
158
-            || [ "$PR11_INSTALL_CHECK" = "unpacked" ] \
159
-            || dpkg --compare-versions "$PR_VER_INSTALLED" gt "0.11" ; then
157
+        if [ "$PRTRUNK_INSTALL_CHECK" = "installed" ] \
158
+            || [ "$PRTRUNK_INSTALL_CHECK" = "unpacked" ] ; then
160 159
             if [ -f $PROSODY_HOST_CONFIG ]; then
161
-                sed -i 's/storage = \"null\"/storage = \"memory\"/g' $PROSODY_HOST_CONFIG
160
+                sed -i 's/storage = \"memory\"/storage = \"null\"/g' $PROSODY_HOST_CONFIG
162 161
 
163 162
                 # trigger a restart
164 163
                 PROSODY_CONFIG_PRESENT="false"
@@ -171,7 +170,7 @@ case "$1" in
171 170
             # if the version is 0.10.X (>0.10 and <0.11)
172 171
             if [ -f $PROSODY_HOST_CONFIG ] \
173 172
                 && dpkg --compare-versions "$PR_VER_INSTALLED" lt "0.11" ; then
174
-                sed -i 's/storage = \"null\"/storage = \"none\"/g' $PROSODY_HOST_CONFIG
173
+                sed -i 's/storage = \"memory\"/storage = \"none\"/g' $PROSODY_HOST_CONFIG
175 174
 
176 175
                 # trigger a restart
177 176
                 PROSODY_CONFIG_PRESENT="false"

+ 8
- 5
debian/jitsi-meet-tokens.postinst 查看文件

@@ -69,12 +69,15 @@ case "$1" in
69 69
                    echo "Failed to install basexx - try installing it manually"
70 70
                 fi
71 71
 
72
-                PR11_INSTALL_CHECK="$(dpkg-query -f '${Status}' -W 'prosody-0.11' 2>/dev/null | awk '{print $3}' || true)"
72
+                PR10_INSTALL_CHECK="$(dpkg-query -f '${Status}' -W 'prosody-0.10' 2>/dev/null | awk '{print $3}' || true)"
73
+                PRTRUNK_INSTALL_CHECK="$(dpkg-query -f '${Status}' -W 'prosody-trunk' 2>/dev/null | awk '{print $3}' || true)"
73 74
                 PR_VER_INSTALLED=$(dpkg-query -f='${Version}\n' --show prosody  2>/dev/null || true)
74
-                if [ "$PR11_INSTALL_CHECK" = "installed" ] \
75
-                    || [ "$PR11_INSTALL_CHECK" = "unpacked" ] \
76
-                    || dpkg --compare-versions "$PR_VER_INSTALLED" gt "0.11" ; then
77
-                    sed -i 's/module:hook/module:hook_global/g' /usr/share/jitsi-meet/prosody-plugins/mod_auth_token.lua
75
+                if [ "$PR10_INSTALL_CHECK" = "installed" ] \
76
+                    || "$PR10_INSTALL_CHECK" = "unpacked"  \
77
+                    || "$PRTRUNK_INSTALL_CHECK" = "installed"  \
78
+                    || "$PRTRUNK_INSTALL_CHECK" = "unpacked"  \
79
+                    || dpkg --compare-versions "$PR_VER_INSTALLED" lt "0.11" ; then
80
+                    sed -i 's/module:hook_global(/module:hook(/g' /usr/share/jitsi-meet/prosody-plugins/mod_auth_token.lua
78 81
                 fi
79 82
 
80 83
                 if [ -x "/etc/init.d/prosody" ]; then

+ 3
- 2
debian/jitsi-meet-turnserver.install 查看文件

@@ -1,2 +1,3 @@
1
-doc/debian/jitsi-meet-turn/turnserver.conf  /usr/share/jitsi-meet-turnserver/
2
-doc/debian/jitsi-meet/jitsi-meet.conf       /usr/share/jitsi-meet-turnserver/
1
+doc/debian/jitsi-meet-turn/turnserver.conf          /usr/share/jitsi-meet-turnserver/
2
+doc/debian/jitsi-meet/jitsi-meet.conf               /usr/share/jitsi-meet-turnserver/
3
+doc/debian/jitsi-meet-turn/coturn-certbot-deploy.sh /usr/share/jitsi-meet-turnserver/

+ 22
- 14
debian/jitsi-meet-turnserver.postinst 查看文件

@@ -38,6 +38,7 @@ case "$1" in
38 38
 
39 39
         NGINX_SITES_ENABLED="/etc/nginx/sites-enabled/"
40 40
         NGINX_CONFIG_ENABLED="${NGINX_SITES_ENABLED}${JVB_HOSTNAME}.conf"
41
+        NGINX_MULTIPLEXING="true"
41 42
         for site in ${NGINX_SITES_ENABLED}*; do
42 43
             # if it is not a file continue
43 44
             [ -f "${site}" ] || continue
@@ -48,11 +49,10 @@ case "$1" in
48 49
                 # nothing to do
49 50
                 echo "------------------------------------------------"
50 51
                 echo ""
51
-                echo "turnserver not configured as other nginx sites use port 443"
52
+                echo "turnserver is listening on tcp 4445 as other nginx sites use port 443"
52 53
                 echo ""
53 54
                 echo "------------------------------------------------"
54
-                db_stop
55
-                exit 0
55
+                NGINX_MULTIPLEXING="false"
56 56
             fi
57 57
         done
58 58
 
@@ -77,7 +77,7 @@ case "$1" in
77 77
             # nothing to do
78 78
             echo "------------------------------------------------"
79 79
             echo ""
80
-            echo "turnserver not configured as no nginx found to multiplex traffic"
80
+            echo "turnserver not configured"
81 81
             echo ""
82 82
             echo "------------------------------------------------"
83 83
             db_stop
@@ -106,18 +106,19 @@ case "$1" in
106 106
         TURN_SECRET="$RET"
107 107
 
108 108
         # no turn config exists, lt's copy template and fill it in
109
-        PUBLIC_IP=$(dig +short myip.opendns.com @resolver1.opendns.com)
109
+        PUBLIC_IP=$(dig +short myip.opendns.com @resolver1.opendns.com) || true
110
+        if [ -z "$PUBLIC_IP" ] ; then
111
+            PUBLIC_IP="127.0.0.1"
112
+            echo "------------------------------------------------"
113
+            echo "Warning! Could not resolve your external ip address! Error:^"
114
+            echo "Your turn server will not work till you edit your $TURN_CONFIG config file."
115
+            echo "You need to set your external ip address in external-ip and restart coturn service."
116
+            echo "------------------------------------------------"
117
+        fi
110 118
         cp /usr/share/jitsi-meet-turnserver/turnserver.conf $TURN_CONFIG
111 119
         sed -i "s/jitsi-meet.example.com/$JVB_HOSTNAME/g" $TURN_CONFIG
112 120
         sed -i "s/__turnSecret__/$TURN_SECRET/g" $TURN_CONFIG
113
-        sed -i "s/__external_ip_address__/$JVB_HOSTNAME/g" $TURN_CONFIG
114
-
115
-        # Hack Debian Buster coturn to be able to bind privileged port 443
116
-        COTURN_UNIT_FILE="/lib/systemd/system/coturn.service"
117
-        if [[ -f $COTURN_UNIT_FILE ]] && ! grep -q "CAP_NET_BIND_SERVICE" "$COTURN_UNIT_FILE" ; then
118
-            sed -i "s/\[Service\]/\[Service\]\nAmbientCapabilities=CAP_NET_BIND_SERVICE/g" $COTURN_UNIT_FILE
119
-            systemctl daemon-reload
120
-        fi
121
+        sed -i "s/__external_ip_address__/$PUBLIC_IP/g" $TURN_CONFIG
121 122
 
122 123
         # SSL for nginx
123 124
         db_get jitsi-meet/cert-choice
@@ -142,11 +143,18 @@ case "$1" in
142 143
         invoke-rc.d coturn restart || true
143 144
 
144 145
         NGINX_STREAM_CONFIG="/etc/nginx/modules-enabled/60-jitsi-meet.conf"
145
-        if [ ! -f $NGINX_STREAM_CONFIG ] && [ -f $NGINX_CONFIG ] ; then
146
+        if [ $NGINX_MULTIPLEXING = "true" ] && [ ! -f $NGINX_STREAM_CONFIG ] && [ -f $NGINX_CONFIG ] ; then
146 147
             ln -s /usr/share/jitsi-meet-turnserver/jitsi-meet.conf $NGINX_STREAM_CONFIG
147 148
             sed -i "s/listen 443 ssl/listen 4444 ssl http2/g" $NGINX_CONFIG
148 149
             sed -i "s/listen \[\:\:\]\:443 ssl/listen \[\:\:\]\:4444 ssl http2/g" $NGINX_CONFIG
149 150
             invoke-rc.d nginx reload || true
151
+        else
152
+            PROSODY_HOST_CONFIG="/etc/prosody/conf.avail/$JVB_HOSTNAME.cfg.lua"
153
+            if [ -f $PROSODY_HOST_CONFIG ] ; then
154
+                # If we are not multiplexing we need to change the port in prosody config
155
+                sed -i 's/"443"/"4445"/g' $PROSODY_HOST_CONFIG
156
+                invoke-rc.d prosody restart || true
157
+            fi
150 158
         fi
151 159
 
152 160
         # Enable turn server in config.js

+ 6
- 4
doc/debian/jitsi-meet-prosody/prosody.cfg.lua-jvb.example 查看文件

@@ -6,8 +6,8 @@ muc_mapper_domain_base = "jitmeet.example.com";
6 6
 turncredentials_secret = "__turnSecret__";
7 7
 
8 8
 turncredentials = {
9
-  { type = "stun", host = "jitmeet.example.com", port = "443" },
10
-  { type = "turn", host = "jitmeet.example.com", port = "443", transport = "udp" },
9
+  { type = "stun", host = "jitmeet.example.com", port = "4446" },
10
+  { type = "turn", host = "jitmeet.example.com", port = "4446", transport = "udp" },
11 11
   { type = "turns", host = "jitmeet.example.com", port = "443", transport = "tcp" }
12 12
 };
13 13
 
@@ -43,7 +43,7 @@ VirtualHost "jitmeet.example.com"
43 43
         c2s_require_encryption = false
44 44
 
45 45
 Component "conference.jitmeet.example.com" "muc"
46
-    storage = "null"
46
+    storage = "memory"
47 47
     modules_enabled = {
48 48
         "muc_meeting_id";
49 49
         "muc_domain_mapper";
@@ -55,11 +55,13 @@ Component "conference.jitmeet.example.com" "muc"
55 55
 
56 56
 -- internal muc component
57 57
 Component "internal.auth.jitmeet.example.com" "muc"
58
-    storage = "null"
58
+    storage = "memory"
59 59
     modules_enabled = {
60 60
       "ping";
61 61
     }
62 62
     admins = { "focusUser@auth.jitmeet.example.com", "jvb@auth.jitmeet.example.com" }
63
+    muc_room_locking = false
64
+    muc_room_default_public_jids = true
63 65
 
64 66
 VirtualHost "auth.jitmeet.example.com"
65 67
     authentication = "internal_plain"

+ 45
- 0
doc/debian/jitsi-meet-turn/coturn-certbot-deploy.sh 查看文件

@@ -0,0 +1,45 @@
1
+#!/bin/sh
2
+
3
+set -e
4
+
5
+COTURN_CERT_DIR="/etc/coturn/certs"
6
+TURN_CONFIG="/etc/turnserver.conf"
7
+
8
+# create a directory to store certs if it does not exists
9
+if [ ! -d "$COTURN_CERT_DIR" ]; then
10
+    mkdir -p $COTURN_CERT_DIR
11
+    chown -R turnserver:turnserver /etc/coturn/
12
+    chmod -R 700 /etc/coturn/
13
+fi
14
+
15
+# This is a template and when copied to /etc/letsencrypt/renewal-hooks/deploy/
16
+# during creating the Let's encrypt certs script
17
+# jitsi-meet.example.com will be replaced with the real domain of deployment
18
+for domain in $RENEWED_DOMAINS; do
19
+        case $domain in
20
+        jitsi-meet.example.com)
21
+                # Make sure the certificate and private key files are
22
+                # never world readable, even just for an instant while
23
+                # we're copying them into daemon_cert_root.
24
+                umask 077
25
+
26
+                cp "$RENEWED_LINEAGE/fullchain.pem" "$COTURN_CERT_DIR/$domain.fullchain.pem"
27
+                cp "$RENEWED_LINEAGE/privkey.pem" "$COTURN_CERT_DIR/$domain.privkey.pem"
28
+
29
+                # Apply the proper file ownership and permissions for
30
+                # the daemon to read its certificate and key.
31
+                chown turnserver "$COTURN_CERT_DIR/$domain.fullchain.pem" \
32
+                        "$COTURN_CERT_DIR/$domain.privkey.pem"
33
+                chmod 400 "$COTURN_CERT_DIR/$domain.fullchain.pem" \
34
+                        "$COTURN_CERT_DIR/$domain.privkey.pem"
35
+
36
+                if [ -f $TURN_CONFIG ] && grep -q "jitsi-meet coturn config" "$TURN_CONFIG" ; then
37
+                    echo "Configuring turnserver"
38
+                    sed -i "/^cert/c\cert=\/etc\/coturn\/certs\/${domain}.fullchain.pem" $TURN_CONFIG
39
+                    sed -i "/^pkey/c\pkey=\/etc\/coturn\/certs\/${domain}.privkey.pem" $TURN_CONFIG
40
+                fi
41
+                service coturn restart
42
+                ;;
43
+        esac
44
+done
45
+

+ 1
- 2
doc/debian/jitsi-meet-turn/turnserver.conf 查看文件

@@ -1,5 +1,4 @@
1 1
 # jitsi-meet coturn config. Do not modify this line
2
-lt-cred-mech
3 2
 use-auth-secret
4 3
 keep-address-family
5 4
 static-auth-secret=__turnSecret__
@@ -8,7 +7,7 @@ cert=/etc/jitsi/meet/jitsi-meet.example.com.crt
8 7
 pkey=/etc/jitsi/meet/jitsi-meet.example.com.key
9 8
 
10 9
 no-tcp
11
-listening-port=443
10
+listening-port=4446
12 11
 tls-listening-port=4445
13 12
 external-ip=__external_ip_address__
14 13
 

+ 1
- 1
doc/quick-install.md 查看文件

@@ -29,7 +29,7 @@ wget -qO -  https://download.jitsi.org/jitsi-key.gpg.key | sudo apt-key add -
29 29
 ### Install Jitsi Meet
30 30
 
31 31
 _Note_: The installer will check if [Nginx](https://nginx.org/) or [Apache](https://httpd.apache.org/) is present (in that order) and configure a virtualhost within the web server it finds to serve Jitsi Meet. If none of the above is found it then defaults to Nginx.
32
-If you are already running Nginx on port 443 on the same machine you better skip the turnserver configuration as it will conflict with your current port 443, so use the command `apt install --no-install-recommends jitsi-meet`.
32
+If you are already running Nginx on port 443 on the same machine turnserver configuration will be skipped as it will conflict with your current port 443.
33 33
 
34 34
 ```sh
35 35
 # Ensure support is available for apt repositories served via HTTPS

+ 14
- 32
resources/install-letsencrypt-cert.sh 查看文件

@@ -14,6 +14,8 @@ echo "- Download certbot-auto from https://dl.eff.org to /usr/local/sbin"
14 14
 echo "- Install additional dependencies in order to request Let’s Encrypt certificate"
15 15
 echo "- If running with jetty serving web content, will stop Jitsi Videobridge"
16 16
 echo "- Configure and reload nginx or apache2, whichever is used"
17
+echo "- Configure the coturn server to use Let's Encrypt certificate and add required deploy hooks"
18
+echo "- Add command in weekly cron job to renew certificates regularly"
17 19
 echo ""
18 20
 echo "You need to agree to the ACME server's Subscriber Agreement (https://letsencrypt.org/documents/LE-SA-v1.1.1-August-1-2016.pdf) "
19 21
 echo "by providing an email address for important account notifications"
@@ -40,10 +42,21 @@ CERT_CRT="/etc/letsencrypt/live/$DOMAIN/fullchain.pem"
40 42
 
41 43
 if [ -f /etc/nginx/sites-enabled/$DOMAIN.conf ] ; then
42 44
 
45
+    TURN_CONFIG="/etc/turnserver.conf"
46
+    TURN_HOOK=/etc/letsencrypt/renewal-hooks/deploy/0000-coturn-certbot-deploy.sh
47
+    if [ -f $TURN_CONFIG ] && grep -q "jitsi-meet coturn config" "$TURN_CONFIG" ; then
48
+        mkdir -p $(dirname $TURN_HOOK)
49
+
50
+        cp /usr/share/jitsi-meet-turnserver/coturn-certbot-deploy.sh $TURN_HOOK
51
+        chmod u+x $TURN_HOOK
52
+        sed -i "s/jitsi-meet.example.com/$DOMAIN/g" $TURN_HOOK
53
+    fi
54
+
43 55
     ./certbot-auto certonly --noninteractive \
44 56
     --webroot --webroot-path /usr/share/jitsi-meet \
45 57
     -d $DOMAIN \
46
-    --agree-tos --email $EMAIL
58
+    --agree-tos --email $EMAIL \
59
+    --deploy-hook $TURN_HOOK
47 60
 
48 61
     echo "Configuring nginx"
49 62
 
@@ -59,16 +72,6 @@ if [ -f /etc/nginx/sites-enabled/$DOMAIN.conf ] ; then
59 72
 
60 73
     echo "service nginx reload" >> $CRON_FILE
61 74
     service nginx reload
62
-
63
-    TURN_CONFIG="/etc/turnserver.conf"
64
-    if [ -f $TURN_CONFIG ] && grep -q "jitsi-meet coturn config" "$TURN_CONFIG" ; then
65
-        echo "Configuring turnserver"
66
-        sed -i "s/cert=\/etc\/jitsi\/meet\/.*crt/cert=$CERT_CRT_ESC/g" $TURN_CONFIG
67
-        sed -i "s/pkey=\/etc\/jitsi\/meet\/.*key/pkey=$CERT_KEY_ESC/g" $TURN_CONFIG
68
-
69
-        echo "service coturn restart" >> $CRON_FILE
70
-        service coturn restart
71
-    fi
72 75
 elif [ -f /etc/apache2/sites-enabled/$DOMAIN.conf ] ; then
73 76
 
74 77
     ./certbot-auto certonly --noninteractive \
@@ -90,27 +93,6 @@ elif [ -f /etc/apache2/sites-enabled/$DOMAIN.conf ] ; then
90 93
 
91 94
     echo "service apache2 reload" >> $CRON_FILE
92 95
     service apache2 reload
93
-else
94
-    service jitsi-videobridge stop
95
-
96
-    ./certbot-auto certonly --noninteractive \
97
-    --standalone \
98
-    -d $DOMAIN \
99
-    --agree-tos --email $EMAIL
100
-
101
-    echo "Configuring jetty"
102
-
103
-    CERT_P12="/etc/jitsi/videobridge/$DOMAIN.p12"
104
-    CERT_JKS="/etc/jitsi/videobridge/$DOMAIN.jks"
105
-    # create jks from  certs
106
-    openssl pkcs12 -export \
107
-        -in $CERT_CRT -inkey $CERT_KEY -passout pass:changeit > $CERT_P12
108
-    keytool -importkeystore -destkeystore $CERT_JKS \
109
-        -srckeystore $CERT_P12 -srcstoretype pkcs12 \
110
-        -noprompt -storepass changeit -srcstorepass changeit
111
-
112
-    service jitsi-videobridge start
113
-
114 96
 fi
115 97
 
116 98
 # the cron file that will renew certificates

+ 2
- 2
resources/prosody-plugins/mod_auth_token.lua 查看文件

@@ -37,8 +37,8 @@ function init_session(event)
37 37
     end
38 38
 end
39 39
 
40
-module:hook("bosh-session", init_session);
41
-module:hook("websocket-session", init_session);
40
+module:hook_global("bosh-session", init_session);
41
+module:hook_global("websocket-session", init_session);
42 42
 
43 43
 function provider.test_password(username, password)
44 44
 	return nil, "Password based auth not supported";

Loading…
取消
儲存