• Please be aware: Kaspersky Anti-Virus has been deprecated
    With the upgrade to Plesk Obsidian 18.0.64, "Kaspersky Anti-Virus for Servers" will be automatically removed from the servers it is installed on. We recommend that you migrate to Sophos Anti-Virus for Servers.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Resolved certificate.exe command line issue with Private key

WindowsSysadmin

New Pleskian
Hi Team,

I'm having a spot of trouble using the command line option to import a certificate into plesk:

PS C:\Program Files (x86)\Plesk\bin> .\certificate.exe --create "star.mycertificate.co.nz_2018" -admin -default -key-file $keyfile -cert-file $certfile -cacert-file $intermediaryfile
Unable to create certificate "star.mycertificate.co.nz_2018": Unable to set the private key: Probably, the private key format is invalid.

PS C:\Program Files (x86)\Plesk\bin> $keyfile
c:\pleskinstaller\star.mycertificate.co.nz.key

My Private Key looks like this:

-----BEGIN RSA PRIVATE KEY-----
myprivatekeydata
-----END RSA PRIVATE KEY-----

Now, I've deleted and re-created the file using various notepad editors and copied the Private key carefully. So to test - I opened up the Plesk Panel, opened my star.mycertificate.co.nz.key file - Ctrl-A, Ctrl-C, and pasted that directly into the Plesk Panel (along with the Cert and CA cert) - hit upload and hey presto! the Certificate is imported successfully. Seeing as the same data is parsed successfully by the Panel and imported without error, this leads me to believe there is a bug in the certificate.exe CLI option.

OS is Windows Server 2016 - the commands above are being invoked from within a Powershell Session, however I have been using a Powershell Session to leverage the other Plesk CLI utilities for Windows without issue.

Can you please advise?
 
Bump - Anyone?

I should also note that the Certificate is a wildcard cert so *.domainname.co.nz

If there is a log that you can point me to, where a more detailed error message is, that would also be helpful
 
So this is partially solved - it seems that the default encoding format for Powershell out-file is unicode. Plesk seems to throw it's toys out the cot unless the format is ASCII

In which case, it would be nice if the parser checked the encoding format and outputted an error that was a little bit more helpful
 
Back
Top