免费安装网站安全证书


  • administrators

    下面以Ubuntu为例,其他版本,certbot的安装方法有所不同,请放狗搜一下。

    如何安装

    首先加apt-repository

    sudo add-apt-repository ppa:certbot/certbot

    然后,把apt升级一下
    sudo apt update

    记下来就可以安装了
    sudo apt install certbot

    新版certbot(>0.22) 支持通配符,也就是说你可以用,*.j4fun.com 给所有二级域名安装安全证书。Let's encrypt您真是太给力了!

    如果你读到这个教程,说明你用的是新版,这里就不介绍旧版的安装方式了。直接用下面的命令:
    $ sudo certbot certonly --manual -d *.j4fun.com -d j4fun.com --agree-tos --no-bootstrap --manual-public-ip-logging-ok --preferred-challenges dns-01 --server https://acme-v02.api.letsencrypt.org/directory

    注意:虽然用了通配符,主域名不带www的要再加上。

    安装过程中,你会看到类似下面这一段:

    Please deploy a DNS TXT record under the name
    _acme-challenge.asknetsec.com with the following value:

    wlyoW7I6uqfl9GhOc3nvz8Aijy3rRqhfx-Cq88oltcd

    Before continuing, verify the record is deployed.


    Press Enter to Continue

    其目的是要验证这个域名是你的。因此,你要到你的DNS解析供应商那里,增加一条text记录。这条记录的名字(name)是“_acme-challenge”,值(value)是“wlyoW7I6uqfl9GhOc3nvz8Aijy3rRqhfx-Cq88oltcd” (当然你不可以抄我的值,用你的命令行提示)

    注意添加text记录,可能不会立即生效,建议等一分钟,再敲会车键。

    如何更新

    Let's encrypt 的安全证书虽然是免费的,但是有效期只有90天。如果到时不续约,就不能用了。更新也是免费的,就是麻烦了点。按理,更新应该就是一条命令的问题。
    /usr/bin/certbot renew

    但是,运行这条指令,你可能会得到下面的错误信息:

    Cert is due for renewal, auto-renewing...
    Could not choose appropriate plugin: The manual plugin is not working; there may be problems with your existing configuration.
    The error was: PluginError('An authentication script must be provided with --manual-auth-hook when using the manual plugin non-interactively.',)

    这是因为使用通配符,每次更新时text记录的值也要更新,除非你的DNS解析供应商提供API来自动修改text记录,不然只好给自己设个提醒,每80天手动更新一下。也就是把这条命令再run一遍:
    $ sudo certbot certonly --manual -d *.j4fun.com -d j4fun.com --agree-tos --no-bootstrap --manual-public-ip-logging-ok --preferred-challenges dns-01 --server https://acme-v02.api.letsencrypt.org/directory

    如果你有自动更新的好办法,请分享。



  • 如果你在用TLS-SNI-01验证,请立即改用DNS-01或者HTTP-01。本文介绍的是TLS-SNI-01,所以放心使用吧~!

    https://community.letsencrypt.org/t/february-13-2019-end-of-life-for-all-tls-sni-01-validation-support/74209


  • administrators

    今天手动更新,碰到这个错误:

    No module named _cffi_backend

    不知何故,不过容易解决,重新装一箱cffi就可以了:

    For python2.x use following command:

    python -m pip install cffi

    for python3.x

    python3 -m pip install cffi