差别
这里会显示出您选择的修订版和当前版本之间的差别。
两侧同时换到之前的修订记录前一修订版后一修订版 | 前一修订版 | ||
it:server:security [2023-08-08 14:59] – [ACME 证书] goldentianya | it:server:security [2023-08-08 15:55] (当前版本) – [ACME 证书] goldentianya | ||
---|---|---|---|
行 57: | 行 57: | ||
</ | </ | ||
- | ====== SSL 证书 ====== | ||
- | 利用Cerbot(([[https:// | ||
- | < | ||
- | $ sudo apt install snap | ||
- | $ sudo snap install core; sudo snap refresh core | ||
- | $ sudo snap install --classic certbot | ||
- | $ sudo ln -s / | ||
- | $ sudo certbot --nginx # 应用此证书到Nginx服务器 | ||
- | </ | ||
- | 最后为两个域名生成证书,将这两份证书重新复制到别的主机,应该也可以用。 | ||
- | < | ||
- | Successfully received certificate. | ||
- | Certificate is saved at: / | ||
- | Key is saved at: / | ||
- | This certificate expires on 2021-10-21. | ||
- | These files will be updated when the certificate renews. | ||
- | Certbot has set up a scheduled task to automatically renew this certificate in the background. | ||
- | </ | ||
- | |||
- | 显示当前证书:< | ||
- | 证书的有效期为三个,需要用下面命令定期更新:< | ||
- | %%''</ | ||
- | 或者添加定时任务 <color # | ||
- | 接着到Nginx的conf配置文件中更改证书目录就可以了。 | ||
- | 如果需要迁移的第二台服务器,直接压缩certbot的文件夹就好了。 <color # | ||
- | |||
- | |||
- | 为主域名和下面的子域名申请通配证书 | ||
- | (([[https:// | ||
- | <code bash> | ||
- | certbot certonly | ||
- | # -d 为那些主机申请证书,如果是通配符,输入 *simperator.com | ||
- | # –preferred-challenges dns,使用 DNS 方式校验域名所有权 | ||
- | </ | ||
- | <color # | ||
- | |||
- | 按照指示添加TXT记录,成功后存储在 <color # | ||
- | |||
- | 校验证书: | ||
- | <code bash> | ||
- | openssl x509 -in / | ||
- | </ | ||
- | |||
- | < | ||
- | // 显示证书的起始日期(Not Before)和到期日期(Not After) | ||
- | openssl x509 -in < | ||
- | // < | ||
- | gnutls-cli -V --print-cert < | ||
- | </ | ||
- | |||
- | 为域名更换证书 [[https:// | ||
- | |||
- | 更新邮件地址 | ||
- | <code | download> | ||
- | certbot register --update-registration --email < | ||
- | certbot update_account --email [email protected] | ||
- | </ | ||
- | |||
- | 打开 <color # | ||
- | |||
- | 为每一个子域名配置证书,如 xx.simperator.com,有多少个子网站就重复多少次。Certbot会找到Nginx并正确的配置。 | ||
- | <code bash> | ||
- | certbot --nginx -d fun.simperator.com | ||
- | </ | ||
- | |||
- | |||
- | 端口分配的设置参考[[https:// | ||
- | |||
- | **吊销证书**\\ | ||
- | 严格来说不需要吊销一个证书,除非自己已经对这个域名失去控制。只要删除证书就好,三个月后会自动过期。并且< | ||
- | < | ||
- | certbot delete --cert-name MyDomain | ||
- | </ | ||
- | |||
- | == sslforfree == | ||
- | |||
- | 另外一种申请证书的方式 [[https:// | ||
- | ====== SSL 更新 ====== | ||
- | 更新证书遇到错误: | ||
- | < | ||
- | sudo certbot renew --dry-run | ||
- | |||
- | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
- | Processing / | ||
- | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
- | Failed to renew certificate simperator.com with error: The manual plugin is not working; there may be problems with your existing configuration. | ||
- | The error was: PluginError(' | ||
- | |||
- | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
- | All renewals failed. The following certificates could not be renewed: | ||
- | / | ||
- | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
- | 1 renew failure(s), 0 parse failure(s) | ||
- | Ask for help or search for solutions at https:// | ||
- | </ | ||
- | |||
- | 尝试新的命令 | ||
- | <code | download> | ||
- | certbot certonly --manual -d *.simperator.com | ||
- | </ | ||
- | |||
- | 更新证书后要重启服务器 <color # | ||
- | |||
- | 将 <color # | ||
- | |||
- | 為了防止過多的 TXT 紀錄,以後要刪除舊的紀錄。ionos 1小時, pi server 2小時。 | ||
- | |||
- | buypass TLS 证书可以6个月有效 | ||
- | certbot certonly --standalone --agree-tos -d www.simperator.com -d simperator.com --server https:// | ||
行 233: | 行 124: | ||
查看证书 <wrap em> | 查看证书 <wrap em> | ||
- | < | + | < |
cloudflare 现在已经不支持通过API设置.cf, | cloudflare 现在已经不支持通过API设置.cf, | ||
</ | </ | ||
+ | |||
+ | freenom 的域名以后用CF的源服务器证书就好,10年有效。但 CF 自己的证书不被其它地方认证,无法在后台订阅服务中使用。网站的后台服务如果需要ssl证书,就使用 .com 或者 .eu.org 域名,使用 acme.sh ecc 签署。 | ||
===== cloudflare ===== | ===== cloudflare ===== | ||
- | 托管在 cloudflare 上的域名参考 [[https:// | + | 托管在 cloudflare 上的域名参考 [[https:// |
定时任务更新证书,并重新加载 nginx | 定时任务更新证书,并重新加载 nginx |