Ver código fonte

debian: clean up password generation, use 16 characters

master
bgrozev 5 anos atrás
pai
commit
36113fd54f
Nenhuma conta vinculada ao e-mail do autor do commit
1 arquivos alterados com 6 adições e 3 exclusões
  1. 6
    3
      debian/jitsi-meet-prosody.postinst

+ 6
- 3
debian/jitsi-meet-prosody.postinst Ver arquivo

@@ -17,6 +17,9 @@ set -e
17 17
 # for details, see http://www.debian.org/doc/debian-policy/ or
18 18
 # the debian-policy package
19 19
 
20
+function generateRandomPassword() {
21
+    cat /dev/urandom | tr -dc 'a-zA-Z0-9' | head -c 16
22
+}
20 23
 
21 24
 case "$1" in
22 25
     configure)
@@ -51,7 +54,7 @@ case "$1" in
51 54
         db_get jicofo/jicofo-authpassword
52 55
         if [ -z "$RET" ] ; then
53 56
             # 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@@@@####'`
57
+            JICOFO_AUTH_PASSWORD=`generateRandomPassword`
55 58
             db_set jicofo/jicofo-authpassword "$JICOFO_AUTH_PASSWORD"
56 59
         else
57 60
             JICOFO_AUTH_PASSWORD="$RET"
@@ -60,7 +63,7 @@ case "$1" in
60 63
         db_get jicofo/jicofosecret
61 64
         if [ -z "$RET" ] ; then
62 65
             # 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@@@@####'`
66
+            JICOFO_SECRET=`generateRandomPassword`
64 67
             db_set jicofo/jicofosecret "$JICOFO_SECRET"
65 68
         else
66 69
             JICOFO_SECRET="$RET"
@@ -83,7 +86,7 @@ case "$1" in
83 86
         db_get jitsi-meet-prosody/turn-secret
84 87
         if [ -z "$RET" ] ; then
85 88
             # 8-chars random secret used for the turnserver
86
-            TURN_SECRET=`cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 8 | head -n 1`
89
+            TURN_SECRET=`generateRandomPassword`
87 90
             db_set jitsi-meet-prosody/turn-secret "$TURN_SECRET"
88 91
         else
89 92
             TURN_SECRET="$RET"

Carregando…
Cancelar
Salvar