From b461fbb1cbfeaf000a90d9984b1986a0c18e3e33 Mon Sep 17 00:00:00 2001 From: nemunaire Date: Sun, 21 Jan 2018 15:26:45 +0100 Subject: [PATCH] admin/pki: avoid some hard to read characters in password --- admin/pki/common.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/admin/pki/common.go b/admin/pki/common.go index df134a31..f8772c38 100644 --- a/admin/pki/common.go +++ b/admin/pki/common.go @@ -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 }