Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/3scale/amp/component/backend_options.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,5 +143,5 @@ func DefaultSystemBackendUsername() string {
}

func DefaultSystemBackendPassword() string {
return oprand.String(8)
return oprand.GenerateRandomPasswordHash()
}
6 changes: 3 additions & 3 deletions pkg/3scale/amp/component/system_options.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ func DefaultRecaptchaPrivatekey() string {
}

func DefaultBackendSharedSecret() string {
return oprand.String(8)
return oprand.String(16)
}

func DefaultEventHooksURL() string {
Expand All @@ -163,15 +163,15 @@ func DefaultSystemMasterUsername() string {
}

func DefaultSystemMasterPassword() string {
return oprand.String(8)
return oprand.GenerateRandomPasswordHash()
}

func DefaultSystemAdminUsername() string {
return "admin"
}

func DefaultSystemAdminPassword() string {
return oprand.String(8)
return oprand.GenerateRandomPasswordHash()
}

func DefaultSystemAdminAccessToken() string {
Expand Down
13 changes: 13 additions & 0 deletions pkg/crypto/rand/rand.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,16 @@ func StringWithCharset(length int, charset string) string {

return string(result)
}

// GenerateRandomPasswordHash generates a hash of a random ASCII password
// 5char-5char-5char-5char
// Inspired from openshift/installer https://github.com/openshift/installer/blob/master/pkg/asset/password/password.go
func GenerateRandomPasswordHash() string {
password := StringWithCharset(23, alphanumericCharset)
pw := []rune(password)
for _, replace := range []int{5, 11, 17} {
pw[replace] = '-'
}

return string(pw)
}
Loading