-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FEATURE/MEDIUM: userList: generate random secure password #47
FEATURE/MEDIUM: userList: generate random secure password #47
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should use crypto/rand
instead of math/rand
. math/rand
is not a secure random source.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.