简体   繁体   English

通过Plesk XML API激活域上的SSL证书

[英]Activate SSL-Certificate on Domain via Plesk XML API

I'm currently working on a Plesk-Panel Plugin for automatically getting & installing SSL-certificates. 我目前正在开发一个Plesk-Panel插件,用于自动获取和安装SSL证书。 With the very powerful XML API provided by Parallels I'm able to install the certificate to Plesks SSL Cert-Pool. 借助Parallels提供的非常强大的XML API ,我可以将证书安装到Plesks SSL Cert-Pool。

It's also possible to turn SSL on for a specific page, but I can absolutely find no way to activate a specific certificate (which is, of course, already added to the certificate pool). 也可以为特定页面打开SSL ,但我绝对找不到激活特定证书的方法(当然,这已经添加到证书池中)。

The easiest answer of course would be "the API doesn't support it", but it's very easy to do this via the Command Line Utilities using this command: 最简单的答案当然是“API不支持它”,但使用此命令通过命令行实用程序很容易做到这一点:

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

and regarding to the manual , 关于手册

The Command-Line Interface (CLI) has the same functions as API RPC 命令行界面(CLI)具有与API RPC相同的功能

which is relatively obvious, because they have the same functionality everywhere else. 这是相对明显的,因为它们在其他地方具有相同的功能。

So what point do I miss? 那么我错过了什么? Has anybody done this before? 有没有人这样做过?

Without the possibility to activate a specific via the XML-API, many of the calls would be completely senseless (It's possible to install a CERT, activate ssl but not to activate it? Can't really believe this.) 如果没有通过XML-API激活特定的可能性,许多调用将完全没有意义(可以安装CERT,激活ssl但不激活它?不能真的相信这一点。)

I'd really appreciate any answer/comment that points me to the right direction, thanks in advance! 我真的很感激任何回答/评论指出我正确的方向,提前感谢!

Here the request example: 这里是请求示例:

<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>

Main rule is that if in CLI it's an "subscription" setting, than we go to "Managing Subscriptions (Webspaces)" -> "Setting Subscription Parameters" and we always have to check "Request Packet Structure". 主要规则是,如果在CLI中它是“订阅”设置,我们转到“管理订阅(网站空间)” - >“设置订阅参数”,我们总是要检查“请求数据包结构”。 From packet structure we guess that our SSL setting should be in hosting part and there is a link, so we going to 从数据包结构我们猜测我们的SSL设置应该在托管部分,并且有一个链接,所以我们去

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

but there we see that this part of API is not fully documented, there some "properties" but obviously not all of them. 但是我们看到这部分API没有完整记录,有一些“属性”,但显然不是全部。 And there is a note 还有一个说明

Note: To manage hosting settings, you should first retrieve a hosting settings descriptor, containing names of the settings. 注意:要管理主机设置,您应首先检索包含设置名称的主机设置描述符。 For details, refer to the Retrieving Descriptor of Hosting Settings section. 有关详细信息,请参阅“ 检索主机设置描述符”部分。

And by this new link we can find how to retrieve an list of all names of hosting properties where we find "certificate_name". 通过这个新链接,我们可以找到如何检索我们找到“certificate_name”的托管属性的所有名称的列表。

For addon domain or subdomain you can use 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>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM