Problem/Motivation

Currently the module doesn't migrate backup recovery codes. Which makes accessing of account harder when the TFA app is accessible.

Proposed resolution

Add Migration Plugin.

Remaining tasks

Add code.

CommentFileSizeAuthor
#9 tfa_recovery_code.csv3.21 KBjibus
#7 sample-recovery-codes.txt2.71 KBjibus
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

jibus created an issue. See original summary.

bhanu951’s picture

@jibus what do you mean by recovery codes migration?

Aren't we doing it already?

Do you mean accepted codes?

jibus’s picture

Status: Active » Closed (works as designed)

Hello @bhanu951

Yes, recovery codes !

Indeed, I see that this handle by the module. Weird, during my tests, recovery codes wasn't migrated.

I am gonna close the thread for now and continue my tests.

Sorry for that.

jibus’s picture

Status: Closed (works as designed) » Postponed

Re-open.

After checking the TFA User Settings migration process, it appears that the 'tfa_basic_recovery_code' plugin is migrated.

But the recovery codes are not.

This results in the user's TFA configuration contains the tfa_recovery_code plugin.

As a result, when the user logs in, he can use a recovery code plugin but since theses codes are not migrated the form cannot be displayed (the page reloads).

The recovery codes are in the 'tfa_recovery_code' table.

I don't know if we can migrate them. If not, the following code should be remove :

    // Check to see if the user has recovery codes enabled. If so, add it
    // to the plugins array.
    if (isset($decoded_data->plugins[1]) && ($decoded_data->plugins[1] == 'tfa_basic_recovery_code')) {
      $data_plugins['tfa_recovery_code'] = 'tfa_recovery_code';
    }
bhanu951’s picture

I didn't get what you mean. Can you share screenshot?

Recovery codes are migrated and are present in users_data table.

If data is migrated properly you will get page to provide TFA code instead of message to setup TFA.

bhanu951’s picture

Hi @jibus can you share me sample data from Drupal 7 tfa_recovery_code table?

I don't have sample data or working Drupal 7 site to test the migration for recovery codes.

I wrote a draft version, need to test it.
You can share me 5-6 (or as many as you wish) sample data to process,

jibus’s picture

StatusFileSize
new2.71 KB

Hi @bhanu951, of course - edit, please ignore double quotes

bhanu951’s picture

Can you share actual schema data with all the fields data.

Are they grouped by uid or something?

jibus’s picture

StatusFileSize
new3.21 KB

I am sorry, please find the extract of the table.

bhanu951’s picture

Issue summary: View changes
Status: Postponed » Needs work
bhanu951’s picture

Title: Ability to migrate recovery codes » Ability to migrate backup recovery codes

bhanu951’s picture

Status: Needs work » Needs review

Hi @jibus, I have pushed the changes, can you test it and let me know if it works ?

As I don't have your Drupal 7 private key I am unable to test decryption.

If the code doesn't work please share me your Drupal 7 private key and values of the backup codes from the site over slack.
So, I can test the decryption.

bhanu951’s picture

@jibus, I have made few more changes, now the migration of recovery codes would work properly.

jibus’s picture

@bhanu951, sorry for the delay.

What's the command to import recovery code ?

migrate:import tfa_migration_recovery_code --update

?

Tried with tfa_migration_totp_seed && tfa_migration_user_settings. Got same results.

I copied the code from your merge request.

bhanu951’s picture

> What's the command to import recovery code ?

drush mim tfa_migration_recovery_code

Is the command to migrate recovery codes.

bhanu951’s picture

@jibus, just checking with you again , were you able to test it ?