Got 500 error when enabling 2FA.

Added by Crocodile Rat 4 months ago

Hello,
I get 500 internal error when I enable 2FA on my account, the log file says "undefined method `random' for ROTP::Base32:Class". Please help me!

My environment:
OS: Rocky Linux
Redmine version: Redmine 4.2.4.stable
Ruby version: ruby 2.6.9p207
Database: 10.3.34-MariaDB
Ruby-aware server used: Thin

Log:
Started POST "/my/twofa/totp/activate/init" for 0.0.0.0 at 2022-03-16 xx:xx:xx +xxxx
Processing by TwofaController#activate_init as HTML
Parameters: {"authenticity_token"=>"xxxxxxxxxxxxxxxxxxxxxxxxx/xxxxxxxxxxxxxxx", "scheme"=>"totp"}
Current user: test_user (id=842)
Completed 500 Internal Server Error in 9ms (ActiveRecord: 2.7ms)

NoMethodError (undefined method `random' for ROTP::Base32:Class):

lib/redmine/twofa/totp.rb:26:in `init_pairing!'
app/controllers/application_controller.rb:213:in `init_twofa_pairing_and_send_code_for'
app/controllers/twofa_controller.rb:41:in `activate_init'
lib/redmine/sudo_mode.rb:61:in `sudo_mode'

Replies (2)

RE: Got 500 error when enabling 2FA. - Added by Go MAEDA 4 months ago

I suspect that you are using an older version of ROTP. ROTP::Base32.random was added in ROTP 5.0 (https://github.com/mdp/rotp/blob/master/CHANGELOG.md#500).

Could you execute `grep rotp Gemfile.lock` in the installation directory of Redmine and paste the result?

RE: Got 500 error when enabling 2FA. - Added by Crocodile Rat 4 months ago

Yes you are right, I executed the upgrade and solved all issues. Thank you.

(1-2/2)