所以我遵循了这个指南: https://docs.splunk.com/Documentation/Splunk/7.1.2/Security/Howtogetthird-partycertificates
在我从 CA 取回新证书之前,一切都很好。我拥有的是他们的 .crt
文件,开头为:
Certificate:
Data:
Version: 3 (0x2)
Serial Number: 51698 (0xc9f2)
Signature Algorithm: sha256WithRSAEncryption
Issuer: <stuff here>
Validity
Not Before: Aug 29 18:35:08 2018 GMT
Not After : Dec 1 18:35:08 2020 GMT
Subject: <stuff here>
Subject Public Key Info:
Public Key Algorithm: rsaEncryption
Public-Key: (2048 bit)
Modulus:
<stuff:here>
Exponent: 65537 (0x10001)
X509v3 extensions:
X509v3 Basic Constraints:
CA:FALSE
X509v3 Extended Key Usage:
TLS Web Server Authentication, TLS Web Client Authentication, E-mail Protection, Time Stamping, Microsoft Individual Code Signing, Microsoft Commercial Code Signing, Microsoft Trust List Signing, Microsoft Encrypted File System
X509v3 Key Usage:
Digital Signature, Non Repudiation, Key Encipherment
X509v3 Subject Alternative Name:
DNS:<<stuff.com>
Signature Algorithm: sha256WithRSAEncryption
<stuff:here>
根据 splunk 站点,这应该是 PEM 格式,因为当我运行他们的 ssl 命令来验证我收到此错误时:
# /opt/splunk/bin/splunk cmd openssl x509 -in SignedCert.crt -text
unable to load certificate
139880334464688:error:0906D06C:PEM routines:PEM_read_bio:no start line:pem_lib.c:707:Expecting: TRUSTED CERTIFICATE
即使我将 crt
文件重命名为 pem
,也会发生同样的事情。
我哪里错了?
最佳答案
你本身没有做错任何事,你需要从 CA 获得你的“PEM”格式的证书,它应该是这样的:
-----BEGIN CERTIFICATE-----
...
-----END CERTIFICATE-----
您可以随意命名,这不会产生任何后果。但是内容应该是这样的。
我会再次建议 SignedCert.crt
因为从语义上讲它是多余的,证书是一个发布 key ,带有元数据和签名。所以它总是被签名的。您应该以与将使用它的服务/网站相关的名称命名它。
当您拥有该格式时,您可以自己执行 openssl x509 -text -in
+ 文件名,如果一切顺利,它确实会产生您在开头的文本输出这个问题。但实际上不可能将该文本输出转换回 PEM。
关于ssl - 证书文件的正确内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52085292/