加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 运营中心 > Nginx > 正文

Letsencrypt certbot-nginx插件.它是如何工作的?

发布时间:2020-12-13 20:55:48 所属栏目:Nginx 来源:网络整理
导读:我成功使用certbot-nginx插件. 我知道it是开源的,托管在github上. 但是我没有足够的技能来分析此代码. 例如: 我有几个由nginx代理的内部站点.所有virtualhost配置均具有以下匿名访问限制: allow 192.168.1.0/24;allow 192.168.0.0/24;allow 10.88.0.0/16;a

我成功使用certbot-nginx插件.

我知道it是开源的,托管在github上.

但是我没有足够的技能来分析此代码.

例如:

我有几个由nginx代理的内部站点.所有virtualhost配置均具有以下匿名访问限制:

allow 192.168.1.0/24;
allow 192.168.0.0/24;
allow 10.88.0.0/16;
allow 127.0.0.1;
# gate1.example.com
allow X.X.X.X;
# gate2.example.com
allow X.X.X.X;
# other gate's
# .......
deny all;

此访问限制禁止letencrypt服务器以及所有其他未定义的主机.

但是certbot更新–nginx正常执行证书更新.

它是如何工作的 ?

是否安全?

最佳答案
我本人也在问同样的问题,所以我做了一些挖掘,这是我发现的:

Certbot主要使用80或443端口进行质询(http-01和tls-sni-01)以验证域所有权,如certbot docs中所述:

Under the hood,plugins use one of several ACME protocol challenges to
prove you control a domain. The options are http-01 (which uses port
80),tls-sni-01 (port 443) and dns-01 (requiring configuration of a
DNS server on port 53,though that’s often not the same machine as
your webserver). A few plugins support more than one challenge type,
in which case you can choose one with –preferred-challenges.

查看http-01挑战的certbot_nginx plugin implementation,我们可以看到插件编辑了nginx配置,以包括用于执行挑战的其他服务器块:

  def _make_server_block(self,achall):
    """Creates a server block for a challenge.
    :param achall: Annotated HTTP-01 challenge
    :type achall:
        :class:`certbot.achallenges.KeyAuthorizationAnnotatedChallenge`
    :param list addrs: addresses of challenged domain
        :class:`list` of type :class:`~nginx.obj.Addr`
    :returns: server block for the challenge host
    :rtype: list
    """

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读