Let's Encrypt Failure: AttributeError: 'module' object has no attribute 'pyopenssl'

I made changes about 2 weeks ago to add Ansible to my server as I was planning on using my NethServer as the master Ansible node to setup other machines. This is the only change I can think that I have done recently that might be causing my issues as it did involve adding other versions of python.

Now when I attempt to add a domain to my Let’s Encrypt SSL Certificate or attempt to renew with the existing domains I get the following error (note the error only shows under the Legacy NS environment, the cockpit environment fails but does not show the details of the failure):

Traceback (most recent call last): File “/usr/bin/certbot”, line 9, in <module> load_entry_point(‘certbot==0.31.0’, ‘console_scripts’, ‘certbot’)() File “/usr/lib/python2.7/site-packages/pkg_resources.py”, line 378, in load_entry_point return get_distribution(dist).load_entry_point(group, name) File “/usr/lib/python2.7/site-packages/pkg_resources.py”, line 2566, in load_entry_point return ep.load() File “/usr/lib/python2.7/site-packages/pkg_resources.py”, line 2260, in load entry = import(self.module_name, globals(),globals(), [‘name’]) File “/usr/lib/python2.7/site-packages/certbot/main.py”, line 21, in <module> from certbot import client File “/usr/lib/python2.7/site-packages/certbot/client.py”, line 16, in <module> from acme import client as acme_client File “/usr/lib/python2.7/site-packages/acme/client.py”, line 40, in <module> urllib3.contrib.pyopenssl.inject_into_urllib3() AttributeError: ‘module’ object has no attribute ‘pyopenssl’

Based on someone else’s issues, I tried running the following commands but it did not resolve the issue:

    1. yum install python-pip
    1. pip install --upgrade pip
    1. pip install cryptography --upgrade
    1. certbot --version
    1. certbot renew

I also tried yum reinstall pyOpenSSL, but that did not resolve the issue.

Does anyone have any suggestions?

Try with this commands

yum --enablerepo=nethserver-testing install nethserver-base nethserver-httpd nethserver-letsencrypt
config setprop pki LetsEncrypt enabled

Unfortunately that did not make a difference. I rebooted afterwards and still get the same error.

I went back through the yum history, and these are the changes that have happened. It looks like it the general yum update that made changes that were related. In Yum update 37 below the following

Packages Altered:
Updated certbot-0.29.1-1.el7.noarch @epel
Update 0.30.2-1.el7.noarch @epel

Updated python2-acme-0.29.1-1.el7.noarch @epel
Update 0.30.2-1.el7.noarch @epel
Updated python2-certbot-0.29.1-1.el7.noarch @epel
Update 0.30.2-1.el7.noarch @epel

All recent YUM Updates

Command 33 : yum install ansible

Transaction performed with:

Installed     rpm-4.11.3-35.el7.x86_64                      @anaconda
Installed     yum-3.4.3-161.el7.centos.noarch               @anaconda
Installed     yum-plugin-fastestmirror-1.1.31-50.el7.noarch @anaconda
Packages Altered:
Install     ansible-2.7.7-1.el7.noarch           @epel
Dep-Install libtomcrypt-1.17-26.el7.x86_64       @extras
Dep-Install libtommath-0.42.0-6.el7.x86_64       @extras
Dep-Install python-babel-0.9.6-8.el7.noarch      @base
Dep-Install python-jinja2-2.7.2-2.el7.noarch     @base
Dep-Install python-keyczar-0.71c-2.el7.noarch    @epel
Dep-Install python-markupsafe-0.11-10.el7.x86_64 @base
Dep-Install python2-crypto-2.6.1-15.el7.x86_64   @extras
Dep-Install python2-jmespath-0.9.0-3.el7.noarch  @extras

Command 34 : yum install git -y

Transaction performed with:

Installed     rpm-4.11.3-35.el7.x86_64                      @anaconda
Installed     yum-3.4.3-161.el7.centos.noarch               @anaconda
Installed     yum-plugin-fastestmirror-1.1.31-50.el7.noarch @anaconda
Packages Altered:
Install     git-1.8.3.1-20.el7.x86_64           @updates
Dep-Install perl-Error-1:0.17020-2.el7.noarch   @base
Dep-Install perl-Git-1.8.3.1-20.el7.noarch      @updates
Dep-Install perl-TermReadKey-2.30-20.el7.x86_64 @base

Command 35 : yum remove docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-engine

Transaction performed with:

Installed     rpm-4.11.3-35.el7.x86_64                      @anaconda
Installed     yum-3.4.3-161.el7.centos.noarch               @anaconda
Installed     yum-plugin-fastestmirror-1.1.31-50.el7.noarch @anaconda
Packages Altered:
Erase cockpit-docker-176-4.el7.centos.x86_64                 @extras
Erase docker-2:1.13.1-88.git07f3374.el7.centos.x86_64        @extras
Erase docker-client-2:1.13.1-88.git07f3374.el7.centos.x86_64 @extras
Erase docker-common-2:1.13.1-88.git07f3374.el7.centos.x86_64 @extras
Scriptlet output:

    1 warning: /etc/sysconfig/docker-storage saved as /etc/sysconfig/docker-storage.rpmsave

