码迷,mamicode.com
首页 > 其他好文 > 详细

install certbot after updated portage

时间:2019-02-22 12:14:51      阅读:274      评论:0      收藏:0      [点我收藏+]

标签:plugin   script   support   pac   missing   and   json   tab   select   

运行的时候一直报如下的错误:

sudo certbot 

  

错误结果:

Traceback (most recent call last):
  File "/usr/lib/python-exec/python2.7/certbot", line 11, in <module>
    load_entry_point(‘certbot==0.30.1‘, ‘console_scripts‘, ‘certbot‘)()
  File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 487, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2728, in load_entry_point
    return ep.load()
  File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2346, in load
    return self.resolve()
  File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2352, in resolve
    module = __import__(self.module_name, fromlist=[‘__name__‘], level=0)
  File "/usr/lib/python2.7/site-packages/certbot/main.py", line 10, in <module>
    import josepy as jose
  File "/usr/lib/python2.7/site-packages/josepy/__init__.py", line 44, in <module>
    from josepy.interfaces import JSONDeSerializable
  File "/usr/lib/python2.7/site-packages/josepy/interfaces.py", line 8, in <module>
    from josepy import errors, util
  File "/usr/lib/python2.7/site-packages/josepy/util.py", line 4, in <module>
    import OpenSSL
  File "/usr/lib/python2.7/site-packages/OpenSSL/__init__.py", line 8, in <module>
    from OpenSSL import crypto, SSL
  File "/usr/lib/python2.7/site-packages/OpenSSL/crypto.py", line 16, in <module>
    from OpenSSL._util import (
  File "/usr/lib/python2.7/site-packages/OpenSSL/_util.py", line 6, in <module>
    from cryptography.hazmat.bindings.openssl.binding import Binding
  File "/usr/lib/python2.7/site-packages/cryptography/hazmat/bindings/openssl/binding.py", line 13, in <module>
    from cryptography.hazmat.bindings._openssl import ffi, lib
ImportError: /usr/lib/python2.7/site-packages/cryptography/hazmat/bindings/_openssl.so: undefined symbol: X509_get_signature_nid

  

搜索一圈无果

试图删除 cryptography 之后重新安装还是没用。

于是想到是不是因为openssl太旧了。

更新下

sudo emerge -u dev-libs/openssl

  

重新安装certbot, 

sudo emerge -av app-crypt/certbot app-crypt/certbot-nginx

  

再次运行 

sudo certbot --nginx

 

结果如下:

 

Saving debug log to /var/log/letsencrypt/letsencrypt.log
The nginx plugin is not working; there may be problems with your existing configuration.
The error was: NoInstallationError("Could not find a usable ‘nginx‘ binary. Ensure nginx exists, the binary is executable, and your PATH is set correctly.",)

  

恩,虽然没成功,但是没有代码错误了

 

以上错误是因为 nginx 没有放到环境变量中去,我系统的真正的nginx在/opt/nginx/sbin/nginx,于是我做了个软链接。

sudo ln -s /opt/nginx/sbin/nginx /usr/local/bin/nginx

  

再次执行命令 

sudo certbot --nginx

 

得到结果:

Saving debug log to /var/log/letsencrypt/letsencrypt.log
The nginx plugin is not working; there may be problems with your existing configuration.
The error was: PluginError(‘Nginx build is missing SSL module (--with-http_ssl_module).‘,)

 

查看nginx版本

 

$ nginx -V

结果:
nginx version: nginx/1.6.3
built by gcc 4.8.4 (Gentoo 4.8.4 p1.5, pie-0.6.1) 
configure arguments: --prefix=/opt/nginx --with-http_geoip_module --add-module=/usr/src/passenger-4.0.53/ext/nginx

 

果然是没有ssl模块!

决定rebuild下nginx with ssl

下载nginx,我之前有下载过1.6.2还保留在那,于是直接进目录重新build。运行下面命令的时候最好用root权限

./configure --prefix=/opt/nginx --with-http_ssl_module --with-http_gzip_static_module --with-http_stub_status_module --with-cc-opt=-Wno-error --with-http_geoip_module --add-module=/usr/src/passenger-4.0.53/ext/nginx
make && make install

 

完成, 再检查一次nginx版本,已经加上了ssl模块

$ nginx -V
结果: nginx version: nginx/1.6.2 built by gcc 5.4.0 (Gentoo 5.4.0-r3 p1.3, pie-0.6.5) TLS SNI support enabled configure arguments: --prefix=/opt/nginx --with-http_ssl_module --with-http_gzip_static_module --with-http_stub_status_module --with-cc-opt=-Wno-error --with-http_geoip_module --add-module=/usr/src/passenger-4.0.53/ext/nginx

 

返回最初的certbot命令再来一次, 提示我去做设置了,成功在即!

$ sudo certbot --nginx
Password: 
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator nginx, Installer nginx
Enter email address (used for urgent renewal and security notices) (Enter ‘c‘ to
cancel): 

  

跟着提示填上email,选择需要activate HTTPS 的域名。至此nginx配置成功

  

 

install certbot after updated portage

标签:plugin   script   support   pac   missing   and   json   tab   select   

原文地址:https://www.cnblogs.com/amanda-meng/p/10417315.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!