Bugzilla – Attachment 155253 Details for
Bug 30843
TOTP expiration delay should be configurable
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30843: Add mfa_range configuration option for TOTP
Bug-30843-Add-mfarange-configuration-option-for-TO.patch (text/plain), 2.97 KB, created by
David Cook
on 2023-09-06 05:24:33 UTC
(
hide
)
Description:
Bug 30843: Add mfa_range configuration option for TOTP
Filename:
MIME Type:
Creator:
David Cook
Created:
2023-09-06 05:24:33 UTC
Size:
2.97 KB
patch
obsolete
>From 68c350e12bf1cea9ae6ec5a90043743a2b40b298 Mon Sep 17 00:00:00 2001 >From: David Cook <dcook@prosentient.com.au> >Date: Wed, 6 Sep 2023 05:12:50 +0000 >Subject: [PATCH] Bug 30843: Add mfa_range configuration option for TOTP > >This change adds a mfa_range configuration option for TOTP >to koha-conf.xml > >Test plan: >0. Apply the patch >1. koha-plack --restart kohadev >2. Go to >http://localhost:8081/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=TwoFactorAuthentication >3. Change the syspref to "Enable" >4. Go to >http://localhost:8081/cgi-bin/koha/members/moremember.pl?borrowernumber=51 >5. Click "More" and "Manage two-factor authentication" >6. Register using an app >7. In an Incognito window, go to >http://localhost:8081/cgi-bin/koha/mainpage.pl >8. Sign in with the "koha" user >9. Note down a code from your Authenticator app >10. Wait until after 60 seconds and try it >11. Note it says "Invalid two-factor code" >12. Try a new code from the app >13. Note that it works > >14. Add <mfa_range>10</mfa_range> to /etc/koha/sites/kohadev/koha-conf.xml >15. Clear memcached and koha-plack --restart kohadev >16. Sign in with the "koha" user >17. Note down a code from your Authenticator app >18. Wait 4 minutes and then try it >19. Note that it works >--- > C4/Auth.pm | 3 ++- > debian/templates/koha-conf-site.xml.in | 2 ++ > etc/koha-conf.xml | 2 ++ > 3 files changed, 6 insertions(+), 1 deletion(-) > >diff --git a/C4/Auth.pm b/C4/Auth.pm >index 9b298eed87..c3c31f0f92 100644 >--- a/C4/Auth.pm >+++ b/C4/Auth.pm >@@ -883,7 +883,8 @@ sub checkauth { > { > my $patron = Koha::Patrons->find( { userid => $userid } ); > my $auth = Koha::Auth::TwoFactorAuth->new( { patron => $patron } ); >- my $verified = $auth->verify($otp_token, 1); >+ my $mfa_range = C4::Context->config('mfa_range') ? int(C4::Context->config('mfa_range')) : 1; >+ my $verified = $auth->verify($otp_token, $mfa_range); > $auth->clear; > if ( $verified ) { > # The token is correct, the user is fully logged in! >diff --git a/debian/templates/koha-conf-site.xml.in b/debian/templates/koha-conf-site.xml.in >index 6d0e0f10db..8733dc6690 100644 >--- a/debian/templates/koha-conf-site.xml.in >+++ b/debian/templates/koha-conf-site.xml.in >@@ -480,5 +480,7 @@ __END_SRU_PUBLICSERVER__ > <!-- Like: <domain><name>hotmail.com</name><belongs_to>outlook.com</belongs_to></domain> --> > </message_domain_limits> > >+ <mfa_range>1</mfa_range><!-- Number of 30 second iterations to allow for MFA code checking --> >+ > </config> > </yazgfs> >diff --git a/etc/koha-conf.xml b/etc/koha-conf.xml >index 67105b30c0..829ffd3e7d 100644 >--- a/etc/koha-conf.xml >+++ b/etc/koha-conf.xml >@@ -291,5 +291,7 @@ > <!-- Like: <domain><name>hotmail.com</name><belongs_to>outlook.com</belongs_to></domain> --> > </message_domain_limits> > >+ <mfa_range>1</mfa_range><!-- Number of 30 second iterations to allow for MFA code checking --> >+ > </config> > </yazgfs> >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 30843
:
155253
|
155348
|
155349
|
155354
|
155355
|
155356
|
155357