Install Certificate trough the API do not work.

Hello,

We are trying to use the API to give users the opportunity to install SSL certificates on their own but we face an issue.

We have tried to send the API query many ways and the result is the same: "Invalid data for cert : Data does not start with line -----BEGIN CERTIFICATE-----"

The certificate does START with "-----BEGIN CERTIFICATE-----"

We have tested to send the request to the remote API trough POST parameters, GET parameters and also local command line (plain text certificate, not using file) and none of them work. IS this a bug or we do not do something right. How to pass the certificates to the remote API so they are successfully recognized and installed?

Status: 
Active

Comments

The API only supports passing in the cert via a filename unfortunately - so won't really work for remote calls.

Is there a workaround? Or can this be fixed somehow. Like sending file trough post request and then virtualmin to parse it?

The only work-around right now is to first upload the cert to a file on the server, and then call the API command with the path to that file.

I uploaded file. crt by comodo i get the same error.
i tried unix2dos and fold -w64
i converted to .pem
i tried to pass it plaintext from command line
and i still get the error
virtualmin install-cert --domain mydomain.com --cert mydomain.crt
Invalid data for cert : Data does not start with line -----BEGIN CERTIFICATE-----

I use
virtualmin 4.17
debian wheezy

Thanks in advance for any help

Make sure you supply the file path to the cert file, like /tmp/mydomain.crt