This is my guide to setting up Two-factor Google-Authenticator for Virtualmin on CentOS.
Virtualmin now has Two Factor Built in: http://doxfer.webmin.com/Webmin/EnhancedAuthentication
In Virtualmin Click on the:
Webmin >> Webmin >> Webmin Users >> Two-Factor Authentication >> Enable Two-Factor For User
You will now be prompted to install the Authen::OATH Perl module at this point, if it is missing from your system.
Simply click on the Perl Modules Button – it will try to install it – if it fails you need to install the dependencies
Via SSH Run:
yum --enablerepo=epel install 'perl(Moose)'
Then go back to Virtualmin:
Webmin >> Webmin >> Webmin Users >> Two-Factor Authentication >> Enable Two-Factor For User
Click on the Perl Modules Button – it will should now be able to install it.
Once it has installed you can then click on the Enroll For Two-Factor Authentication button.
If using Google Authenticator, Webmin will display a QR code that contains the TOTP secret that you can scan using the Authenticator app on your smartphone.
Thanks for the tip. I got this working on my Ubuntu 14 server – just wondered if there is any way of getting any one-time use codes like google provides when you add 2FA to your account. It would be useful in the case of a lost / broken phone – although I do have SSH access as well
When you follow the steps it should generate the 2FA ONE-TIME Codes – you could also run the command below to see them:
cat ~/.google_authenticator
Hi
I have a VPS running CentOS 6.7, and when I try to enable Google Authenticator I get:
“The Perl module Authen::OATH needed for two-factor authentication is not installed.”
I have installed “‘perl(Moose)’, and OATH yet CentOS/Webmin can’t see the module.
If you have a solution to get 2FA going in Webmin, I would be willing to pay for your help.
Thanks…
Robert Gusnowski
Hi, Where you able to get this to work? If not let me know and I will get in contact with you on how I can help!