-
Notifications
You must be signed in to change notification settings - Fork 16
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
Reset login password #146
Comments
Hi @PhilipSchmid, There's no functionality in our code to do this right now, but that password is a bcrypt hash with a work factor of 13. You could use the following snippet to generate a replacement password hash: https://gist.github.com/dseevr/008c4ca40d987dbcae726c90f470b772 And, you are correct, you could simply The work factor can be whatever you want, but we chose 13 as a good tradeoff of login time (more CPU power required to calculate the hash from the plaintext) and futureproofing. |
Closing this since workaround has been documented. We have recorded a work item to create a utility for this in future. |
Hi @dseevr, I tried to set the password via [root@node1 ~]# etcdctl set /auth_proxy/local_users/admin "{\"username\":\"admin\",\"first_name\":\"\",\"last_name\":\"\",\"disable\":false,\"password_hash\":\"\$2a\$13\$fSg1fedeYfX.M0BqcaNGs.2kI1XRnktp3a4h7UmUOAQ3QXnZ7uHYW\"}"
{"username":"admin","first_name":"","last_name":"","disable":false,"password_hash":"$2a$13$fSg1fedeYfX.M0BqcaNGs.2kI1XRnktp3a4h7UmUOAQ3QXnZ7uHYW"}
[root@node1 ~]# etcdctl get /auth_proxy/local_users/admin
{"username":"admin","first_name":"","last_name":"","disable":false,"password_hash":"$2a$13$fSg1fedeYfX.M0BqcaNGs.2kI1XRnktp3a4h7UmUOAQ3QXnZ7uHYW"} As you can see, I had to escape the the For the password hash generation I used your code snipped with the following constants: const (
password = "admin"
workFactor = 13
) As password I have chosen the default one ( phil$ go run main.go
"admin" -> "$2a$13$fSg1fedeYfX.M0BqcaNGs.2kI1XRnktp3a4h7UmUOAQ3QXnZ7uHYW" Unfortunately the login is still not working and the auth_proxy docker container shows the following lines in the log: time="2017-06-19T07:33:39Z" level=error msg="failed to authenticate user, err:Failed to unmarshal local user \"admin\" info 0"
time="2017-06-19T07:33:39Z" level=info msg="Invalid username/password" Do you have a guess what I've done wrong? Thanks! Regards, |
Hi @PhilipSchmid, I actually just wrote the utility to do this about an hour ago 😄 #149 (finishing integrating it into our systemtests right now) If you want to try it, you can grab the ./reset_local_user_password --data-store-address=etcd://host:port Alternatively, we check at startup whether the default users exist and add them if they do not. It seems like you could just delete the |
Haha awesome 👍 . Unfortunately the macbookpro:reset_local_user_password phil$ go get github.com/contiv/auth_proxy
macbookpro:reset_local_user_password phil$ go build .
macbookpro:reset_local_user_password phil$ ./reset_local_user_password --data-store-address=etcd://node1:2379
Username: admin
2017/06/19 10:07:34 unexpected error when fetching user record: Failed to unmarshal local user "admin" info 0 The difference is, that the auth_proxy container showed The ETCD cluster is reachable from my notebook so this shouldn't be the issue: macbookpro:reset_local_user_password phil$ etcdctl --endpoints http://node1:2379 get /auth_proxy/local_users/admin
{"username":"admin","first_name":"","last_name":"","disable":false,"password_hash":"$2a$13$fSg1fedeYfX.M0BqcaNGs.2kI1XRnktp3a4h7UmUOAQ3QXnZ7uHYW"} I now tried to delete the admin key and restarted the auth_proxy container: macbookpro:reset_local_user_password phil$ etcdctl --endpoints http://node1:2379 rm /auth_proxy/local_users/admin
PrevNode.Value: {"username":"admin","first_name":"","last_name":"","disable":false,"password_hash":"$2a$13$fSg1fedeYfX.M0BqcaNGs.2kI1XRnktp3a4h7UmUOAQ3QXnZ7uHYW"}
macbookpro:reset_local_user_password phil$ etcdctl --endpoints http://node1:2379 get /auth_proxy/local_users/admin
Error: 100: Key not found (/auth_proxy/local_users/admin) [17512636]
# Restart the auth_proxy container:
[root@inslnxcl01 ~]# docker restart 057d7c6bf65d
057d7c6bf65d
macbookpro:reset_local_user_password phil$ etcdctl --endpoints http://node1:2379 get /auth_proxy/local_users/admin
{"username":"admin","first_name":"","last_name":"","disable":false,"password_hash":"JDJhJDEzJG5tT2RlTllDTWd6VnA5OHVteUpGa2VOVWdKamlidjdyaTRER0xnTVh5Qk5XdHkuQXlTWWFh"}
It still does not work and the auth_proxy shows the following log: time="2017-06-19T08:22:08Z" level=error msg="failed to authenticate user, err:crypto/rsa: decryption error"
time="2017-06-19T08:22:08Z" level=info msg="Invalid username/password" If I now try to run macbookpro:reset_local_user_password phil$ ./reset_local_user_password --data-store-address=etcd://node1:2379
Username: admin
Password:
Confirm password:
Password for the local user 'admin' has been successfully changed. Unfortunately the auth_proxy log still shows the same error as pointed out above. Thanks! Regards, |
Hmm, I'm not having any issues here...
It's pretty late here (almost 2am), so I'll need to get back to you in the morning about this. 😄 Sorry for the inconvenience! |
Hi there,
I would like to know if it's possible to reset the password of the admin user account?
I saw that in the ETCD there is a password hash:
What kind of hash is this? SHA256? If so it should be no problem to reset the password, right?
Perhaps this could be added to the documentation.
Thanks.
Regards,
Philip
The text was updated successfully, but these errors were encountered: