代码之家  ›  专栏  ›  技术社区  ›  David Welch

Mac OS X-接受自签名多域SSL证书

  •  2
  • David Welch  · 技术社区  · 12 年前

    我有一个用于多个域的自签名证书(比如my.foo.bar.com&yours.foo.bar.com),我已经使用钥匙链访问导入了该证书,但Chrome仍然不接受它,并在每次浏览会话开始时提示我进行验证 每个域 .

    证书是使用x509v3生成的 使用者备选名称 扩展以验证多个域。如果我导航到网站 之前 我导入证书,收到的警告消息与 之后 进口。下面是两个错误的图像(顶部是导入之前的错误)

    enter image description here

    有什么方法可以接受自签名的多域证书吗?我只在Chrome中收到警告,顺便说一句,FF和Safari运行得很好(除了那些浏览器很糟糕;)

    更新:我尝试使用openssl-cli和 xca 图形用户界面

    1 回复  |  直到 11 年前
        1
  •  5
  •   Community CDub    3 年前

    问题是你试图使用一个过于宽泛的通配符( * *.com ).

    规格( RFC 6125 RFC 2818 Section 3.1 )谈论“ 最左边 “标签,这意味着应该有多个标签:

     1.  The client SHOULD NOT attempt to match a presented identifier in
         which the wildcard character comprises a label other than the
         left-most label (e.g., do not match bar.*.example.net).
    
     2.  If the wildcard character is the only character of the left-most
         label in the presented identifier, the client SHOULD NOT compare
         against anything but the left-most label of the reference
         identifier (e.g., *.example.com would match foo.example.com but
         not bar.foo.example.com or example.com).
    

    我不确定是否有一个规范来说明应该有多少最低标签,但 Chromium code 表示必须至少有2个点:

    我们需要至少3个组件(即2个点)作为基本保护 反对过于宽泛的野蛮梳理。

    这确实是为了防止像 *网站 。这可能看起来很不方便,但CA偶尔会犯错误,并且有措施防止潜在的流氓证书颁发给 *网站 上班不一定是件坏事。 如果我没记错的话,有些实现比这更进一步,并且有一个列表域,对于二级域来说也太宽了(例如。 .co.uk ).

    关于第二个例子:“ CN:bar.com,SAN:DNS:my.foo.bar.com,DNS:yours.foo.bar.com “。此证书的有效期应为 my.foo.bar.com yours.foo.bar.com 但不是 bar.com 。当不存在SAN时,CN只是一个后备解决方案。如果有任何SAN,则应忽略CN(尽管有些实现会更宽容)。