Can't enable 2FA, keep saying I am missing Authen::OATH

I have done the following to get the 2FA to work with Google.

Setup Two-Way authenticator using Google Authenticator http://doxfer.webmin.com/Webmin/Enhanced_Authentication First install EPEL repository
cd /tmp
wget http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-8.noarch.rpm
rpm -ivh epel-release-7-8.noarch.rpm
yum install perl-Moose
yum update
Webmin >> Webmin >> Webmin Users >> Two-Factor Authentication >> Enable Two-Factor For User

It kept saying that I did not have the Authen::OATH Perl module installed. I press the "Perl Modules" to let Webmin handle it, but it keep getting "install failed" when trying to solve the Perl modules.

--> Installing package(s) with command /bin/yum -y install perl(Authen::OATH) .. No package perl(Authen::OATH) available. .. install failed! <--

I then tried the CPAN manual install yum install gcc yum install CPAN configure CPAN ( just run CPAN ) after CPAN is configured, install Authen::OATH module from within CPAN shell, install Authen::OATH When Authen::OATH is successfully installed, configure 2FA in WebMin.

Still keeps saying that Authen::OATH is not installed even though that I can see I am running version 2.0.0 I validated the modules that the Perl Modules say I am missing. I have them all installed on the server!? perl-LWP-MediaTypes.noarch 6.02-2.el7 @base perl-Moose.x86_64 2.1005-1.el7 @epel perl-Digest-SHA.x86_64 1:5.85-3.el7 @base perl-List-MoreUtils.x86_64 0.33-9.el7 @base perl-Module-Build.noarch 2:0.40.05-2.el7 @base perl-Digest-HMAC.noarch 1.03-5.el7 @base

I am lost here.

Looking forward to hear from you. Best Regards

Tim Hallgren

Status: 
Closed (fixed)

Comments

What output do you get if you SSH in as root and run perl -e "use Authen::OATH"

Hi Jamie

Here is the result, it looks like it can't locate Perl Moose?

[root@glolinweb010 ~]# perl -e "use Authen::OATH" Can't locate Moo.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at /usr/local/share/perl5/Authen/OATH.pm line 8. BEGIN failed--compilation aborted at /usr/local/share/perl5/Authen/OATH.pm line 8. Compilation failed in require at -e line 1. BEGIN failed--compilation aborted at -e line 1.

[root@glolinweb010 ~]# yum list installed | grep Moo perl-Moose.x86_64 2.1005-1.el7 @epel

Try running yum install perl-Moo or perl -MCPAN -e "install Moo"

Hi Jamie

I ran the following command perl -MCPAN -e "install Moo"

Now I get the following.

[root@glolinweb010 ~]# perl -e "use Authen::OATH" Can't locate Types/Standard.pm in @INC (@INC contains: /usr/local/lib64/perl5 /u sr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl / usr/lib64/perl5 /usr/share/perl5 .) at /usr/local/share/perl5/Authen/OATH.pm lin e 9. BEGIN failed--compilation aborted at /usr/local/share/perl5/Authen/OATH.pm line 9. Compilation failed in require at -e line 1. BEGIN failed--compilation aborted at -e line 1.

So now Moo has been installed, missing "Standard.pm".

Tim

I tried to run the installation of Types::Standard with the following command.

perl -MCPAN -e "install Types::Standard"

But it failed with the following.

t/30-integration/Moose/native-attribute-traits.t .......... Can't locate Test/Moose.pm in @INC (@INC contains: /root/.cpan/build/Type-Tiny-1.000005-0_H3Fs/inc /root/.cpan/build/Type-Tiny-1.000005-0_H3Fs/blib/lib /root/.cpan/build/Type-Tiny-1.000005-0_H3Fs/blib/arch /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at t/30-integration/Moose/native-attribute-traits.t line 31. BEGIN failed--compilation aborted at t/30-integration/Moose/native-attribute-traits.t line 31.

Test Summary Report

