Redmine plugin redmine_2fa安裝
)
前言
redmine_2fa
是redmine的一個plugin,提供了登入redmine時雙因素驗證的機制。它的plugin頁面及github頁面分別為redmine_2fa及southbridgeio/redmine_2fa。
安裝步驟
安裝redis
按照How To Install and Secure Redis on Ubuntu 20.04的步驟做即可。
安裝redmine_sidekiq
cd redmine/plugins/
git clone https://github.com/southbridgeio/redmine_sidekiq.git
# move to the rails application "redmine"'s directory!
cd ..
bundle install
安裝redmine_bots
cd redmine/plugins/
git clone https://github.com/southbridgeio/redmine_bots.git
# move to the rails application "redmine"'s directory!
cd ..
bundle install
RAILS_ENV=production bundle exec rake redmine:plugins:migrate NAME=redmine_bots
安裝redmine_2fa
cd redmine/plugins/
git clone https://github.com/southbridgeio/redmine_2fa.git
# move to the rails application "redmine"'s directory!
cd ..
bundle install
RAILS_ENV=production bundle exec rake redmine:plugins:migrate NAME=redmine_2fa
重新啟動apache2:
systemctl restart apache2
Troubleshooting
NoMethodError (undefined method `tr’ for nil:NilClass
安裝完成後如果在登入時出現NoMethodError (undefined method `tr' for nil:NilClass
的問題,先檢查users
表格中的otp_secret_key
欄位是否為空。如果是,運行下面這條指令即可解決:
cd redmine
rails runner "User.find_each { |user| user.update_attribute(:otp_secret_key, ROTP::Base32.random_base32) } "
關聯issue:500 error with Google Auth, production.log - NoMethodError (undefined method `tr’ for nil:NilClass。
使用方式
redmine_2fa
安裝完成後,要登入redmine時會出現以下畫面:
選擇Google Authenticator
。
參考透過 Google Authenticator 取得驗證碼這篇教學,下載Google Authenticator App,用App掃描上面的QR Code。
然後在驗證碼欄位輸入Google Authenticator App上出現的六位數字即可登入。
下次登入時會出現以下畫面,同樣開啟Google Authenticator App,輸入上面出現的六位數字即可。
重設2fa otp secret key
使用管理員帳號登入redmine,進入users/<user_id>/edit
,按下Reset 2FA
按鈕重設。
下次登入時,就會出現以下畫面,要求使用者重新綁定手機。
如果要重設所有人的otp secret key,也可以透過重新安裝redmine_2fa plugin來達成。