Applicable to:
- Plesk for Linux
- Plesk for Windows
Question
How to use a command-line utility to manage certificates in Plesk?
Answer
The certificate
command utility allows managing client certificates through CLI. This utility allows you to perform the following tasks:
Creating:
# plesk bin certificate --create "Site Certificate" -domain example.com -key-file /usr/local/keyfile.key -cert-file /usr/local/cert/certfile.cert
Note: Where keyfile.key
is the private key and certfile.cert
is the file of the certificate.
Removing:
# plesk bin certificate --remove "Site Certificate" -domain example.com
Assigning to the IP address 203.0.113.2:
# plesk bin certificate --assign-cert "Site Certificate" -admin -ip 203.0.113.2
For instance, renaming of a certificate:
# plesk bin certificate --update "Site Certificate" -domain example.com -new-name "New Certificate"
To see all available parameters, run the following:
# plesk bin certificate --help
Additional information about the utility is available in the documentation.
Note: On Linux systems, SSL certificates for Plesk are located in /usr/local/psa/var/certificates/
Additional Information
Securing Plesk and the Mail Server With SSL/TLS Certificates
Comments
4 comments
plesk bin certificate --assign-cert "Site Certificate" -admin example.com -ip 192.0.2.78
Should be -domain instead of -admin?
plesk bin certificate --assign-cert "Site Certificate" -domain example.com -ip 192.0.2.78
Hello Unknown User,
I would like to say that the certificate is taken from the Administrator's repository in this case. This is why it is needed to use -admin
The details might be found in the documentation.
You might think that, but the result of running that command gives output like this message with the bold domain name in red:
$ plesk bin certificate --assign-cert "Lets Encrypt certificate" -admin example.com -ip 192.0.2.78
[2023-06-05 07:42:36.314] 2095:647de64c4c81d DEBUG [util_exec] [647de64c4c70c] Starting: filwrpr 74, stdin:
[2023-06-05 07:42:36.327] 2095:647de64c4c81d DEBUG [util_exec] [647de64c4c70c] Finished in 0.01108s, Error code: TRUE, stdout: , stderr:
Unknown option 'example.com': /usr/local/psa/bin/certificate --assign-cert Lets Encrypt certificate -admin example.com -ip 192.0.2.78
I believe its wrong in that documentation as well, and the -admin is for setting the admin certificate like this (or something has changed in how the command works internally causing it to throw an error now):
$ plesk bin certificate -r "Site Certificate" -admin
Hello Unknown User,
I have tested the utility from my end. Indeed, it is a mistake in the documentation.
The article has been adjusted. Also, I will report it to the responsible team in order to review the documentation as well.
Thank you for bringing our attention to this fact.
Please sign in to leave a comment.