ruebenramirez / blog

My blog
http://blog.ruebenramirez.com/
7 stars 0 forks source link

gitlab two factor auth reset #336

Open ruebenramirez opened 8 years ago

ruebenramirez commented 8 years ago

I recently upgraded my personal gitlab install using the sameersbn/gitlab container image. He's done a great job at tracking latest community releases.

One of the issues I had after the upgrade was logging in with my user account and the 2fa that was configured before the ugprade. I believe the upgrade changed how 2fa was implemented, so I had to reset my user account.

I stumbled across a useful rails one line command that just resets all users' 2fa settings to disabled.

rails runner 'User.find_each(&:disable_two_factor!)'

This allows all users to auth with their normal creds, and then prompts them to configure 2fa again.

on the sameersbn/gitlab container image, I needed to use the /home/git/gitlab/bin/rails executable to run the one liner:

docker exec -ti gitlab bash -c "pushd /home/git/gitlab/bin && ./rails runner 'User.find_each(&:disable_two_factor!)'"