Browse Source

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 years ago
parent
commit
2ee8f1ef58
2 changed files with 22 additions and 7 deletions
  1. 14
    7
      debian/jitsi-meet-prosody.postinst
  2. 8
    0
      debian/jitsi-meet-prosody.postrm

+ 14
- 7
debian/jitsi-meet-prosody.postinst View File

50
 
50
 
51
         db_get jicofo/jicofo-authpassword
51
         db_get jicofo/jicofo-authpassword
52
         if [ -z "$RET" ] ; then
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
         fi
58
         fi
56
-        JICOFO_AUTH_PASSWORD="$RET"
57
 
59
 
58
         db_get jicofo/jicofosecret
60
         db_get jicofo/jicofosecret
59
         if [ -z "$RET" ] ; then
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
         fi
67
         fi
63
-        JICOFO_SECRET="$RET"
64
 
68
 
65
         JICOFO_AUTH_DOMAIN="auth.$JVB_HOSTNAME"
69
         JICOFO_AUTH_DOMAIN="auth.$JVB_HOSTNAME"
66
 
70
 
88
         if [ ! -f $PROSODY_HOST_CONFIG ] && ! grep -q "VirtualHost \"$JVB_HOSTNAME\"" $PROSODY_CONFIG_OLD; then
92
         if [ ! -f $PROSODY_HOST_CONFIG ] && ! grep -q "VirtualHost \"$JVB_HOSTNAME\"" $PROSODY_CONFIG_OLD; then
89
             PROSODY_CONFIG_PRESENT="false"
93
             PROSODY_CONFIG_PRESENT="false"
90
             mkdir -p /etc/prosody/conf.avail/
94
             mkdir -p /etc/prosody/conf.avail/
95
+            mkdir -p /etc/prosody/conf.d/
91
             cp /usr/share/doc/jitsi-meet-prosody/prosody.cfg.lua-jvb.example $PROSODY_HOST_CONFIG
96
             cp /usr/share/doc/jitsi-meet-prosody/prosody.cfg.lua-jvb.example $PROSODY_HOST_CONFIG
92
             sed -i "s/jitmeet.example.com/$JVB_HOSTNAME/g" $PROSODY_HOST_CONFIG
97
             sed -i "s/jitmeet.example.com/$JVB_HOSTNAME/g" $PROSODY_HOST_CONFIG
93
             sed -i "s/jitmeetSecret/$JVB_SECRET/g" $PROSODY_HOST_CONFIG
98
             sed -i "s/jitmeetSecret/$JVB_SECRET/g" $PROSODY_HOST_CONFIG
132
             ln -sf /var/lib/prosody/$JICOFO_AUTH_DOMAIN.crt $AUTH_CRT_FILE
137
             ln -sf /var/lib/prosody/$JICOFO_AUTH_DOMAIN.crt $AUTH_CRT_FILE
133
             ln -sf /var/lib/prosody/$JICOFO_AUTH_DOMAIN.crt /usr/local/share/ca-certificates/$JICOFO_AUTH_DOMAIN.crt
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
             # don't fail on systems with custom config ($PROSODY_HOST_CONFIG is missing)
144
             # don't fail on systems with custom config ($PROSODY_HOST_CONFIG is missing)
138
             if [ -f $PROSODY_HOST_CONFIG ]; then
145
             if [ -f $PROSODY_HOST_CONFIG ]; then

+ 8
- 0
debian/jitsi-meet-prosody.postrm View File

35
         if [ -n "$RET" ]; then
35
         if [ -n "$RET" ]; then
36
             rm -f /etc/prosody/conf.avail/$JVB_HOSTNAME.cfg.lua
36
             rm -f /etc/prosody/conf.avail/$JVB_HOSTNAME.cfg.lua
37
             rm -f /etc/prosody/conf.d/$JVB_HOSTNAME.cfg.lua
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
         fi
46
         fi
39
 
47
 
40
         # Clear the debconf variable
48
         # Clear the debconf variable

Loading…
Cancel
Save