FEATURE/MEDIUM: userList: generate random secure password#47
FEATURE/MEDIUM: userList: generate random secure password#47aiharos merged 1 commit intohaproxytech:masterfrom
Conversation
fc1e569 to
5273053
Compare
|
This is related to #12 |
haproxy/config.go
Outdated
| b := make([]rune, n) | ||
| rand.Seed(time.Now().UnixNano()) | ||
| for i := range b { | ||
| b[i] = dictionary[rand.Intn(len(dictionary))] |
There was a problem hiding this comment.
This should use crypto/rand instead of math/rand. math/rand is not a secure random source.
There was a problem hiding this comment.
I applied suggested changes.
5273053 to
146eb1a
Compare
|
I don't think hashing the password is needed here. b64 should only output chars compatible with the config file format and hashing doesn't add entropy to the generated string. |
|
If we remove hashing func, then we need to use
My understanding from above is that generated password should be in memory and encrypted password saved to disk. What do you think? EDIT: After rethinking this, I think also we don't need a |
146eb1a to
fd35223
Compare
This change previously hard coded password usage and instead use generated password. So, on every start up a random password is generated and saved to HAProxy conf.
fd35223 to
c9cfd4f
Compare
|
LGTM |
This change previously hard coded password ("insecure-password" in HAProxy config) usage and instead use hashed password("password").
So, on every start up a random password is generated, hashed and then saved to HAProxy conf.
Generated password is stored in memory, while hashed password is saved to HAProxy conf.