[Bug 44005] New: Add a system preference to enable or disable the email fallback for two-factor authentication
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44005 Bug ID: 44005 Summary: Add a system preference to enable or disable the email fallback for two-factor authentication Initiative type: --- Sponsorship --- status: Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: normal Priority: P5 - low Component: Authentication Assignee: koha-bugs@lists.koha-community.org Reporter: martin.renvoize@openfifth.co.uk QA Contact: martin.renvoize@openfifth.co.uk CC: dpavlin@rot13.org Target Milestone: --- When two-factor authentication (2FA) is enabled for the staff interface, the second-step login screen always offers a "Send the code by email" link, which emails a TOTP code derived from the user's authenticator secret (POST /api/v1/auth/otp/token_delivery). There is currently no way for a library to turn this off. Email delivery makes the second factor only as strong as the user's mailbox, so some libraries will want to require the authenticator app only. Proposed: a new system preference, TwoFactorAuthenticationEmailFallback (YesNo, default Yes so existing behaviour is preserved on upgrade), next to TwoFactorAuthentication in Staff interface > Authentication. When off: - the "Send the code by email" link is not shown on the second-step login screen - the REST route /api/v1/auth/otp/token_delivery refuses the request (the check must be server side, not only in the template) Test plan: 1. Enable TwoFactorAuthentication and enrol a staff user with an authenticator app. 2. With TwoFactorAuthenticationEmailFallback set to Yes, log out and in: the "Send the code by email" link is shown and works. 3. Set it to No, log out and in: the link is not shown. 4. While at the second step, POST to /api/v1/auth/otp/token_delivery: it is refused and no email is queued. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44005 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |44006 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44006 [Bug 44006] Allow staff to enrol in two-factor authentication using email instead of an authenticator app -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44005 --- Comment #1 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 210563 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=210563&action=edit Bug 44005: Add a system preference to enable or disable the email fallback for 2FA When two-factor authentication is enabled, the second-step login screen always offers a "Send the code by email" link. Email delivery makes the second factor only as strong as the user's mailbox, so some libraries will want to require the authenticator app only. This adds the TwoFactorAuthenticationEmailFallback system preference (YesNo, default Yes to preserve existing behaviour). When off, the link is not shown and POST /api/v1/auth/otp/token_delivery returns 403 (email_fallback_disabled), so the restriction does not rely on the template alone. To test: 1. Apply the patch, run updatedatabase.pl and restart_all. 2. Enable TwoFactorAuthentication and enrol a staff user with an authenticator app. 3. With TwoFactorAuthenticationEmailFallback set to Allow, log out and in: the "Send the code by email" link is shown and works. 4. Set it to "Don't allow", log out and in: the link is not shown. 5. At the second step, POST to /api/v1/auth/otp/token_delivery: it is refused with 403 and no email is queued. 6. prove t/db_dependent/api/v1/two_factor_auth.t Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44005 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff Assignee|koha-bugs@lists.koha-commun |martin.renvoize@openfifth.c |ity.org |o.uk -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44005 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|normal |enhancement -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44005 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44005 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #210563|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44005 --- Comment #2 from David Nind <david@davidnind.com> --- Created attachment 210806 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=210806&action=edit Bug 44005: Add a system preference to enable or disable the email fallback for 2FA When two-factor authentication is enabled, the second-step login screen always offers a "Send the code by email" link. Email delivery makes the second factor only as strong as the user's mailbox, so some libraries will want to require the authenticator app only. This adds the TwoFactorAuthenticationEmailFallback system preference (YesNo, default Yes to preserve existing behaviour). When off, the link is not shown and POST /api/v1/auth/otp/token_delivery returns 403 (email_fallback_disabled), so the restriction does not rely on the template alone. To test: 1. Apply the patch, run updatedatabase.pl and restart_all. 2. Enable TwoFactorAuthentication and enrol a staff user with an authenticator app. 3. With TwoFactorAuthenticationEmailFallback set to Allow, log out and in: the "Send the code by email" link is shown and works. 4. Set it to "Don't allow", log out and in: the link is not shown. 5. At the second step, POST to /api/v1/auth/otp/token_delivery: it is refused with 403 and no email is queued. 6. prove t/db_dependent/api/v1/two_factor_auth.t Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44005 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |david@davidnind.com --- Comment #3 from David Nind <david@davidnind.com> --- Testing notes (using KTD): 1. Set up two-factor authentication for the staff patron (I used the koha user). 2. Add a valid email address that you can access to the staff patron's account. 3. Set up Koha so that you can send email [1]. 4. Not able to successfully complete step 5 of the test plan (using Bruno with a POST to http://127.0.0.1:8081/api/v1/otp/token_delivery using koha and koha for BasicAuth, and nothing in the body or for params and headers). [1] Set up an SMTP server ========================== To test sending emails using a Google account: 1. Set up an App password for your Google Account 2. Configure a new 'SMTP Server' under 'Administration > SMTP servers' using the following settings, where `User name` = your Google email address and `Password` = your APP password, not your Google account password, set this server as default Host: smtp.gmail.com Port: 587 Timeout: 5 SSL: STARTTLS User name: GOOGLEACCOUNTUSER Password: GOOGLEAPPPASSWORD -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44005 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact|martin.renvoize@openfifth.c |dcook@prosentient.com.au |o.uk | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44005 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact|dcook@prosentient.com.au |katrin.fischer@bsz-bw.de Status|Signed Off |Passed QA Patch complexity|--- |Medium patch -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44005 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #210806|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44005 --- Comment #4 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Created attachment 211560 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=211560&action=edit Bug 44005: Add a system preference to enable or disable the email fallback for 2FA When two-factor authentication is enabled, the second-step login screen always offers a "Send the code by email" link. Email delivery makes the second factor only as strong as the user's mailbox, so some libraries will want to require the authenticator app only. This adds the TwoFactorAuthenticationEmailFallback system preference (YesNo, default Yes to preserve existing behaviour). When off, the link is not shown and POST /api/v1/auth/otp/token_delivery returns 403 (email_fallback_disabled), so the restriction does not rely on the template alone. To test: 1. Apply the patch, run updatedatabase.pl and restart_all. 2. Enable TwoFactorAuthentication and enrol a staff user with an authenticator app. 3. With TwoFactorAuthenticationEmailFallback set to Allow, log out and in: the "Send the code by email" link is shown and works. 4. Set it to "Don't allow", log out and in: the link is not shown. 5. At the second step, POST to /api/v1/auth/otp/token_delivery: it is refused with 403 and no email is queued. 6. prove t/db_dependent/api/v1/two_factor_auth.t Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44005 --- Comment #5 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Created attachment 211561 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=211561&action=edit Bug 44005: (QA follow-up) Update system prefernece INSERT to newer format Also makes the database update use "say_success". Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44005 --- Comment #6 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- I only noticed David in the QA contact when re-attaching the patches - hope I didn't step on any toes here! -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org