Activate SSL Certificate on Domain via Plesk XML API

I am currently working on a Plesk-Panel plugin to automatically obtain and install SSL certificates. Thanks to the very powerful XML API provided by Parallels, I can install a certificate in the Plesks SSL Cert-Pool.

It is also possible to enable SSL on a page for a specific page, but I cannot completely find a way to activate a specific certificate (which of course is already added to the certificate pool)

The simplest answer, of course, will be "API does not support", but it is very easy to do it from the command line using this command:

/opt/psa/bin/subscription -u example.com -certificate-name my_cool_ssl_cert

and regarding leadership ,

Command Line Interface (CLI) has the same functionality as the RPC API

which is relatively obvious because they have the same functionality everywhere.

So what moment do I miss? Has anyone done this before?

Without the ability to activate a specific one via XML-API, many calls would be completely meaningless (is it possible to install CERT, activate ssl, but not activate it? I can't believe it.)

I would really appreciate any answer / comment that points me in the right direction, thanks in advance!

+3


source to share


1 answer


Here's an example request:

<packet>
    <webspace>
        <set>
            <filter>
                <id>34</id>
            </filter>
            <values>
                <hosting>
                    <vrt_hst>

                        <property>

                            <name>certificate_name</name>

                            <value>some_existed_certificate_name</value>

                        </property>

                    </vrt_hst>
                </hosting>
            </values>
        </set>  
    </webspace>
</packet>

      

The main rule is that if in the CLI it is a "subscriptions" parameter than we go to "Manage subscriptions (websites)" → "Configure subscription parameters" and we always need to check the "Request Packet Structure". From the package structure, we assume our SSL parameter should be in the hosting part, and there is a link, so we'll go to

http://download1.parallels.com/Plesk/PP12/12.0/Doc/en-US/online/plesk-api-rpc/39967.htm

      

but we can see that this part of the API is not fully documented, there are some "properties", but obviously not all of them. And there is a note



Note. To manage your hosting settings, you must first get the hosting parameter descriptor containing the names of the settings. For details, refer to the Retrieving the Hosting Settings Descriptor section.

And from this new link we can find how to get a list of all the hosting property names where we find "servername".

For domain or subdomain of an addon, you can use the following query:

<packet>
    <site>
        <set>
            <filter>
                <id>3</id>
            </filter>
            <values>
                <hosting>
                    <vrt_hst>

                        <property>

                            <name>certificate_name</name>

                            <value>some_existed_certificate_name</value>

                        </property>

                    </vrt_hst>
                </hosting>
            </values>
        </set>  
    </site>
</packet>

      

+3


source







All Articles