Skip to content

Commit bdb184e

Browse files
committed
Increase default password to 23 characters
1 parent 5201978 commit bdb184e

3 files changed

Lines changed: 17 additions & 4 deletions

File tree

pkg/3scale/amp/component/backend_options.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,5 +143,5 @@ func DefaultSystemBackendUsername() string {
143143
}
144144

145145
func DefaultSystemBackendPassword() string {
146-
return oprand.String(8)
146+
return oprand.GenerateRandomPasswordHash()
147147
}

pkg/3scale/amp/component/system_options.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ func DefaultRecaptchaPrivatekey() string {
137137
}
138138

139139
func DefaultBackendSharedSecret() string {
140-
return oprand.String(8)
140+
return oprand.String(16)
141141
}
142142

143143
func DefaultEventHooksURL() string {
@@ -163,15 +163,15 @@ func DefaultSystemMasterUsername() string {
163163
}
164164

165165
func DefaultSystemMasterPassword() string {
166-
return oprand.String(8)
166+
return oprand.GenerateRandomPasswordHash()
167167
}
168168

169169
func DefaultSystemAdminUsername() string {
170170
return "admin"
171171
}
172172

173173
func DefaultSystemAdminPassword() string {
174-
return oprand.String(8)
174+
return oprand.GenerateRandomPasswordHash()
175175
}
176176

177177
func DefaultSystemAdminAccessToken() string {

pkg/crypto/rand/rand.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,16 @@ func StringWithCharset(length int, charset string) string {
3737

3838
return string(result)
3939
}
40+
41+
// GenerateRandomPasswordHash generates a hash of a random ASCII password
42+
// 5char-5char-5char-5char
43+
// Inspired from openshift/installer https://github.com/openshift/installer/blob/master/pkg/asset/password/password.go
44+
func GenerateRandomPasswordHash() string {
45+
password := StringWithCharset(23, alphanumericCharset)
46+
pw := []rune(password)
47+
for _, replace := range []int{5, 11, 17} {
48+
pw[replace] = '-'
49+
}
50+
51+
return string(pw)
52+
}

0 commit comments

Comments
 (0)