在 Ubuntu 上使用 Firefox 59 的自签名 *.dev 证书不受信任

Self-signed *.dev cert untrusted using Firefox 59 on Ubuntu

我在 Ubuntu 上使用 Firefox 59.0.1,在访问我的开发环境时看到以下错误,该环境位于自签名 SSL 证书之后。

Your connection is not secure

The owner of crmpicco.dev has configured their website improperly. To protect your information from being stolen, Firefox has not connected to this website.

This site uses HTTP Strict Transport Security (HSTS) to specify that Firefox may only connect to it securely. As a result, it is not possible to add an exception for this certificate.

Learn more…

Report errors like this to help Mozilla identify and block malicious sites

crmpicco.dev uses an invalid security certificate.

The certificate is not trusted because it is self-signed.

Error code: SEC_ERROR_UNKNOWN_ISSUER

我已将 "crmpicco.dev" 添加到 security.tls.insecure_fallback_hosts 并将 security.enterprise_roots.enabled 设置为 true,重新启动 Firefox 但没有效果。

我知道 Chrome 有他们的 "badidea"/"thisisnotsafe" 解决方法,我知道这不是理想的但它至少有效 - 而我还没有找到等效的 Firefox。

解决这个问题的方法是什么?即使我拥有的证书是从 2018 年 2 月开始的,我是否需要生成新的自签名证书。

我已经尝试了这里的许多问题和 Mozilla 支持没有效果。

顶级域 *.dev 是 owned by Google. For some time already Chrome 中有一个 pre-configured HSTS 策略,这使得无法为该域使用 self-signed 证书. Firefox 最近也添加了这样的策略,因此您现在可以得到相同的行为。

有几种方法可以解决这个问题。最好的方法是不要将任何当前 public 或未来 public 的顶级域用于您的私人目的。通过使用此类域,您可能会与域所有者强制执行的使用策略发生冲突,例如在 *.dev 的情况下强制执行 HSTS。此外,它甚至可能导致 security problems。而是使用您实际拥有的域或使用保留供内部和测试使用的顶级域,例如 *.test、*.invalid 或 *.example.

如果你真的想在内部使用 *.dev(再次,坏主意)你可以按照这个域的策略来做到这一点:不要使用 self-signed 证书,但使用由您的浏览器信任的 CA。这意味着创建您自己的 CA,将其添加为受信任的浏览器,然后由该 CA 颁发您想要的证书。但是同样,使用不属于您的 public 个域(无论 top-level 与否)都是麻烦的收据。