IT基础设施:在CentOS7中为nginx布署免费SSL证书

简介: 前言此前在阿里申请了免费的SSL证书,但每个人只有20个证书的额度,此额度是一次性、永久性的,也就是说,到期的证书也算;由于各种各样的原因,我的测试额度已经满了。

前言

此前在阿里申请了免费的SSL证书,但每个人只有20个证书的额度,此额度是一次性、永久性的,也就是说,到期的证书也算;由于各种各样的原因,我的测试额度已经满了。于是转粉腾讯云,结果腾讯这边直接审核不通过,顿时心凉;猛然间想起咱们还有Let's Encrypt's,立马感觉生活又有了希望。

img_71a68b83b7f6d74f2270671c1ecc4025.png
我一域名咋就不安全啦

Let's Encrypt's 介绍

Let’s Encrypt is a free, automated, and open certificate authority (CA), run for the public’s benefit. It is a service provided by the Internet Security Research Group (ISRG).

Let's Encrypt's 是一个免费,自动化和开放的证书颁发机构(CA),为公众的利益而运行。它是由Internet Security Research Group(ISRG)提供的服务。

We give people the digital certificates they need in order to enable HTTPS (SSL/TLS) for websites, for free, in the most user-friendly way we can. We do this because we want to create a more secure and privacy-respecting Web.

我们免费为人们提供数字证书,以帮助他们为网站启用HTTPS,使得他们的网站能更加的安全,数据的隐私能更加有效地得到保护。

The key principles behind Let’s Encrypt are:

  • Free: Anyone who owns a domain name can use Let’s Encrypt to obtain a trusted certificate at zero cost.
  • Automatic: Software running on a web server can interact with Let’s Encrypt to painlessly obtain a certificate, securely configure it for use, and automatically take care of renewal.
  • Secure: Let’s Encrypt will serve as a platform for advancing TLS security best practices, both on the CA side and by helping site operators properly secure their servers.
  • Transparent: All certificates issued or revoked will be publicly recorded and available for anyone to inspect.
  • Open: The automatic issuance and renewal protocol will be published as an open standard that others can adopt.
  • Cooperative: Much like the underlying Internet protocols themselves, Let’s Encrypt is a joint effort to benefit the community, beyond the control of any one organization.

我们的主旨是:免费、自动化、安全、透明、开放、合作

Certbot

Certbot是Let's Encrypt CA(或任何其他讲ACME协议的CA)的全功能,可扩展的客户端,可以自动完成获取证书和配置Web服务器以使用它们的任务。此客户端在基于Unix的操作系统上运行。

安装

Certbot打包在EPEL(企业Linux的额外包)中。 要使用Certbot,必须先启用EPEL存储库。 在RHEL或Oracle Linux上,还必须启用可选通道。

yum -y install yum-utils
yum-config-manager --enable rhui-REGION-rhel-server-extras rhui-REGION-rhel-server-optional

安装certbot的nginx版插件

yum install python2-certbot-nginx

自动识别nginx配置文件中的域名,一步步获取证书,并自动修改配置文件

certbot --nginx

如果不希望修改配置文件,而只是获取证书可以使用下面这个命令

certbot --nginx certonly

自动续期

可以将Certbot配置为在证书过期之前自动续订证书。 由于Let's Encrypt证书持续90天,因此最好利用此功能。 您可以通过运行以下命令来测试证书的自动续订:

certbot renew --dry-run

如果这看起来工作正常,您可以通过添加运行以下命令的cron作业或systemd计时器来安排自动续订:

certbot renew

如果您正在设置cron或systemd作业,我们建议每天运行两次(在您的证书到期或续订之前,它将不会执行任何操作,但定期运行它会使您的站点有机会保持在线状态 案例a由于某种原因,我们发生了加密启动的撤销。 请在一小时内随机选择续订任务。

一个示例cron作业可能看起来像这样,它将在每天中午和午夜运行:

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

引用

1.certbot on github
2.Certbot Installation Guide

相关文章
|
2天前
|
算法 小程序 网络安全
阿里云WoSign SSL证书,RSA和国密有什么区别?_沃通SSL技术文档
阿里云WoSign品牌SSL证书为用户提供国密合规SM2算法SSL证书、全球信任RSA算法SSL证书,全球信任、国密合规,能够满足阿里云平台用户不同的SSL证书应用需求。那么阿里云WoSign SSL证书分别提供的RSA算法和国密算法,有什么区别呢?
21 5
|
2天前
|
Web App开发 算法 安全
什么是阿里云WoSign SSL证书?_沃通SSL技术文档
WoSign品牌SSL证书由阿里云平台SSL证书合作伙伴沃通CA提供,上线阿里云平台以来,成为阿里云平台热销的国产品牌证书产品。
14 2
|
10天前
|
存储 网络协议 网络安全
|
16天前
|
安全 应用服务中间件 Shell
nginx配置https的ssl证书和域名
nginx配置https的ssl证书和域名
|
18天前
|
应用服务中间件 nginx
nginx反向代理与证书设置
nginx反向代理与证书设置
30 3
|
1月前
|
运维 安全 数据建模
阿里云SSL证书收费版和免费版SSL有什么区别?全方位对比
阿里云提供免费和个人测试(Pro)及正式版SSL证书。免费版有效期仅3个月,适合个人网站或测试使用;个人测试(Pro)版68元/年,有效期12个月;正式版价格数百至数千元不等,有效期至少1年,支持DV、OV、EV证书类型,具有高安全等级、良好兼容性、稳定OCSP验证、SLA保障及安全保险赔付等优势,并提供最长3年的服务周期与人工客服支持。详情与报价参见SSL官方页面。
276 20
|
6天前
|
网络安全
阿里云国际版如何为SSL证书更换域名?
阿里云国际版如何为SSL证书更换域名?
|
16天前
|
应用服务中间件 网络安全 nginx
nginx如何代理ssl
nginx如何代理ssl
|
17天前
|
安全 应用服务中间件 网络安全
Nginx入门 -- 了解Nginx中证书配置
Nginx入门 -- 了解Nginx中证书配置
21 0
|
1月前
|
运维 安全 数据建模
阿里云免费SSL证书和收费版SSL证书有什么区别?
阿里云提供免费与收费SSL证书,前者有效期仅3个月,适合个人网站或测试使用;后者有效期至少1年,具备更高安全等级、良好兼容性及OCSP验证稳定性等优势,适用于企业网站,尤其政府、金融等领域建议选用OV或EV型证书以确保数据与身份认证安全。详细了解与报价请访问SSL证书官方页面。
253 2