Failed to save two-factor authentication : The Perl module Authen::OATH needed for two-factor authentication is not installed

Hello,
I tried to install two-factor authentication in webmin but I’m getting this error.

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.

I tried to install Perl modules via webmin in Other>Perl modules. I selected google Authenticator and I received an error.
At the end is written:
Installation of Authen::OATH failed. Check the output above and try installing manually.
You can also install the module from CPAN with the command perl -MCPAN -e shell.

I used this guide
https://scunster.co.uk/?p=1411
And I installed, with some dependency problems but at the end I have done it.

yum -y install perl-CPAN

Now, install the following:

perl -MCPAN -e “install Test::Moose”

perl -MCPAN -e “install Types::Standard”

perl -MCPAN -e “install Moo”

perl -MCPAN -e “install Authen::OATH”

I double checked the installation.

[root@localhost download]# yum -y install perl-CPAN

Loaded plugins: fastestmirror

Loading mirror speeds from cached hostfile

Package perl-CPAN-1.9800-294.el7_6.noarch already installed and latest version

Nothing to do

[root@localhost download]# perl -MCPAN -e “install Test::Moose”

Reading ‘/root/.cpan/Metadata’

Database was generated on Sun, 29 Dec 2019 21:41:03 GMT

Fetching with LWP:

http://www.planet-elektronik.de/CPAN/authors/01mailrc.txt.gz

Reading ‘/root/.cpan/sources/authors/01mailrc.txt.gz’

…DONE

Fetching with LWP:

http://www.planet-elektronik.de/CPAN/modules/02packages.details.txt.gz

Reading ‘/root/.cpan/sources/modules/02packages.details.txt.gz’

Database was generated on Wed, 08 Jan 2020 21:55:18 GMT

New CPAN.pm version (v2.27) available.

[Currently running version is v1.9800]

You might want to try

install CPAN

reload cpan

to both upgrade CPAN.pm and run the new version without leaving

the current session.

…DONE

Fetching with LWP:

http://www.planet-elektronik.de/CPAN/modules/03modlist.data.gz

Reading ‘/root/.cpan/sources/modules/03modlist.data.gz’

DONE

Writing /root/.cpan/Metadata

Test::Moose is up to date (2.2012).

[root@localhost download]# install CPAN

install: missing destination file operand after ‘CPAN’

Try ‘install --help’ for more information.

[root@localhost download]# perl -MCPAN -e “install Types::Standard”

Reading ‘/root/.cpan/Metadata’

Database was generated on Wed, 08 Jan 2020 21:55:18 GMT

Types::Standard is up to date (1.008001).

[root@localhost download]# perl -MCPAN -e “install Moo”

Reading ‘/root/.cpan/Metadata’

Database was generated on Wed, 08 Jan 2020 21:55:18 GMT

Moo is up to date (2.003006).

[root@localhost download]# perl -MCPAN -e “install Authen::OATH”

Reading ‘/root/.cpan/Metadata’

Database was generated on Wed, 08 Jan 2020 21:55:18 GMT

Authen::OATH is up to date (2.0.1). >>>> Attention <<<<<

[root@localhost download]#

The thing is that I restarted webmin, and the virtual machine and Im still getting the same error:

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.

How is this possible?
The thing is that I already used this method in another virtual machine and it worked(now this vm is not available)

Thank you
Regards.

Argh. I didn’t realize this dependency didn’t exist in EPEL. Installing from CPAN should always be a last resort, so I’ll see about getting it packaged for CentOS 7 and 8 (CentOS 6 is so old that I doubt it will be reasonable to support).

Hi.
Sorry I don’t won’t what you mean. I’m not a professional sysadmin.
It means is using EPEL dependencies instead of others repos?
It would work if I use other repos?

I tried to install the perl modules in the virtualmin interface and the installation fails.
I even tried to install the suggested modules in Perl modules section but it also fails.
The only way I installed a perl module in my Centos 7 system is via CLI with the commands, that I have written in the first post.

Anyway EPEL is used by virtualmin if I remember well.
Regards.

No, it’s missing from EPEL. Don’t add any other repos.

I’m gonna try to build it and add it to our repos. I don’t know why it never came to my attention that it was usually being installed from CPAN. I would have put a stop to that ages ago.

2 Likes

:exclamation: NOTE: Webmin 2.100 and above have Authen::OATH Perl module bundled in Webmin. There should be no additional steps taken to active 2FA! :exclamation:

Hello Joe.
Let me know when you do it.
Thank you.
Regards.