放慢了步伐,只为跑得更远~

0%

免费的SSL证书Let's Encrypt的安装与使用

前言

免费的SSL证书Let’s Encrypt的安装与使用,极大的推进更多的服务器使用商特别是个体用户拥抱SSL这个大集体中,让数据的传输不再赤裸裸的暴露在开发人员中,从而保障用户个人隐私的安全和可靠.

安装证书

关于SSL证书的安装在网上也由很多的各种不同版本,但我这里介绍一个可以在站点上自动部署SSL证书的工具certbot,该网站根据服务器不同的操作系统提供不同的安装教程.安装教程也很简单,只需要简单几个步骤就可以做好,具体的安装教程这边不做赘述.

1
2
3
4
5
6
7
# If you are using ec2 you can enable optional channel by running:
$ yum -y install yum-utils
$ yum-config-manager --enable rhui-REGION-rhel-server-extras rhui-REGION-rhel-server-optional
# After doing this, you can install Certbot by running:
$ sudo yum install certbot
# use the certonly command to obtain your certificate
$ certbot certonly --webroot -w /var/www/example -d example.com -d www.example.com -w /var/www/thing -d thing.is -d m.thing.is

自动续期

Let’s Encrypt SSL证书投入使用之后默认的有效期是90天,之后就自动过期需要重新更新证书使之生效即可.不过Let’s Encrypt会根据你注册的邮箱,在证书即将到期的前20天,10天,1天这三个时间点会邮件通知用户到期要更新证书以防证书到期对站点带来的不便[详情.].不过这个邮件提醒想必也是多余,证书即将到期只要我们定期更新就不会有这要的麻烦.certbot 官网教程也提供我们到期更新证书的方案,只要在定时任务中添加每隔90天自动更新,就可以让我们的证书永久自动续签.

  • 官网教程提供的自动更新机制是一个很好的方案,但官方也指出更新证书是有次数限制.目前是一周5次[详情.].如果更新次数太过频繁,官方会以为恶意行为而停止更新服务.
1
2
3
4
# You can test automatic renewal for your certificates by running this command:
certbot renew --dry-run
# If that appears to be working correctly, you can arrange for automatic renewal by adding a cron or systemd job which runs the following:
certbot renew

防火墙开放端口

1
firewall-cmd --zone=public --add-port=80/tcp --permanent

未完待续

关于免费的安全证书的安装教程也只是个简单的教程,希望以后抓紧时间多研究下官网教程以提供更加丰富的功能.

总结

免费的SSL证书极大的方便个人独立开发者,推动了全球数据加密与安全.

参考资料

how to install ssl certbot
letsencrypt证书自动续期问题
linux centos防火墙添加443例外端口
Centos7 开放端口
为阿里云ECS配置ipv6隧道地址
ipv6测试站

-------------本文结束感谢您的阅读-------------