I was quite surprised today to find that there is no built in facility to export a SSL certificate through WHM/cPanel. We needed to move the certificate to our Windows network from our Linux box and it wasn’t as straightforward as you may think.
Still after a bot of googling we came up with the following steps to create a pfx file which is simple to import into IIS on Windows:
Step 1 – Get the key/crt files
You can grab these two files by going to cPanel > Manage SSL hosts. Just select the domain you are exporting and cPanel will then display the key and certificate (crt) files
Step 2 – Create the files through SSH
Now this part may be un-required but I couldn’t locate the path to the files so I simply logged into SSH as root and entered the following:
[root@host ~]#nano domain.key
Save and exit (CTRL+X confirm save)
Now you need to repeat this for the certificate file as well.
Step 3 – Create the PFX file for export
OK now you have your crt and key files you need to create a pfx file for the export. For this we just use OpenSSL with the command:
[root@host ~]#openssl pkcs12 -export -out /home/pathtodomain/yourdomain.pfx -inkey yourdomain.key -in yourdomain.crt
You will be asked to set a password and also confirm that password. This will create the pfx file in the domain root.
You can download the generated pfx file and import into IIS.