Installation and 2FA enablement

SYSTEM INFORMATION
OS: CentOS 7.9 – Vanilla test server (new install fully updated first )
Webmin Version: 1.984

I roughed out some steps. Runs great on CentOS Linux 7.9.2009. Most of this can be put in an .sh script.

Install:

yum -y install perl perl-Net-SSLeay openssl perl-IO-Tty
touch /etc/yum.repos.d/webmin.repo
#
sudo echo -e '[Webmin]
name=Webmin Distribution Neutral
#baseurl=http://download.webmin.com/download/yum
mirrorlist=http://download.webmin.com/download/yum/mirrorlist
enabled=1' > /etc/yum.repos.d/webmin.repo
#
wget http://www.webmin.com/jcameron-key.asc
rpm --import jcameron-key.asc
yum install -y webmin
service webmin start
chkconfig webmin on
firewall-cmd --zone=public --permanent --add-port=10000/tcp
firewall-cmd --zone=public --permanent --add-port=20000/tcp
firewall-cmd --reload
exit

Enabling 2FA:

yum -y group install "Development Tools"        #<=== required for the perl compiler to run
yum -y install perl-CPAN
perl -MCPAN -e "install Test::Moose" #<== This one initially asked a bunch of interactive questions
perl -MCPAN -e "install Types::Standard"
perl -MCPAN -e "install Moo"
perl -MCPAN -e "install Authen::OATH"

Then to enroll the user … they have to log in and basically follow this:
https://devtutorial.io/how-to-install-two-factor-authentication-2fa-for-webmin-p2845.html

My big question is – with the perl -MCPAN -e commands… If I upgrade Webmin, do I run a change of breaking these Perl modules or will Webmin recognize the modules needing to be upgraded and just go out and automatically do the necessary upgrades to the Perl modules commensurate/compatible with the version I might be upgrading to?

Hi,

f I upgrade Webmin, do I run a change of breaking these Perl modules

Webmin doesn’t install anything on its own, only few Perl modules as a dependency (if installed as RPM package).

The better way for enabling 2FA on CentOS 7 and CentOS 8 (which don’t have Authen::OATH available for installation using standard package manager) would be using pre-built, third party repos.

This thread has a solution, and step-by-step tutorial.

Ideally we should build our own perl-Authen-OATH package for CentOS 7/8 but the problem, I think, is that we may need to rebuild tons of other Perl packages/dependencies, and this is one of the main reasons why @Joe hasn’t done it yet.

This is sad as Fedora Server has it available out of the box.

Greetings, thank you for the reply. I guess maybe more to the point. Now that I’ve done my install procedure which works great on centos 7 and is scriptable, once the necessary perl modules are properly installed it seems as if I can check the “Select all” on the perl modules of webmin and they will simply run the commensurate upgrades ( if any ) to the latest version. That’s an assumption and I’m looking for confirmation. In saying that, can it successfully go out and look for an updated version of the perl module and update it automatically through the webmin interface? If so, would there be a recommended best practice? For example, first do a package manager updates such as yum or dnf update and then use webmin to update all perl modules as a best practice? Of course there will be testing done on “test platforms” generally to ensure stability and success. But would this be a good best practice? Will the webmin try and update all listed perl modules if any? Obviously I’ve got the pre requisites installed to download and compile perl modules using the perl -MCPAN -e “install perlmodulename” command. Is that what webmin uses or does it use a different tool? If so I’d like to install whatever would be necessary to facilitate a successful upgrade via the webmin interface versus having to do it from CLI. Thanks everyone! I love webmin/usermin.

Building from source should never be considered over using pre-built packages with package manager.

” on the perl modules of webmin and they will simply run the commensurate upgrades ( if any ) to the latest version.

Building from source almost never goes simply right. The answer is no.

Of course there will be testing done on “test platforms” generally to ensure stability and success.

Do not build from source on production system.

But would this be a good best practice?

It depends on sysadmin’s skill, I suppose. Considering that you’re asking, I wouldn’t recommend building from source and rather suggest finding third-party repos or changed distros that just have those packages shipped (like Debian/Ubuntu/Fedora).

Now that I’ve done my install procedure which works great on centos 7

Please consider not installing CentOS 7 in 2022.

Is that what webmin uses or does it use a different tool?

Webmin uses CPAN, and does nothing on its own.

Just to add. I use CentOS 8 with 2FA enabled. At some point whilst googling I came across above link from Ilia and used that as a base to get it working for 8. It wasnt as straightforward as typing in a few lines and adding some repos. I think I had to clean up some files then do small steps to understand what was not working. Then again on 2 other installs it was smooth sailing and doing it manually was a quick job.

Thanks all for the responses.

Folks, I think I found my best avenue. As you stated; find something that offers your necessary components naively. Ubuntu Server 20.04 does that just fine. I offer my script package – this script in a .sh file name of your choosing; chmod a+x and cd to wherever your file is located. Then ./scriptfile.sh:

echo -e '#Webmin_Repository
deb http://download.webmin.com/download/repository sarge contrib' >> /etc/apt/sources.list
wget http://www.webmin.com/jcameron-key.asc
apt-key add jcameron-key.asc
apt update
apt install -y webmin libauthen-oath-perl libauthen-libwrap-perl
exit

Voila, Webmin and all components for 2FA ready to go. All you need to do is enable afterward.
Hope this helps someone else out.

This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.