I have a customer who runs Virtualmin on CentOS 5. We’re working on getting him a newer server, but in the mean time we have to make do with what we have. Virtualmin supports LetsEncrypt, but the problem is that there is a syntax error when trying to request a certificate. The reason for this is that CentOS 5 runs an ancient version of Python:
root@server [~]# python -V Python 2.4.3
Installing Python 2.6 on CentOS 5
So, we have to get a newer version of Python installed. The easiest way to do that is to enable the EPEL repo, which has backported software available. So let’s install that:
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-5.noarch.rpm rpm -Uvh epel-release-5*.rpm
Now we can install Python 2.6 and a needed Python module so that the acme_tiny.py script (a vital part of the LetsEncrypt module) can run:
yum -y install python26 python26-argparse
Forcing LetsEncrypt to use Python 2.6
Once that is done, we have to force the LetsEncrypt module to use the “python26” command instead of “python”. For that we’ll have to edit the file:
/usr/libexec/webmin/webmin/letsencrypt-lib.pl
Using your favorite editor, go down to line 118, and change this:
my $out = &backquote_logged( "$python $module_root_directory/acme_tiny.py ".
To this:
my $out = &backquote_logged( "$python26 $module_root_directory/acme_tiny.py ".
You’ll note that the “$python” was changed to “$python26”. No other changes were made.
Now you can go into Virtualmin, Enable SSL for your domain, then under Server Configuration, go to Manage SSL. Then you can request a certificate. This time, it’ll work. Enjoy!