t/30-integration/Moose/native-attribute-traits.t (Wstat: 512 Tests: 0 Failed: 0) Non-zero exit status: 2 Parse errors: No plan found in TAP output Files=151, Tests=1642, 14 wallclock secs ( 0.48 usr 0.09 sys + 12.97 cusr 1.27 csys = 14.81 CPU) Result: FAIL Failed 1/151 test programs. 0/1642 subtests failed. make: *** [test_dynamic] Error 255 TOBYINK/Type-Tiny-1.000005.tar.gz /usr/bin/make test -- NOT OK //hint// to see the cpan-testers results for installing this module, try: reports TOBYINK/Type-Tiny-1.000005.tar.gz Running make install make test had returned bad status, won't install without force

Hi Jamie

I solved it by installing the "Test/Moose.pm" using the following command.

perl -MCPAN -e "install Test::Moose"

Then I could run the installation of Standard.

perl -MCPAN -e "install Types::Standard"

When I run the check command it doesn't give me any warnings. perl -e "use Authen::OATH"

And now I am able to activate the 2FA using Google Authenticator. :)

So I would say this one is solved. A little tougher then expected, pyh..

Tim

Status: Active » Closed (fixed)

Great! It's annoying that these modules have so many dependencies :-(

Hi Jamie

Back to this old case. I started getting the below error on the servers we was getting this to work on. two-factor authentication failed : incorrect otp code

I have tried to remove TOTP from the user within miniserv.users, restart the webmin and then added the two form authenticator again on the selected user and added it as new key within the Google 2FA app on the mobile. But still gets the "incorrect otp code"?

What's wrong here, something changed in the webmin, it's on 2 of my installations I got this issue?

  • Tim
Status: Closed (fixed) » Needs work

Hi Jamie

I have reopened this ticket again. Please see post #9

Tim

Did this stop working after you upgraded Webmin ?

Hi Jamie

Yes, i have updated the whole system recently. After that I haven't been able to login using Google 2FA. Tried to remove it and add it again, no luck. I have 2 Virtualmin Pro instances, they work, but the two Virtualmin (normal) instances doesn't. It was those we was fighting to get the 2FA to work on in this ticket.

Tim

Virtualmin Pro vs GPL vs Webmin shouldn't make any difference, as the 2-factor code is identical in all cases.

Have you tried un-enrolling the problem users at Webmin -> Webmin Users -> username? That would be reliable than editing miniserv.users directly.

Hi Jamie

Just tried to re enroll the root user to 2FA, it gives me the same error:

Warning! Two-factor authentication failed: Incorrect OTP code

  • Tim

Hi Jamie

I have also tried to create test accounts where I have enabled the 2FA, same issue. It doesn't work and gives me the same error : Incorrect OTP code

  • Tim

Just to double-check - are you generating the OTP code using the Android Google Authenticator app, enrolled using the QR code displayed by Virtualmin?

Hi Jamie

Yes, I am using the Google Authenticator with the QR code displayed in Virtualmin. It get's added to my Google Authenticator on my phone (android) but keeps telling me that I am using an incorrect OTP code. This is working fine on my two Virtualmin Pro instances.

Tim

Is there anything different between the systems, such as the versions of the TOTP perl module installed (visible at Webmin -> Others -> Perl Modules) ?

Hi Jamie

The only issues was the installation and enabling of the 2FA as discussed earlier in this ticket. I am not sure if that could be an issue with webmin updates after this?

In the "existing modules" for Perl, there is no version number for the module "Authen::OATH" on the Virtualmin instances not working?

But there is no issues when I run the command : perl -e "use Authen::OATH"

If needed you can get support access?

  • Tim

Hi Jamie

Tried to remove Authen::OATH using the Perl Modules overview in Webmain -> Others and the reinstall it using cpan install Authen::OATH It install versions 2.0.0 but it still doesn't display the version number and it still gives me the OTP error.

  • Tim

Is this on a CentOS 7 system with the stock Perl package, and Authen::OATH installed from CPAN? I need to try re-producing the bug using your exact environment.

Hi Jamie

Operating system CentOS Linux 7.3.1611 Webmin version 1.830 Virtualmin version 5.05

Below is the history we did related to this ticket to get Authen:OATH installed with dependencies.

