如何从OpenSSL保存LDAP SSL证书

问题描述:

我想要我的LDAP服务器(即Novell eDirectory)的SSL证书.我已经使用openssl连接到ldap来查看证书.

I wanted the SSL Certificate of my LDAP Server which is Novell eDirectory. I have used openssl to connect to ldap to view the certificate.

openssl s_client -connect 192.168.1.225:636

它只是打印证书.如何将其保存到某些证书格式文件中?

It is just printing the certificate. How can I save this to some certificate format file?

复制-----BEGIN CERTIFICATE----------END CERTIFICATE-----之间的所有内容(包括这些定界符),并将其粘贴到新的文本文件中(通常使用扩展名.pem.crt).您可以为此使用自己喜欢的(纯文本)文本编辑器,例如记事本,Gedit,Vim,Emacs(取决于您使用的系统).

Copy everything between -----BEGIN CERTIFICATE----- and -----END CERTIFICATE----- (including these delimiters) and paste it in a new text file (usually with the extension .pem or .crt). You can use your favourite (plain) text editor for this, for example Notepad, Gedit, Vim, Emacs (depending on the system you're using).

或者,您也可以按照此处所述,将输出通过管道传输到sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p'. a>:

Alternatively, you can pipe the output to sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p', as described here:

echo -n | openssl s_client -connect 192.168.1.225:636 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > ldapserver.pem