The operation problem of certbot applying for SSL certificate under centos7

Keywords: pip OpenSSL SSL Attribute


About three months ago, we applied for SSL certificate through let s encrypt. Now it's almost the same time. When we boarded the server, we were going to run the certificate update program, but there was a problem when we executed it:

The version of pyOpenSSl is too low. According to some practices on the Internet, we uninstall the lower version of pyOpenSSl, and reinstall the latest version of pyOpenSSl. However, the execution of certbot certificates again still appears:

  File "/usr/lib/python2.7/site-packages/acme/jose/", line 9, in <module>
    from acme.jose import util
  File "/usr/lib/python2.7/site-packages/acme/jose/", line 5, in <module>
    import OpenSSL
  File "/usr/lib/python2.7/site-packages/OpenSSL/", line 8, in <module>
    from OpenSSL import rand, crypto, SSL
  File "/usr/lib/python2.7/site-packages/OpenSSL/", line 118, in <module>
AttributeError: 'module' object has no attribute 'SSL_ST_INIT'

The following reasons are found on the Internet. It seems that Alibaba cloud server is the problem. Other servers don't have this situation, and there are various online solutions. Here, the method of reinstallation before complete uninstallation is adopted:

[root@oldpan etc]# pip uninstall certbot

Previously, I used pip to install, so I used pip to uninstall. If I used apt or rpm to install, I need the corresponding uninstall command.

[root@oldpan etc]# pip install certbot
[root@oldpan etc]# certbot certificates
Traceback (most recent call last):
  File "/usr/bin/certbot", line 7, in <module>
    from certbot.main import main
  File "/usr/lib/python2.7/site-packages/certbot/", line 11, in <module>
    from acme import jose

[root@oldpan etc]# pip uninstall acme
Uninstalling acme-0.20.0:
Proceed (y/n)? y
  Successfully uninstalled acme-0.20.0

[root@oldpan etc]# pip install acme
/usr/lib/python2.7/site-packages (from cffi>=1.7; platform_python_
implementation != "PyPy"->cryptography>=0.8->acme)
Installing collected packages: acme
Successfully installed acme-0.20.0

[root@oldpan etc]# certbot certificates
/usr/lib/python2.7/site-packages/requests/ RequestsDependencyWarning: urllib3 (1.22) or chardet
 (2.2.1) doesn't match a supported version!
Saving debug log to /var/log/letsencrypt/letsencrypt.log

Found the following certs:
  Certificate Name:
    Expiry Date: 2018-01-19 04:08:01+00:00 (VALID: 6 days)
    Certificate Path: /etc/letsencrypt/live/
    Private Key Path: /etc/letsencrypt/live/

It's OK to verify again. Note that port 80 is required to communicate with the intermediate server when the certificate is reactivated. If the website is not allowed to run at this time, it's OK to temporarily close the website, update the certificate, and then open the website.

Posted by tomas.srna on Sun, 03 May 2020 15:32:32 -0700