简体   繁体   English

如何从 pem 或 crt 文件中的链中删除 SHA1 证书

[英]How to remove SHA1 cert from chain in pem or crt file

We are sweeping our environment for Expired SHA-1 certificates in chain.我们正在为链中过期的 SHA-1 证书扫描我们的环境。

We get details of expired SHA1 cert from file with below command,我们使用以下命令从文件中获取过期 SHA1 证书的详细信息,

[root@webserver01~]# openssl x509 -noout -fingerprint -sha1 -enddate -inform pem. -in /etc/web01/ssl/web01_mycompany_com.pem
SHA1 Fingerprint=A2:C0:7F:DF:67:9B:EF:86:39:4E:E4:7B:D0:F8:74:36:74:CA:9F:27
notAfter=Oct  2 23:59:59 2019 GMT

How do I remove this specific expired SHA-1 cert in chain from /etc/web01/ssl/web01_mycompany_com.pem file using CLI.如何使用 CLI 从/etc/web01/ssl/web01_mycompany_com.pem文件中删除此特定的过期 SHA-1 证书链。

So /etc/web01/ssl/web01_mycompany_com.pem file will be updated without SHA-1 cert.因此/etc/web01/ssl/web01_mycompany_com.pem文件将在没有 SHA-1 证书的情况下更新。

I figured it out.我想到了。 I know this is not programming question but I believe this forum is not strictly restricted to programming level questions.我知道这不是编程问题,但我相信这个论坛并不严格限于编程级别的问题。 That is the reason just adding it to answer so if anyone else come across same situation can use this solution.这就是添加它来回答的原因,所以如果其他人遇到同样的情况可以使用这个解决方案。

I used https://www.sslshopper.com/certificate-decoder.html我使用https://www.sslshopper.com/certificate-decoder.html

.pem consists of chain of certificates, We just need to figure it out which one is expire and just remove that. .pem由证书链组成,我们只需要找出哪个过期并删除它即可。

Open that .pem file in your favorite editor and copy each certificate one by one from -----BEGIN CERTIFICATE----- to -----END CERTIFICATE----- and paste in above site.在您喜欢的编辑器中打开该.pem文件并将每个证书从-----BEGIN CERTIFICATE-----复制到-----END CERTIFICATE-----并粘贴到上面的站点。

在此处输入图像描述

It will show the details of certificate.它将显示证书的详细信息。 If current cert which you paste in decoder is not expired then copy next cert in .pem file and check for end date.如果您在解码器中粘贴的当前证书未过期,则将下一个证书复制到.pem文件中并检查结束日期。

Once you find the expired certs, Just remove it.找到过期的证书后,只需将其删除。 Make sure remove it Begin to End.确保将其从开始到结束删除。 Then save file and check again with openssl command.然后保存文件并使用 openssl 命令再次检查。

Note:- make sure take backup prior to change anything in .pem file.注意:- 确保在更改.pem文件中的任何内容之前进行备份。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM