Install certificate .CER.PEM Linux Centos7

Asked

Viewed 1,817 times

0

I need to install a certificate for a webservice in Apache (Centos7). The files you sent us are these:

xxx.cer.pem

xxx.pfx

Can anyone tell me how I install these certificates ? Thank you!

1 answer

1

As stated in Soen you first need to convert pfx to be supported in apache, using openssl.

First install it (if not installed):

yum install openssl

Navigate to the folder where the xxxx.pfx and then in the terminal use the following commands to convert the certificate:

openssl pkcs12 -in xxxx.pfx -clcerts -nokeys -out xxxx.cer
openssl pkcs12 -in xxxx.pfx -nocerts -nodes  -out xxxx.key

Then look for the file in the apache folder called host.conf or ssl.conf (or maybe it’s all inside httpd.conf) and look for the <VirtualHost> desired, in the case the HOST should preferably have the gate 443 for example <VirtualHost *:443> (certified for all hosts), so you should point out the location of the file. cer no SSLCertificateFile and point out the location of . key in the SSLCertificateKeyFile

An example would be:

<VirtualHost 192.168.0.1:443>
 ...
 SSLEngine on
 SSLCertificateFile /caminho/para/xxxx.cer
 SSLCertificateKeyFile /caminho/para/xxxx.key
 ...
</VirtualHost>

Note: If the SSL flags must be inside a Virtualhost that is HTTPS, doing it on the wrong host will give problem, a wrong example:

<VirtualHost 192.168.0.1:80>
...
SSLEngine on
SSLCertificateFile /caminho/para/xxxx.cer
SSLCertificateKeyFile /caminho/para/xxxx.key

The SSL module must be enabled:

LoadModule ssl_module modules/mod_ssl.so

Then just reset the Apache

  • Dear William. Thank you for the contact. After making these changes, the access was only made by HTTPS. But we need the access to remain at HTTP. This certificate I want to install, is for our webservice connect on another external webservice. The Certificate in question was issued by the external website.

  • @Ricardopardimclaus then you touched something else, note that the example is like this <VirtualHost 192.168.0.1:443>, the 443 indicates port to HTTPS, if you have not put in the correct virtualhost will occur even problems.

  • @Ricardopardimclaus have you seen my last edition of the answer? I put the explanation of the use of VirtualHost, see if it helps you.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.