Command 36 : yum install docker-ce docker-ce-cli containerd.io

Transaction performed with:

Installed     rpm-4.11.3-35.el7.x86_64                      @anaconda
Installed     yum-3.4.3-161.el7.centos.noarch               @anaconda
Installed     yum-plugin-fastestmirror-1.1.31-50.el7.noarch @anaconda
Packages Altered:
Install containerd.io-1.2.2-3.3.el7.x86_64   @docker-ce-stable
Install docker-ce-3:18.09.2-3.el7.x86_64     @docker-ce-stable
Install docker-ce-cli-1:18.09.2-3.el7.x86_64 @docker-ce-stable

Command 37 : yum update

Transaction performed with:

Installed     rpm-4.11.3-35.el7.x86_64                      @anaconda
Installed     yum-3.4.3-161.el7.centos.noarch               @anaconda
Installed     yum-plugin-fastestmirror-1.1.31-50.el7.noarch @anaconda
Packages Altered:
Updated     certbot-0.29.1-1.el7.noarch                               @epel
Update              0.30.2-1.el7.noarch                               @epel
Updated     containers-common-1:0.1.31-7.gitb0b750d.el7.centos.x86_64 @extras
Update                        1:0.1.31-8.gitb0b750d.el7.centos.x86_64 @extras
Updated     distribution-gpg-keys-1.27-1.el7.noarch                   @epel
Update                            1.28-1.el7.noarch                   @epel
Updated     dnf-2.7.5-19.el7_6.noarch                                 @extras
Update          4.0.9.2-1.el7_6.noarch                                @extras
Updated     dnf-data-2.7.5-19.el7_6.noarch                            @extras
Update               4.0.9.2-1.el7_6.noarch                           @extras
Updated     libdnf-0.11.1-4.el7_6.x86_64                              @extras
Update             0.22.5-1.el7_6.x86_64                              @extras
Updated     nethserver-backup-data-1.5.0-1.ns7.noarch                 @nethserver-updates
Update                             1.5.1-1.ns7.noarch                 @nethserver-updates
Updated     nethserver-dnsmasq-1.6.7-1.ns7.noarch                     @nethserver-base
Update                         1.7.0-1.ns7.noarch                     @nethserver-updates
Updated     nethserver-fail2ban-1.1.3-1.ns7.noarch                    @nethserver-updates
Update                          1.1.4-1.ns7.noarch                    @nethserver-updates
Updated     nethserver-nextcloud-1.4.1-1.ns7.noarch                   @nethserver-updates
Update                           1.4.2-1.ns7.noarch                   @nethserver-updates
Updated     nethserver-subscription-3.3.3-1.ns7.noarch                @nethserver-updates
Update                              3.3.4-1.ns7.noarch                @nethserver-updates
Updated     nethserver-subscription-ui-3.3.3-1.ns7.noarch             @nethserver-updates
Update                                 3.3.4-1.ns7.noarch             @nethserver-updates
Updated     nethserver-webtop5-1.2.17-1.ns7.noarch                    @nethserver-updates
Update                         1.2.18-1.ns7.noarch                    @nethserver-updates
Updated     nextcloud-15.0.2-1.el7.noarch                             @nethserver-updates
Update                15.0.4-1.el7.noarch                             @nethserver-updates
Updated     oci-systemd-hook-1:0.1.18-2.git3efe246.el7.x86_64         @extras
Update                       1:0.1.18-3.git8787307.el7_6.x86_64       @extras
Updated     python2-acme-0.29.1-1.el7.noarch                          @epel
Update                   0.30.2-1.el7.noarch                          @epel
Updated     python2-certbot-0.29.1-1.el7.noarch                       @epel
Update                      0.30.2-1.el7.noarch                       @epel
Updated     python2-dnf-2.7.5-19.el7_6.noarch                         @extras
Update                  4.0.9.2-1.el7_6.noarch                        @extras
Updated     python2-hawkey-0.11.1-4.el7_6.x86_64                      @extras
Update                     0.22.5-1.el7_6.x86_64                      @extras
Dep-Install python2-libdnf-0.22.5-1.el7_6.x86_64                      @extras
Updated     webtop5-1.2.10-1.ns7.noarch                               @nethserver-updates
Update              1.2.11-1.ns7.noarch                               @nethserver-updates
Updated     webtop5-webdav-0.1.0-1.ns7.noarch                         @nethserver-updates
Update                     0.1.1-1.ns7.noarch                         @nethserver-updates

Command 38 : yum install python-pip

Transaction performed with:

Installed     rpm-4.11.3-35.el7.x86_64                      @anaconda
Installed     yum-3.4.3-161.el7.centos.noarch               @anaconda
Installed     yum-plugin-fastestmirror-1.1.31-50.el7.noarch @anaconda
Packages Altered:
Install python2-pip-8.1.2-7.el7.noarch @epel