Eswlnk Blog Eswlnk Blog
  • 资源
    • 精彩视频
    • 破解专区
      • WHMCS
      • WordPress主题
      • WordPress插件
    • 其他分享
    • 极惠VPS
    • PDF资源
  • 关于我
    • 论文阅读
    • 关于本站
    • 通知
    • 左邻右舍
    • 玩物志趣
    • 日志
    • 专题
  • 热议话题
    • 游戏资讯
  • 红黑
    • 渗透分析
    • 攻防对抗
    • 代码发布
  • 自主研发
    • 知识库
    • 插件
      • ToolBox
      • HotSpot AI 热点创作
    • 区块
    • 快乐屋
    • 卡密
  • 乱步
    • 文章榜单
    • 热门标签
  • 问答中心反馈
  • 注册
  • 登录
首页 › 渗透分析 › 「干货分享」一键获取安全可信的HTTPS证书!

「干货分享」一键获取安全可信的HTTPS证书!

Eswlnk的头像
Eswlnk
2023-06-02 14:42:06
「干货分享」一键获取安全可信的HTTPS证书!-Eswlnk Blog
智能摘要 AI
文章介绍了如何使用Certbot获取Let's Encrypt的免费HTTPS证书。过去因认为静态内容无需HTTPS且申请证书麻烦,但现在Certbot简化了这一过程。Certbot是一个ACME客户端,支持通过ACME协议自动化签发证书。准备工作包括申请域名和配置VPS。通过Docker或命令行可一键获取证书,选择认证方式后填写邮件信息并同意服务协议。成功获取证书后需配置在Web服务器中,并定期更新(90天有效期)。更新只需运行`certbot renew`命令。

之前因为觉得都是静态内容,所以没必要用HTTPS。主要是嫌申请HTTPS证书比较麻烦。现在可以使用命令行的certbot非常方便地获取Let’s Encrypt的免费证书。

Certbot简介

Certboot是一个ACME(自动化证书管理环境)客户端,这也是Let’s Encrypt官网推荐的签发证书的方式。它适用于对自己domain具有shell访问能力的情况,使用所谓的ACME协议来自动化地签发证书,很大程度上简化了证书签发的步骤。

「干货分享」一键获取安全可信的HTTPS证书!-Eswlnk Blog

准备工作

HTTPS的证书基于domain签发,所以事先需要准备如下工作:

  • 申请一个domain,例如:example.me.
  • 一台公网能够访问的VPS,将example.me解析为它的IP.

一键运行

可以从Github安装certbot,但文档中也给出了直接用Docker启动的方法,还是非常方便的。以下是示例代码:

Copy Codesudo docker run -it --rm --name certbot -v "/etc/letsencrypt:/etc/letsencrypt" -v "/var/lib/letsencrypt:/var/lib/letsencrypt" -p 80:80 certbot/certbot certonly

其中certonly是获取证书的命令,将80端口映射到本地是为了让ACME server来访问我们的VPS,以验证所有权。

填写信息

如果不加任何参数运行certonly,就会进入以下交互式界面:

Copy CodeSaving debug log to /var/log/letsencrypt/letsencrypt.log

How would you like to authenticate with the ACME CA?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: Runs an HTTP server locally which serves the necessary validation files under
the /.well-known/acme-challenge/ request path. Suitable if there is no HTTP
server already running. HTTP challenge only (wildcards not supported).
(standalone)
2: Saves the necessary validation files to a .well-known/acme-challenge/
directory within the nominated webroot path. A seperate HTTP server must be
running and serving files from the webroot path. HTTP challenge only (wildcards
not supported). (webroot)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate number [1-2] then [enter] (press 'c' to cancel):

选项1是让certbot自己运行HTTP server来通过验证,而选项2则需要我们自己将文件放置在.well-known/acme-challenge/目录下来通过验证。如果不怕自己VPS的web服务中断的话,第1种方式还是比较方便的。

「干货分享」一键获取安全可信的HTTPS证书!-Eswlnk Blog

随后需要填写邮件信息和同意服务协议,如下所示:

Copy CodeEnter email address (used for urgent renewal and security notices)
 (Enter 'c' to cancel): alice@bob.com

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Please read the Terms of Service at
https://letsencrypt.org/documents/LE-SA-v1.3-September-21-2022.pdf. You must
agree in order to register with the ACME server. Do you agree?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o: Y

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Would you be willing, once your first certificate is successfully issued, to
share your email address with the Electronic Frontier Foundation, a founding
partner of the Let's Encrypt project and the non-profit organization that
develops Certbot? We'd like to send you email about our work encrypting the web,
EFF news, campaigns, and ways to support digital freedom.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o: N
Account registered.

