Xeo*_*oss 242 certificate ubuntu trusted-root-certificates
我的工作决定颁发他们自己的证书颁发机构(CA) 来安全地处理我们工作的不同方面,而无需支付证书费用。
他们给我发了一个.pem
文件,我不知道如何将它添加到我的 Ubuntu 安装中。发送的说明是:“在 Mac 上双击它应该会安装它。”
我该如何进行?我需要做的东西OpenSSL的创建.key
,.csr
或.crt
文件?
Mar*_*ase 322
将 PEM 格式(其中包含的格式----BEGIN CERTIFICATE----
)的证书复制到其中/usr/local/share/ca-certificates
并使用.crt
文件扩展名命名。
然后运行sudo update-ca-certificates
。
警告:此安装仅影响使用此证书存储的产品。部分产品可能使用其他证书存储;如果您使用这些产品,则还需要将此 CA 证书添加到其他证书存储中。(Firefox 说明、Chrome 说明、Java 说明)
您可以通过查找您刚刚添加的证书来验证这是否有效/etc/ssl/certs/ca-certificates.crt
(这只是您所有受信任 CA 连接在一起的一长串列表)。
您还可以通过尝试连接到您知道使用由您刚刚安装的 CA 签名的证书的服务器来使用 OpenSSL 的 s_client。
$ openssl s_client -connect foo.whatever.com:443 -CApath /etc/ssl/certs
CONNECTED(00000003)
depth=1 C = US, ST = Virginia, O = "Whatever, Inc.", CN = whatever.com, emailAddress = admin@whatever.com
verify return:1
depth=0 C = US, ST = Virginia, L = Arlington, O = "Whatever, Inc.", CN = foo.whatever.com
verify return:1
---
Certificate chain
0 s:/C=US/ST=Virginia/L=Arlington/O=Whatever, Inc./CN=foo.whatever.com
i:/C=US/ST=Virginia/O=Whatever, Inc./CN=whatever.com/emailAddress=admin@whatever.com
... snip lots of output ...
Key-Arg : None
PSK identity: None
PSK identity hint: None
SRP username: None
Start Time: 1392837700
Timeout : 300 (sec)
Verify return code: 0 (ok)
Run Code Online (Sandbox Code Playgroud)
首先要查找的是靠近输出顶部的证书链。这应该将 CA 显示为颁发者(在 旁边i:
)。这告诉您服务器正在提供由您正在安装的 CA 签名的证书。
其次,查找verify return code
要设置为 的末尾0 (ok)
。
Ste*_*day 84
update-ca-certificates is a program that updates the directory /etc/ssl/certs to hold SSL
certificates and generates ca-certificates.crt, a concatenated single-file list of
certificates.
It reads the file /etc/ca-certificates.conf. Each line gives a pathname of a CA
certificate under /usr/share/ca-certificates that should be trusted. Lines that begin
with "#" are comment lines and thus ignored. Lines that begin with "!" are deselected,
causing the deactivation of the CA certificate in question. Certificates must have a .crt
extension in order to be included by update-ca-certificates.
Furthermore all certificates with a .crt extension found below /usr/local/share/ca-
certificates are also included as implicitly trusted.
Run Code Online (Sandbox Code Playgroud)
从上面的,我推断,以获取本地证书文件到受信任的存储的首选方法是将它们放到/usr/local/share/ca-certificates
,然后运行update-ca-certificates
。您不需要/etc/ssl/certs
直接触摸。
Joh*_*ann 21
有关update-ca-certificates
从系统证书存储区读取的应用程序的其他答案是正确的。对于 Chrome 和 Firefox,可能还有其他一些,证书必须放在 nssdb 中,即 Mozilla NSS 库的后端。
从 https://code.google.com/p/chromium/wiki/LinuxCertManagement:
例如,要信任用于颁发 SSL 服务器证书的根 CA 证书,请使用
certutil -d sql:$HOME/.pki/nssdb -A -t "C,," -n <证书昵称> -i <证书文件名>
哪里<certificate nickname>
是任意的,<certificate filename>
是您的 .pem 或 .crt 文件。
其他有用的参考资料:
certutil
手册页,描述了上面使用的参数:https : //developer.mozilla.org/en-US/docs/NSS_reference/NSS_tools_ : _certutilgre*_*uze 16
我有同样的问题,我不得不复制.pem
文件/usr/local/share/ca-certificates
,重命名它.crt
。该.cer
文件可以很容易地转换为.pem
与OpenSSL的,例如,如果你不具备的.pem
。
复制文件后,您必须执行sudo update-ca-certificates
.
小智 13
对于基于 Debian 的较新版本,您可能需要运行:
sudo dpkg-reconfigure ca-certificates
Run Code Online (Sandbox Code Playgroud)
注意: sudo dpkg-reconfigure ca-certificates 在内部调用 update-ca-certificates
在执行任何操作之前,您当然仍需要将证书(.crt 文件)复制到 /usr/share/ca-certificates :)
基于 dwmw2 的回答,您实际上可以告诉使用 NSS 进行证书管理的应用程序使用系统信任存储。
libnss3
默认情况下,附带一组只读的根 CA 证书 ( libnssckbi.so
),因此大多数情况下,您需要自己手动将它们添加到位于$HOME/.pki/nssdb
. p11-kit
提供了一个替代品,libnssckbi.so
它充当安装在/etc/ssl/certs
.
编辑:
似乎有更多版本的libnssckbi.so
out 不仅仅是 in libnss3
。以下是一个脚本,用于查找所有内容、备份它们并用以下链接替换它们p11-kit
:
sudo apt-get update && sudo apt-get install -y p11-kit libnss3
find / -type f -name "libnssckbi.so" 2>/dev/null | while read line; do
sudo mv $line ${line}.bak
sudo ln -s /usr/lib/x86_64-linux-gnu/pkcs11/p11-kit-trust.so $line
done
Run Code Online (Sandbox Code Playgroud)
原始说明:
为此,请安装p11-kit
并libnss3
(如果尚未安装):
sudo apt-get update && sudo apt-get install -y p11-kit libnss3
Run Code Online (Sandbox Code Playgroud)
然后备份现有libnssckbi.so
提供的libnss3
:
sudo mv /usr/lib/x86_64-linux-gnu/nss/libnssckbi.so /usr/lib/x86_64-linux-gnu/nss/libnssckbi.so.bak
Run Code Online (Sandbox Code Playgroud)
最后,创建符号链接:
sudo ln -s /usr/lib/x86_64-linux-gnu/pkcs11/p11-kit-trust.so /usr/lib/x86_64-linux-gnu/nss/libnssckbi.so
Run Code Online (Sandbox Code Playgroud)
要确认它有效,您可以运行ll /usr/lib/x86_64-linux-gnu/nss/libnssckbi.so
,它应该显示链接:
lrwxrwxrwx 1 root root 49 Apr 9 20:28 /usr/lib/x86_64-linux-gnu/nss/libnssckbi.so -> /usr/lib/x86_64-linux-gnu/pkcs11/p11-kit-trust.so
Run Code Online (Sandbox Code Playgroud)
现在,如果您使用 将证书添加到 CA 存储update-ca-certificates
,这些证书现在可用于使用 NSS ( libnss3
) 的应用程序,例如 Chrome。
归档时间: |
|
查看次数: |
618262 次 |
最近记录: |