IT博客汇
  • 首页
  • 精华
  • 技术
  • 设计
  • 资讯
  • 扯淡
  • 权利声明
  • 登录 注册

    【原创】树莓派3安装免费HTTPS证书

    leeon | 分享未来发表于 2017-02-04 10:17:22
    love 0

        自从家里的电信ADSL好几年前封锁80端口后,http服务已经不能用来作为公网服务直接访问了,但是电信对443端口并没有屏蔽,我们可以通过配置https服务来提供公网服务。最近炒的火热的Let's Encrypt免费CA服务提供商,刚好趁着苹果强制ATS的东风横空出世,得益于Mozilla的支持将免费SSL证书全民普及的概念广而告之,自从去年沃通的免费证书关停等等一系列免费的ssl证书被停止服务,这证书刚好拿来耍耍,体验一下。

       使用Let's Encrypt的免费ssl需要安装官方提供的certbot脚本,这个脚本需要安装树莓派的backports源,我们需要增加对backports源的支持。

    修改/et/apt/sources.list文件,在末尾添加

    deb http://ftp.debian.org/debian/ jessie-backports main contrib non-free

    然后还需要安装debian-keyring,debian-archive-keyring 两个包才能正常,否则在添加backports源后会提示

    W: GPG error: http://ftp.debian.org jessie-backports InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 8B48AD6246925553 NO_PUBKEY 7638D0442B90D010


    执行如上步骤后,最后执行一次apt update来更新源。

    接着我们就可以按照官方提供的文档进行操作了。

    [code="bash"]
    $ sudo apt-get install certbot -t jessie-backports
    [/code]

    安装certbot工具包成功后,如果想单独生成ssl证书,使用standalone模式即可。certbot也提供了集中不同的生成模式:

    Plugin Auth Inst Notes Challenge types (and port)
    apache Y Y
    Automates obtaining and installing a cert with Apache 2.4 on
    Debian-based distributions with libaugeas0 1.0+.
    tls-sni-01 (443)
    webroot Y N
    Obtains a cert by writing to the webroot directory of an
    already running webserver.
    http-01 (80)
    nginx Y Y
    Automates obtaining and installing a cert with Nginx. Alpha
    release shipped with Certbot 0.9.0.
    tls-sni-01 (443)
    standalone Y N
    Uses a “standalone” webserver to obtain a cert. Requires
    port 80 or 443 to be available. This is useful on systems
    with no webserver, or when direct integration with the local
    webserver is not supported or not desired.
    http-01 (80) or tls-sni-01 (443)
    manual Y N
    Helps you obtain a cert by giving you instructions to perform
    domain validation yourself.
    http-01 (80) or dns-01 (53)
    certbot生成的证书会存在在/etc/letsencrypt/live/(设置证书时绑定的域名目录)下。Let’s Encrypt CA证书仅提供90天有效期,故在此过期时间之前需要定期重新生成一次证书。

    在执行certbot renew命令时候程序会自动判断是否过期,但我们可以通过添加--dry-run命令来模拟生成新证书。

    certbot renew --dry-run 



沪ICP备19023445号-2号
友情链接