浏览代码

Updates postinst prosody (#2896)

* Creates conf.d in /etc/prosody if missing.

Fixes a problem installing prosody 0.10 when using prosody repositories.

* Cleanups certificates on purge.

There are various occasions where users purge packages and the new installations after that generate certificate which doesn't end up in the java trust store on the target machine.

* Generate jicofo user and component passwords if missing.

There are situations where if prosody is already installed, the order of configuring the packages is not in the correct order. In those situations jitsi-meet-prosody got configured before jicofo and the user password and the component secret are not available and we ask the user for that and later when jicofo is configured we generate new set of them. Now we will end up always generating them in jitsi-meet-prosody or jicofo and we will reuse them. See https://github.com/jitsi/jicofo/pull/283.
master
Дамян Минков 7 年前
父节点
当前提交
2ee8f1ef58
共有 2 个文件被更改,包括 22 次插入7 次删除
  1. 14
    7
      debian/jitsi-meet-prosody.postinst
  2. 8
    0
      debian/jitsi-meet-prosody.postrm

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

@@ -50,17 +50,21 @@ case "$1" in
50 50
 
51 51
         db_get jicofo/jicofo-authpassword
52 52
         if [ -z "$RET" ] ; then
53
-            db_input critical jicofo/jicofo-authpassword || true
54
-            db_go
53
+            # if password is missing generate it, and store it
54
+            JICOFO_AUTH_PASSWORD=`head -c 8 /dev/urandom | tr '\0-\377' 'a-zA-Z0-9a-zA-Z0-9a-zA-Z0-9a-zA-Z0-9@@@@####'`
55
+            db_set jicofo/jicofo-authpassword "$JICOFO_AUTH_PASSWORD"
56
+        else
57
+            JICOFO_AUTH_PASSWORD="$RET"
55 58
         fi
56
-        JICOFO_AUTH_PASSWORD="$RET"
57 59
 
58 60
         db_get jicofo/jicofosecret
59 61
         if [ -z "$RET" ] ; then
60
-            db_input critical jicofo/jicofosecret || true
61
-            db_go
62
+            # if secret is missing generate it, and store it
63
+            JICOFO_SECRET=`head -c 8 /dev/urandom | tr '\0-\377' 'a-zA-Z0-9a-zA-Z0-9a-zA-Z0-9a-zA-Z0-9@@@@####'`
64
+            db_set jicofo/jicofosecret "$JICOFO_SECRET"
65
+        else
66
+            JICOFO_SECRET="$RET"
62 67
         fi
63
-        JICOFO_SECRET="$RET"
64 68
 
65 69
         JICOFO_AUTH_DOMAIN="auth.$JVB_HOSTNAME"
66 70
 
@@ -88,6 +92,7 @@ case "$1" in
88 92
         if [ ! -f $PROSODY_HOST_CONFIG ] && ! grep -q "VirtualHost \"$JVB_HOSTNAME\"" $PROSODY_CONFIG_OLD; then
89 93
             PROSODY_CONFIG_PRESENT="false"
90 94
             mkdir -p /etc/prosody/conf.avail/
95
+            mkdir -p /etc/prosody/conf.d/
91 96
             cp /usr/share/doc/jitsi-meet-prosody/prosody.cfg.lua-jvb.example $PROSODY_HOST_CONFIG
92 97
             sed -i "s/jitmeet.example.com/$JVB_HOSTNAME/g" $PROSODY_HOST_CONFIG
93 98
             sed -i "s/jitmeetSecret/$JVB_SECRET/g" $PROSODY_HOST_CONFIG
@@ -132,7 +137,9 @@ case "$1" in
132 137
             ln -sf /var/lib/prosody/$JICOFO_AUTH_DOMAIN.crt $AUTH_CRT_FILE
133 138
             ln -sf /var/lib/prosody/$JICOFO_AUTH_DOMAIN.crt /usr/local/share/ca-certificates/$JICOFO_AUTH_DOMAIN.crt
134 139
 
135
-            update-ca-certificates
140
+            # we need to force updating certificates, in some cases java trust
141
+            # store not get re-generated with latest changes
142
+            update-ca-certificates -f
136 143
 
137 144
             # don't fail on systems with custom config ($PROSODY_HOST_CONFIG is missing)
138 145
             if [ -f $PROSODY_HOST_CONFIG ]; then

+ 8
- 0
debian/jitsi-meet-prosody.postrm 查看文件

@@ -35,6 +35,14 @@ case "$1" in
35 35
         if [ -n "$RET" ]; then
36 36
             rm -f /etc/prosody/conf.avail/$JVB_HOSTNAME.cfg.lua
37 37
             rm -f /etc/prosody/conf.d/$JVB_HOSTNAME.cfg.lua
38
+
39
+            # clean up generated certificates
40
+            rm -f /etc/prosody/certs/$JVB_HOSTNAME.crt
41
+            rm -f /etc/prosody/certs/$JVB_HOSTNAME.key
42
+            rm -f /etc/prosody/certs/auth.$JVB_HOSTNAME.crt
43
+            rm -f /etc/prosody/certs/auth.$JVB_HOSTNAME.key
44
+            rm -rf /var/lib/prosody/auth.$JVB_HOSTNAME.*
45
+            rm -rf /var/lib/prosody/$JVB_HOSTNAME.*
38 46
         fi
39 47
 
40 48
         # Clear the debconf variable

正在加载...
取消
保存