将公司证书设置为受信任

Enr*_*ent 6 ssl certificates

我的公司给了我一个文件company_CA.crt,我需要用它来访问我们的一个客户网站。

当我尝试在 macOS 上添加它时,我所要做的就是单击该文件,然后在导入后将其设置为“始终信任”。

我想在 Ubuntu 中做同样的事情,所以我按照以下步骤操作:

  • 将 CRT 文件复制到 usr/local/share/ca-certificates/my_company
  • sudo update-ca-certificates

但是我仍然无法打开网站。我错过了一步吗?

Rob*_*che 4

  • 检查您的 customer_web_site 的 CA 根证书在您的系统中是否已知。

    $ curl -I  https://customer_web_site
    curl: (77) Problem with the SSL CA cert (path? access rights?)
    
    Run Code Online (Sandbox Code Playgroud)

customer_web_site 服务器的 CA 证书(实际上)在系统中未知。

文件 company_CA.crt 必须为 CRT 格式。(似乎是在这种情况下)如果是PEM格式,那么你必须转换它(openssl x509 -in xxxx.pem -inform PEM -out xxxx.crt

  • 在 Ubuntu 中安装 CA 文件

将 company_CA.crt 文件复制到 /usr/share/ca-certificates 中的新目录 extra

让 ubuntu 获取新的 CA 证书并将其安装在 Linux 系统中

sudo dpkg-reconfigure ca-certificates
Run Code Online (Sandbox Code Playgroud)

将出现一个菜单。选中“提示每个新 CA 证书”选项“询问”。您将看到您的新证书。

额外/company_CA.crt

按空格键选择新的 CA 证书文件,然后选择“确定”。

u最后,您应该看到类似这样的内容:

添加 1 个,删除 0 个;完毕。在 /etc/ca-certificates/update.d... 中运行挂钩

在不指定CA证书文件的情况下检查curl是否有效

$ curl -I https://customer_web_site
HTTP/1.1 200 OK
Date: Thu, 06 Sep 2018 18:08:26 GMT
Server: Apache/2.4.18 (Ubuntu)
Last-Modified: Fri, 27 Jul 2018 12:09:02 GMT
ETag: "2c39-571f9fa3671da"
Accept-Ranges: bytes
Content-Length: 11321
Vary: Accept-Encoding
Content-Type: text/html
Run Code Online (Sandbox Code Playgroud)

有用。

如果您想了解更多有关自签名证书以及如何使用它们的信息,请查看我的github