skip to Main Content

I’m currently working on a Plesk-Panel Plugin for automatically getting & installing SSL-certificates.
With the very powerful XML API provided by Parallels I’m able to install the certificate to 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).

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:

/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

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

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

2

Answers


  1. 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”. From packet structure we guess that our SSL setting should be in hosting part and there is a link, so we going to

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

    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>
    
    Login or Signup to reply.
  2. I am using the REST API to create subdomains and is working great and..its way more clear the setup..you might not find enough documentation but if you try things you will see that it’s working just fine..i think faster too but that’s not the point..
    So here is what i do to install SSL, ftp user, PHP Version etc..

    $new_store = array(
      "name"              => newstore.sudbomain.com,
      "description"       => 'New store example',
      "hosting_type"      => 'virtual',
    
      'hosting_settings'  => array(
        "www_root"        => 'Clients/newstore.sudbomain.com,
        'ftp_login'       => $this->_ftp_user,
        'ftp_password'    => $this->_ftp_pass,
        'php'             => true,
        'php_handler_id'  => 'plesk-php80-fpm',
        'certificate_name'=> 'WildCardSSL'
      ),
    
      "parent_domain"       => array(
        "id"              => $this->_ng_id,
        "name"            => $this->_ng_name,
        "guid"            => $this->_ng_guid
      ),
    
      "ip_addresses"      => ["XXX.XXX.XXX.XXX"],
      "ipv4"              => ["XXX.XXX.XXX.XXX"],
      "ipv6"              => ["xxxx:xxx:xxx:xxxx::x"]
    
    );
    
    $body = json_encode($new_store, JSON_UNESCAPED_UNICODE);
    
    $this->api_call('domains', $body, $response, $error);
    // 'domains' is the endpoint
    // $body is the json
    // $response is the returned json response
    // $error is errors returned from the curl command
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search