Просмотр исходного кода

Fixed an issue which cause wrong password generation
Fixes #1184

Raphael Schneeberger 5 лет назад
Родитель
Сommit
75e2c2750f

+ 1 - 0
CHANGELOG.md

@@ -43,6 +43,7 @@ All notable changes to this project will be documented in this file.
 - Changed WordPress name in Webapp installer (#1074)
 - Add a free disk space validation during backup routine (#1115)
 - Removed PHP validation SSH keys allowing support other types then RSA / DSA
+- Fixed an issue which cause wrong password generation (#1184)
 
 
 ## [1.2.3] - Service Release

+ 1 - 2
bin/v-generate-api-key

@@ -9,8 +9,7 @@
 #                    Variable&Function                     #
 #----------------------------------------------------------#
 
-keygen()
-{
+keygen() {
     < /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c${1:-32};echo;
 }
 KEYS="$HESTIA/data/keys/"

+ 2 - 2
func/main.sh

@@ -186,12 +186,12 @@ generate_password() {
     matrix=$1
     length=$2
     if [ -z "$matrix" ]; then
-        matrix=[:alnum:]
+        matrix="A-Za-z0-9"
     fi
     if [ -z "$length" ]; then
         length=10
     fi
-    cat /dev/urandom | tr -dc $matrix | head -c$length
+    head /dev/urandom | tr -dc $matrix | head -c$length
 }
 
 # Package existence check

+ 1 - 1
install/hst-install-debian.sh

@@ -107,7 +107,7 @@ download_file() {
 
 # Defining password-gen function
 gen_pass() {
-    cat /dev/urandom | tr -dc [:alnum:] | head -c16
+    head /dev/urandom | tr -dc A-Za-z0-9 | head -c 16
 }
 
 # Defining return code check function

+ 1 - 1
install/hst-install-ubuntu.sh

@@ -89,7 +89,7 @@ download_file() {
 
 # Defining password-gen function
 gen_pass() {
-    cat /dev/urandom | tr -dc [:alnum:] | head -c16
+    head /dev/urandom | tr -dc A-Za-z0-9 | head -c 16
 }
 
 # Defining return code check function

+ 1 - 1
test/test.bats

@@ -6,7 +6,7 @@ load 'test_helper/bats-file/load'
 
 
 function random() {
-    cat /dev/urandom | tr -dc [:digit:] | head -c$1
+    head /dev/urandom | tr -dc A-Za-z0-9 | head -c$1
 }
 
 function setup() {

+ 1 - 1
test/test_actions.sh

@@ -7,7 +7,7 @@ V_TEST="$HESTIA/test"
 
 # Define functions
 random() {
-    cat /dev/urandom | tr -dc [:digit:] | head -c$1
+    head /dev/urandom | tr -dc A-Za-z0-9 | head -c$1
 }
 
 echo_result() {