343 wget http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-8.noarch.rpm 344 rpm -ivh epel-release-7-8.noarch.rpm 345 yum install perl-Moose 346 yum update 347 yum install authen 348 yum install perl-Moose 349 yum list epel 350 yum repolist 351 yum repolist all 352 service webmin restart 353 init 6 354 yum --enablerepo=epel install 'perl(Moose)' 355 yum -y install perl(Authen::OATH) 356 yum list perl* | grep OATH 357 yum list * | grep OATH 358 yum list perl* | grep SHA 359 yum list perl* | grep Authen 360 yum repolist all 361 cd /tmp 362 yum remove epel-release-7-8.noarch.rpm 363 yum remove perl-Moose 364 rpm -e epel-release-7-8.noarch.rpm 365 yum update 366 rpm -qa | grep -i epel 367 rpm -e epel-release-7-8.noarch 368 yumupdate 369 yum update 370 wget http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-6.noarch.rpm 371 rpm -ivh epel-release-7-8.noarch.rpm 372 yum install perl-Moose 373 yum update 374 yum install gcc 375 yum install cpan 376 cpan 377 yum update 378 yum list perl* | grep Moo 379 yum list installed | grep Moo 380 yum list installed | grep Standard 381 yum list perl* | grep Standard 382 yum list perl* | grep Types 383 yum list installed | grep Types 384 cpan install Authen::OATH 385 rpm -qa | grep -i clam 386 yum list perl* | grep Types 387 yum list installed | grep Types 388 yum list installed | grep Moo 389 perl-Moose.x86_64 2.1005-1.el7 @epel 390 yum list installed | grep SHA 391 yum list installed | grep Standard 392 yum list installed | grep More 393 yum list installed | grep Build 394 yum list installed | grep Big 395 yum list installed | grep Math 396 yum list installed | grep HMAC 397 df -h 398 perl -e "use Authen::OATH" 399 yum list perl* | grep Moo 400 yum list installed | grep Moo 401 yum install perl-Moo 402 perl -MCPAN -e "install Moo" 403 perl -e "use Authen::OATH" 404 perl -MCPAN -e "install Standard" 405 perl -e "use Authen::OATH" 406 find / -name Standard.pm 407 find / -name Moo.pm 408 perldoc -q installed 409 cpan -l 410 cpan -l | grep Stand 411 cpan -l | grep Simple 412 cpan -l | grep Moo 413 ppm 414 cpan 415 perl -e "use Authen::OATH" 416 perl -MCPAN -e "install Standard" 417 perl -MCPAN -e "install Types::Standard" 418 perl -MCPAN -e "install Test::Moose" 419 perl -MCPAN -e "install Types::Standard" 420 perl -e "use Authen::OATH"

(why is the comment wrap all the lines to one?) - Tim

Sorry if I missed this, but were you not able to install the module by just running :

perl -MCPAN -e 'install Authen::OATH'

Hi Jamie

I haven't tried to install it using MCPAN, only CPAN as mentioned in the beginning of my post. I just did the command "perl -MCPAN -e 'install Authen::OATH'" and tried to login using 2FA and it seems to work :)

  • Tim

Ok, cool! I'm not sure why installing the same module the other way didn't work ... perhaps it was an older version?

Hi Jamie

It's the same version it got installed 2.0.0 But it did some other things also when I ran the command, did not save the output, sorry. But as long as it works :)

  • Tim
Status: Needs work » Closed (fixed)

I will close this ticket, it has been fixed running. perl -MCPAN -e 'install Authen::OATH'

Tim

For people having trouble running the CPAN or MCPAN commands via command line or through the Perl Module manager in Webmin (meaning it fails to install via CPAN so it tried to install via source), you need to first install CPAN:

yum -y install perl-CPAN

Update CPAN if needed.

And the approximate sequence of commands thereafter:

perl -MCPAN -e "install Test::Moose"

perl -MCPAN -e "install Types::Standard"

perl -MCPAN -e "install Moo"

perl -MCPAN -e "install Authen::OATH"

I realise those steps should work but they actually don't.

I would suggest if the steps worked then the webmin Perl module manager would actually get it right every time which it clearly is not since the internet is littered with reports of exactly this problem going back over years.

I have a VPS installed this week, Authen::OATH is installed correctly and runs without errors of any kind but I still get the exact same error. I've been able to get it work in the past with other VPS'es after a lot of messing around.

