Comments

coltrane’s picture

StatusFileSize
new2.23 KB

To start, here's the old functionality from TFA module.

coltrane’s picture

Status: Active » Needs review
scor’s picture

I agree something needs to be done to avoid locking UID 1 out of the site as described in #2371315: Remove UID 1 enforcement of TFA and allow hooks to require. In the end we're talking about replacing the 'require TFA' permission with a new permission 'bypass tfa setup', which makes total sense when rolling out TFA onto an existing site. However, just as the 'require TFA' had the unintended consequence of locking UID 1 and any user with the administrator role w/o TFA setup out of the site, in the case of the proposed new permission 'bypass tfa setup', it means that it will not be possible to lock any account that doesn't have TFA setup. In other words, once this module is enabled, UID1 (or any user with the "admin role") will have the permission to bypass TFA setup, allowing any attacker who manage to guess the password of any of those accounts to setup TFA and take over the account. Having a grace period to let people setup TFA is great, but there should be a way to lock any account that hasn't setup TFA within the grace period.

I'm wondering if instead of a user permission, we should use a multi-choice checklist, for example:
Roles allowed to bypass TFA during the login process:
[ ] authenticated user
[ ] administrator
[ ] editor

If you feel this is better as a separate feature request, then I'm happy to create it, but regardless we should be aware of the consequences of implementing the bypass feature as a user permission.

scor’s picture

Quick nitpick on the 'bypass tfa setup' permission. If I understand this properly, we're actually not bypassing the TFA setup during login. What we're bypassing is the requirement to have already setup TFA (which is the default requirement w/o this new permission). Maybe a better permission name would be 'bypass tfa'.

Also, the way I understand the current patch is that someone with that new bypass permission could very well decide to never setup TFA on their account, and leave it open to hackers to compromise the account with just a password. Another reason why it's dangerous to automatically grant that permission to UID 1 per my previous comment.

coltrane’s picture

Title: Implement TFA requirement » Implement TFA login requirement when TFA has not been set up
Status: Needs review » Needs work

Great point @scor! As always I really appreciate your feedback :).

It's true that any role-based selection will have the UID 1 loophole so let's just move it to a TFA-specific setting. Your proposal in #3 seems appropriate for this issue.

scor’s picture

Another side effect of the bypass permission that I'm noticing while testing the patch #1: given that authenticated users are not granted the bypass tfa permission by default, they are locked out as soon as TFA is enabled. Maybe we should grant this bypass permission to the authenticated user role to make the TFA roll out easier, or switch to my proposal in #3. Looks like we're in agreement @coltrane...

coltrane’s picture

Status: Needs work » Needs review
StatusFileSize
new3.34 KB

Attached patch implements recommendation from #3

Once TFA is enabled all users will be locked out so perhaps administrators should be allowed by default to bypass (and messages set so the person setting up TFA doesn't forget to remove the bypass) or the user setup page control from #2371315: Remove UID 1 enforcement of TFA and allow hooks to require should be ported over.

coltrane’s picture

StatusFileSize
new3.43 KB

And this patch flips from a bypass to a required, since the original functionality that's being removed in #2371315: Remove UID 1 enforcement of TFA and allow hooks to require was about requiring TFA setup for certain roles.

This way, an admin can enable TFA and allow anyone to set it up and after awhile start requiring it for all admins or other privileged roles.

coltrane’s picture

StatusFileSize
new3.44 KB

Re-roll to catch hook rename to 'tfa_ready_require' https://www.drupal.org/node/2371315#comment-9867465

@scor, any feedback/review?

coltrane’s picture

StatusFileSize
new6.32 KB

Found that there were message on the disable form that needed to be updated for this feature. This patch also fixes #2333773: TFA disable warning always applies to UID 1

  • coltrane committed 088fb35 on 7.x-1.x
    Issue #2457823 by coltrane: Implement TFA requirement when TFA has not...
coltrane’s picture

Status: Needs review » Fixed

I committed #10.

scor’s picture

Thanks for implementing this fix Ben. Sorry I couldn't test your patch earlier. I tested 7.x-1.x and the workflow works great aside from #2481215: PHP notices when no fallback setup.

Here is the workflow I tested:
- created user with admin role
- set admin role to be a required TFA role using the new checkboxes implemented in the patch
- user was not able to log in (error message saying to contact site admin)
- removed admin role from user
- user was able to log in and set up TFA (I had given the Set up TFA for account permission to auth user role)
- user logged out
- granted admin role to user
- user was able to log in with TFA

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.