admin/pki: avoid some hard to read characters in password

This commit is contained in:
nemunaire 2018-01-21 15:26:45 +01:00
parent 469415b40a
commit b461fbb1cb

View File

@ -8,6 +8,7 @@ import (
"encoding/base64"
"encoding/pem"
"os"
"strings"
)
var PKIDir string
@ -22,6 +23,17 @@ func GeneratePassword() (password string, err error) {
password = base64.StdEncoding.EncodeToString(b)
// Avoid hard to read characters
for _, i := range [][2]string{
{"v", "*"}, {"u", "("},
{"l", "%"}, {"1", "?"},
{"o", "@"}, {"O", "!"}, {"0", ">"},
// This one is to avoid problem with openssl
{"/", "^"},
} {
password = strings.Replace(password, i[0], i[1], -1)
}
return
}