接下来可以输入需要签发证书的domain,用逗号或是空格隔开。但不能使用通配符*。Certbot会在本地启动一个HTTP server,然后通知ACME server来访问对应的website,以验证domain的所有权。

Copy CodePlease enter the domain name(s) you would like on your certificate (comma and/or
space separated) (Enter 'c' to cancel): example.me
Requesting a certificate for example.me

Successfully received certificate.
Certificate is saved at: /etc/letsencrypt/live/example.me/fullchain.pem
Key is saved at:         /etc/letsencrypt/live/example.me/privkey.pem
This certificate expires on xxxx-xx-xx.
These files will be updated when the certificate renews.

到这里就签发完毕了,在host的/etc/letsencrypt/live/example.me/目录下就生成证书fullchain.pem和privkey.pem。然后可以将SSL证书配置在自己的web server中。

更新

用这种方式生成的证书有效期是90天,在过期之后需要进行更新(renew)操作。只需要将上述命令certonly改为renew即可,该命令会自动更新/etc/letsencrypt/live/目录下有效期少于30天的证书。

本站默认网盘访问密码:1166
本站默认网盘访问密码:1166
声明:本站原创文章文字版权归本站所有,转载务必注明作者和出处;本站转载文章仅仅代表原作者观点,不代表本站立场,图文版权归原作者所有。如有侵权,请联系我们删除。
SSL安全证书
0
0
Eswlnk的头像
Eswlnk
一个有点倒霉的研究牲站长
赞赏
智能手机指纹破解攻击技术BrutePrint的发现,可能带来哪些危害?如何防范?
上一篇
DCVC2 | 不同于任何其他的 Golang Discord C2
下一篇

评论 (0)

请登录以参与评论
现在登录
    发表评论

猜你喜欢

  • 「漏洞资讯」CVE-2025-12914:宝塔面板曝出注入漏洞
  • 今日热点:伪Clash软件下载陷阱曝光,附防范建议
  • 漏洞资讯:Ollama 未授权访问漏洞分析与防护指南
  • 「攻防对抗」利用 fastjson 原生反序列化与动态代理突破安全限制
  • 「日志记录」从零起步揭开路由器漏洞挖掘的面纱
Eswlnk的头像

Eswlnk

一个有点倒霉的研究牲站长
1108
文章
319
评论
679
获赞

随便看看

「技术教程」免费的Let’s Encrypt证书
2024-01-11 20:20:42
「攻防对抗」利用 fastjson 原生反序列化与动态代理突破安全限制
2025-02-19 18:11:46
「渗透分析」如何防范JS注入?nbcio-boot代码审计攻略大公开
2025-02-07 17:32:55

文章目录

专题展示

WordPress53

工程实践37

热门标签

360 AI API CDN java linux Nginx PDF PHP python SEO Windows WordPress 云服务器 云服务器知识 代码 免费 安全 安卓 工具 开发日志 微信 微软 手机 插件 攻防 攻防对抗 教程 日志 渗透分析 源码 漏洞 电脑 破解 系统 编程 网站优化 网络 网络安全 脚本 苹果 谷歌 软件 运维 逆向
  • 首页
  • 知识库
  • 地图
Copyright © 2023-2025 Eswlnk Blog. Designed by XiaoWu.
本站CDN由 壹盾安全 提供高防CDN安全防护服务
蜀ICP备20002650号-10
页面生成用时 0.933 秒   |  SQL查询 31 次
本站勉强运行:
友情链接: Eswlnk Blog 网站渗透 倦意博客 特资啦!个人资源分享站 祭夜博客 iBAAO壹宝头条
  • WordPress142
  • 网络安全64
  • 漏洞52
  • 软件52
  • 安全48
现在登录
  • 资源
    • 精彩视频
    • 破解专区
      • WHMCS
      • WordPress主题
      • WordPress插件
    • 其他分享
    • 极惠VPS
    • PDF资源
  • 关于我
    • 论文阅读
    • 关于本站
    • 通知
    • 左邻右舍
    • 玩物志趣
    • 日志
    • 专题
  • 热议话题
    • 游戏资讯
  • 红黑
    • 渗透分析
    • 攻防对抗
    • 代码发布
  • 自主研发
    • 知识库
    • 插件
      • ToolBox
      • HotSpot AI 热点创作
    • 区块
    • 快乐屋
    • 卡密
  • 乱步
    • 文章榜单
    • 热门标签
  • 问答中心反馈