LoginSignup
9
5

More than 5 years have passed since last update.

GitHubで無くしたMFSのrecovery-codesを復旧した話

Posted at

GitHubに入れなくなった。

GitHubはセキュリティーのために、MFAを設定していました。
この状態で、不幸が重なり、入れなくなっていたアカウントがまさかの復旧が出来たので、その顛末をお話します。

MFAデバイスの故障

AndroidをMFA端末に設定しているのですが、この端末が壊れました(正確には壊れたというか、暗号化状態でOSアップデートをしたときに不具合で起動しなくなるというのに月一くらいの頻度で3回ほど遭遇しました。)

このため、MFAを3回ほど設定し直すという作業をしていました。

recovery-codesの世代ずれ

MFAを設定したときには、recovery-codesが発行されます。
当然このファイルは保存していたのですが、上記の通り3回くらい再設定をしていたせいで、最新のファイルがどれだか分からなくなってしまいました。

入れない

こうなると、もうGitHubには入れない、アカウントを取り直すしかないか。
2段階認証でGitHubから締め出しをされないように準備しておくこと
Githubを2段階認証に設定した状態でログインできなくなった場合
としばらく悩んでいたのですがメールアドレスやアカウントIDなど
どうしても変えたくなかったので、ダメ元でGitHubのサポートに泣きついてみました。

泣きつきメール

recovery-codesを入力して弾かれた後のページで
サポートフォームへのリンクがあります。
そこから次のようなメールを送りました。

I lost github_2fa_recovery_codes.txt

I am I lost github_2fa_recovery_codes.txt.
I do not want to change the account name etc, so how can I restore it
Help me.

GitHubからの返信

ダメ元でメールを送ってみたら、まさかの返信がありました。

Re: I lost github_2fa_recovery_codes.txt

Thanks for getting in touch.

Even if you think you might not have your recovery codes, it's worth searching your computer (and any backup locations or password keeper apps) just to be sure; you'd be surprised how often these turn up! They would have had the default filename github-recovery-codes.txt or github_2fa_recovery_codes.txt.

If you definitely don't have valid recovery codes, we can try to verify account ownership using an SSH key you have added to your account. To do this, please run the following command on the computer where your SSH key exists, and send us the full output:

ssh -T git@github.com verify

If you can verify account ownership, we can disable 2FA on your account so you can sign in again.

Thanks,

なんとsshキーの出力を送って、自分の物だと証明できればMFAの解除してもらえるらしい!
ということなので、早速、Git Shellでコマンドを打って、返信してみした。

Re: I lost github_2fa_recovery_codes.txt

Thanks for sending that over!

I've just removed two-factor authentication from your account, so you'll now be able to log in. As soon as you do, please be sure to re-enable two-factor authentication; it may have caused some hassle on this occasion, but we can avoid that in the future by taking some extra steps to avoid this down the road.

Download your recovery codes. This is far and away the best way to make sure you don't get locked out of your account. If you ever disable, and then re-enable 2FA, be sure to download the new codes we generate — the old ones will no longer work.

https://help.github.com/articles/downloading-your-two-factor-authentication-recovery-codes

Set a fallback number (in supported territories). As long as your phone wasn't lost, you'll be able to regain access to your account in the amount of time it takes to receive an SMS.

https://help.github.com/articles/setting-a-fallback-authentication-number

Add a security key. No phone and you lost your recovery codes? Today is turning into a rough day, but you'll still have access to your account if you have a FIDO U2F security key added to your account.

https://help.github.com/articles/configuring-two-factor-authentication-via-fido-u2f

Please let me know if you have any questions!

解除出来た!

ということで、見事にMFAを解除してもらえました。
早速ログインしてMFAを再設定、これまではアプリケーションMFAだけでしたが、今回はSMS-MFAを追加で設定、ダウンロードしたgithub-recovery-codesには、日付情報を付与して、世代が分からなくならないようにして、保存しました。

9
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
9
5