推荐一个制作 https 证书的工具 Certbot

最近一直扎根公司,连续加班,忙于工作,好久没能静下来写写东西了。

刚好前段时间给我同事布置个生成 https 证书的任务,发现很多人都是寻求于阿里云、七牛等国内大厂提供的免费或者付费证书。

但如果这些大厂不提供服务了呢?所以我们有必要自己制作证书。

所以今天给大家推荐一个工具 —— 「certbot」,可以快速生成证书,而且还可以和 apache、nginx 等完美结合使用。

certbot 可以满足常规的软件和服务系统:

certbot

Certbot is an easy-to-use automatic client that fetches and deploys SSL/TLS certificates for your webserver. Certbot was developed by EFF and others as a client for Let’s Encrypt and was previously known as “the official Let’s Encrypt client” or “the Let’s Encrypt Python client.” Certbot will also work with any other CAs that support the ACME protocol.

摘自:certbot.eff.org/about/

简单的说,就是 Let's Encrypt 这个免费、自动化、开放的证书签发服务的客户端工具,是用 Python 开发的。

接下来通过结合 CentOS 7 和 Nginx 环境来说说如何安装使用 certbot。

安装 pyOpenSSL

根据官网 (certbot.eff.org/#centosrhel…) 的步骤来安装 certbot,发现会报 pyOpenSSL 版本低的问题,所以首先需要安装 pyOpenSSL 最新版:

1. 先卸载 pyOpenSSL

sudo yum erase pyOpenSSL
复制代码

2. 在 http://rpm.pbone.net/index.php3/stat/2/simple/2 搜 pyOpenSSL

3. 选择一个下载源下载:

wget ftp://mirror.switch.ch/pool/4/mirror/centos/7.4.1708/cloud/x86_64/openstack-ocata/python2-pyOpenSSL-16.2.0-3.el7.noarch.rpm
复制代码

4. 安装

sudo rpm -Uvh pyOpenSSL-0.15.1-1.el7.noarch.rpm
复制代码

安装 certbot

只要一条命令即可:

sudo yum install certbot certbot-nginx
复制代码

使用 certbot

使用也很方便,只要输入命令,然后根据提示即可:

certbot --nginx
复制代码

然后,让你选择哪个域名需要 https 协议的:

不如所料的成功了:

看看运行效果吧:

最后根据官网的提示,需要做个定时器来时不时 renew 下:

0 0,12 * * * python -c 'import random; import time; time.sleep(random.random() * 3600)' && certbot renew 

复制代码

总结

因为时间关系,没有尝试使用 certbot 的其它功能,但对于如何生成 https 证书的小白来说,我觉得 certbot 提供极大的便利,当然如何自己徒手生成证书,或者使用 Let's Encrypt 生成证书,我相信市面上的教程很多,这里就不再赘述了。

如果你觉得 certbot 还不错,你也可以试试哦~~~

补充

解决Received 1 certificate(s), first certificate had names 的问题

// centos 6.8 的环境下
sudo ./certbot-auto --nginx -d git.***.com 
复制代码

「完」


coding01 期待您继续关注


也很感谢您能看到这了

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值