admin/pki: avoid some hard to read characters in password
This commit is contained in:
parent
469415b40a
commit
b461fbb1cb
@ -8,6 +8,7 @@ import (
|
|||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
"encoding/pem"
|
"encoding/pem"
|
||||||
"os"
|
"os"
|
||||||
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
var PKIDir string
|
var PKIDir string
|
||||||
@ -22,6 +23,17 @@ func GeneratePassword() (password string, err error) {
|
|||||||
|
|
||||||
password = base64.StdEncoding.EncodeToString(b)
|
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
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user