This is actually broken, it's badly broken and has been for a long, long time.

There's a few different problems described above -- can you clarify what error it is that you are receiving, and when you're receiving it?

there's one error being reported here, that's an error message reported when trying to enable google 2fa. The text is:

"Failed to save two-factor authentication : The Perl module Authen::OATH needed for two-factor authentication is not installed. Use the Perl Modules page in Webmin to install it."

This seems to be in error, Authen::OATH is installed and working just fine on my VPS.

What output do you receive if you run the command that Jamie mentioned above: perl -e "use Authen::OATH"

as I said, Authen::OATH is installed and working just fine. I am able to check and I did.

What if you go to Others -> Command Shell, and run the command :

perl -e 'use Authen::OATH'

As I posted, three times, authen::oath is installed and working just fine.

Just to expand on that a little.

I suggest if you look around on Google for cases where, like me, people have the module installed and working and this check fails, that you'll find it's far from unusual.

I'm perfectly well aware, because I looked at the code, that "perl -e 'use Authen::OATH'" is similar to the check made by webmin but it's not identical purely on context.

Two other takeouts from searching are that the people reporting this problem seem to be on centos and, second, that there's no sign of widespread problems with Authen::OATH in other applications.

I'd also note that where users are resolving their problem it most often seems to be not a problem directly with Authen::OATH either, generally they're missing other modules.

I have two VPS servers built from the same image, one works and the other doesn't. The differences are the (1) order I installed packages and modules in and (2) the source of modules, i.e. yum vs cpan.

I expect I will at some point re-install perl and webmin from source which I expect will work just fine. That's not really a good solution though.

Thanks, I've been away and not able to reply until now.

I have tried to explain several times that the module is installed and that I've checked using the same method that's been repeatedly suggested. Not only that, I also looked at the source and wrote some other code to test the module. I assume, for some reason, that the assumption is that I don't know what I'm talking about.

I know there's some difference in the execution environment, that was what I pointed out already.

That difference is the perl include path. From the command line, as root, the include path has the path /root/perl5/lib/perl5 and cpan from the command line is installing there. That's not the include path being used by webmin of course. When the initial module installation fails in webmin the screen text suggests using cpan from the command line, that probably makes the problem worse for most people.

The original problem is caused by the test suite for Moo failing which I've not debugged yet. The subsequent problems are caused by using cpan. This would appear to explain all the unresolved instances of problems that I found.

incidentally, there's a small problem with webmin-OTP using the lastpass authenticator.

It looks to me that the "issuer" is blank which makes it seem like a duplicate to lastpass with any other OTP accounts for the same username, ie root. The workaround is to use a differently named webmin user but the issuer probably shouldn't be blank.

How does lastpass determine the issuer?

Thank you for this thread!

Why do I feel like these steps below are locked away like Colonel Sanders Recipe??? Took too many Googles to do this... but whateva the future is bleak with this crap.

For people having trouble running the CPAN or MCPAN commands via command line or through the Perl Module manager in Webmin (meaning it fails to install via CPAN so it tried to install via source), you need to first install CPAN:

yum -y install perl-CPAN

Update CPAN if needed.

And the approximate sequence of commands thereafter:

perl -MCPAN -e "install Test::Moose"

perl -MCPAN -e "install Types::Standard"

perl -MCPAN -e "install Moo"

perl -MCPAN -e "install Authen::OATH"

Solution

force install Type::Tiny install Authen::OATH

Ilia's picture
Submitted by Ilia on Wed, 11/18/2020 - 07:33

The right thing would be is to install maximum packages from the default repo, and then build-install Authen::OATH (FYI, it only concerns CentOS, as Debian/Ubuntu and Fedora, already have all needed packages installed from repo (perl-Authen-OATH for Fedora and libauthen-oath-perl for Debian/Ubuntu)).

For CentOS first install the following packages, and then build from Webmin UI needed Authen::OATH module:

yum install perl-Digest-SHA1 perl-Digest-HMAC perl-Moo perl-Test perl-Authen-SASL perl-Math-BigInt perl-Test-Needs perl-Type-Tiny