系统相关
首页 > 系统相关> > Letsencrypt certbot-nginx插件.它是如何工作的?

Letsencrypt certbot-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;
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
    """

标签:nginx,certbot,lets-encrypt
来源: https://codeday.me/bug/20191111/2022200.html