the-djmaze / snappymail

Simple, modern & fast web-based email client
https://snappymail.eu
GNU Affero General Public License v3.0
1.01k stars 121 forks source link

Is 2-Step Verification actually usable? #84

Closed tomscii closed 3 years ago

tomscii commented 3 years ago

Describe the bug Setup dialog

The user opens Settings and clicks on Security -> Configure 2-Step Verification. The resulting dialog has usability issues that are serious enough to throw off non-technical users and render this feature virtually unusable (as in, cannot promote it to a group of less geeky users).

Login with 2FA Now on to actually logging in with 2-Step verification. I can use the time-based code supplied by my TOTP app and it lets me in. A wrong code will not let me in (a popup mentioning "2-Step Verification failure" gives adequate feedback).

However, I cannot seem to use my backup codes. There is no bespoke place to enter them (or a way to state that I cannot generate a one-time code and want to use a backup code). If I just enter one of my backup codes as a Verification Code, I get a popup saying "Unknown error".

Expected behavior This is more of a general exploration of a closely related set of issues (some minor, others major), so the expected behaviour is not exactly clear-cut. However, there is a lot of prior art out there; I have 2FA enabled on lots of accounts and none was as obnoxious as this one. I think GitHub in particular has a very nice implementation.

Desktop (please complete the following information):

Additional context I have not tested RainLoop with this, so it might be that this is something that has "always" been broken.

tomscii commented 3 years ago

A little update here, as I just had a few minutes to test this with latest RainLoop Community Edition.

Differences:

What is even better, RainLoop will not accept the same backup code a second time (but will accept a different one). This is something I could not test with SnappyMail. In all, from a technical perspective, RainLoop's 2FA seems to work fine.

The rest of the issues (mostly around the usability of the setup dialog) are the same, but the above clearly seem like regressions in SnappyMail.

Again, this is not super important or urgent to me personally, rather I am raising the issue for your awareness.

And as always, thank you for your dedication and work spent on SnappyMail, I really appreciate all of it!

the-djmaze commented 3 years ago

Actually i was thinking to remove the whole 2FA. It's "fake security" when IMAP/SMTP ports are still remotely accessible.

Let met explain:

  1. I know your password (by login attempts)
  2. RainLoop shows 2FA so i can't login
  3. I use IMAP/POP3 to login (which has no 2FA)
  4. I use SMTP to send e-mail in your name (which has no 2FA)
ervee commented 3 years ago

I thought exactly the same! Still I use MFA on RainLoop. But what if the IMAP/SMTP(auth) server are exposed externally?

tomscii commented 3 years ago

True. And I completely understand (and principally agree with) your argument. But still, 2FA seems to be a feature in popular demand when it comes to accessing mail through the browser. Certain systems might be set up so that they restrict (or eliminate) access to imap/smtp, only offering webmail through the public internet (maybe they do offer imap/smtp from the inside network of the org). That would be a usecase where 2FA would have its merit.

As a sysadmin, I would never make it mandatory for all users (since, at least in a more generic usecase, one can argue that it's a false sense of additional security), but certain users will want to be able to enable it for themselves, so it would be nice if the option could be provided in a usable form.

the-djmaze commented 3 years ago

I will remove if for now, as it is currently a false sense of security. I will make a plugin for it (just like i did by moving change-password out of the core).

the-djmaze commented 3 years ago

Somehow removing the 2fa and revamp of languages made SnappyMail 0.2-0.4s faster.

Will make a 2fa plugin :wink:

What if the IMAP/SMTP(auth)cis not exposed externally?

Then MFA is great.

ervee commented 3 years ago

A plugin would be great! And what I also always missed in RainLoop wat 2FA/MFA on the ADMIN page :)

the-djmaze commented 3 years ago

@ervee i've added the 2FA TOTP to the admin login page. application.ini: admin_totp = ''

the-djmaze commented 3 years ago

This plugin will be available when 2.5.4 is released

ervee commented 3 years ago

@ervee i've added the 2FA TOTP to the admin login page. application.ini: admin_totp = ''

I was a bit lost on what to enter behind admin_totp :) I'm not sure if this is what you envisioned, but after enabling the 2FA plugin I logged in as regular user, went to settings > 2 Step... Then clicked "Activate", used the Secret to setup a manual 2FA for "SnappyMail Admin" (in my andOTP App), did a test, then clicked "Clear" (because I want a separate 2FA code for my admin). The Secret is what I also used in the admin_totp setting in application.ini and this works. I now have to use the code from my App to login to the admin panel, nice!

Of course you can also use the same Secret for your regular user and use it for admin_totp. Even if the 2-Step was already setup. At least in andOTP you can edit an entry and see the Secret. Just copy or share it from there.

the-djmaze commented 3 years ago

@ervee you don't need the 2FA plugin for admin account. Just drop a base32 string in the admin_totp = '' and use that base32 string in your andOTP client ;)

The plugin is only for users.

ervee commented 3 years ago

Okay. Is so just use some arbitrary string of [A-Z] and [0-9], say JG1UWKK6AUFJEBT99OALFHJE8J , put it in application.ini and my OTP App and this will also work? Will give that a try later when I can.

the-djmaze commented 3 years ago

so just use some arbitrary string of [A-Z] and [0-9]

Almost, Base32 has [2-7] NOT [0-9] Base32 was chosen for easy reading, typing 0 or O makes a difference ;)

leofontenelle commented 1 year ago

I will remove if for now, as it is currently a false sense of security. I will make a plugin for it (just like i did by moving change-password out of the core).

Thanks for SnappyMail in general and this attention to security in particular.

Maybe app-specific passwords would solve the lack of 2FA outside webmail?

https://www.fastmail.help/hc/en-us/articles/360058752854-App-passwords

(I'm only a user, so forgive me if this is obvious.)