Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

cPanel uapi to deploy a single certificate for multiple domains

Discussion in 'cPanel Developers' started by glpanel, Jun 24, 2018.

Tags:
  1. glpanel

    glpanel Member

    Joined:
    Jun 24, 2018
    Messages:
    10
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    Italy
    cPanel Access Level:
    Website Owner
    Hello,

    I want to use cPanel uapi to deploy a single certificate for multiple domains and subdomains.

    If possible I’d like to know If with a single uapi command I can:

    1) deploy a single certificate containing a domain and two subdomains (eg. example.com www.example.com cp.example.com or a wildcard *.example.com)

    2) deploy a single certificate containing multiple domains (eg. aa.com bb.com cc.com dd.com)

    I hope someone can suggest something.

    Thank You.
     
  2. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    44,715
    Likes Received:
    1,883
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello @glpanel,

    The following UAPI function is available for installing a SSL certificate:

    UAPI Functions - SSL::install_ssl - Developer Documentation - cPanel Documentation

    You'd need to install it for each domain name individually (using multiple UAPI commands) just as you would via the cPanel UI. Have you considered using the AutoSSL feature instead? It will automatically install free signed SSL certificates for individual domain names and subdomains that are added to the cPanel account.

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. glpanel

    glpanel Member

    Joined:
    Jun 24, 2018
    Messages:
    10
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    Italy
    cPanel Access Level:
    Website Owner
    Hi Michael, thank you for your reply.

    "You'd need to install it for each domain name individually" means that to install the certificate of example N°1 I only need a single uapi command, while for example N°2 I must generate four certificates for each domain and install them with four uapi commands ?

    As for AutoSSL, I understand that it is a sort of user interface to automate the installation of certificates issued by Let's Encrypt or other certificate authority, in this case my hosting provider has not enabled this cPanel module.
     
  4. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    44,715
    Likes Received:
    1,883
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello @glpanel,

    It depends on the type of certificate you are installing. For instance, is it a standard SSL certificate that covers a single domain name, a wildcard SSL certificate, or a multi-domain (UCC) certificate?

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. glpanel

    glpanel Member

    Joined:
    Jun 24, 2018
    Messages:
    10
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    Italy
    cPanel Access Level:
    Website Owner
    I want to install a standard certificate that covers a domain and subdomain like example.com www.example.com
     
  6. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    44,715
    Likes Received:
    1,883
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    In that case, yes, a single UAPI command is all you'd need. EX:

    Code:
    uapi SSL install_ssl domain=example.com cert=THECERTIFICATETEXT key=THEKEYTEXT cabundle=THECABUNDLETEXT
    
    You wouldn't need to run an additional command for the "www" subdomain, as it's included by default as part of the installation.

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  7. cPanelFelipe

    cPanelFelipe Member
    Staff Member

    Joined:
    Apr 10, 2013
    Messages:
    10
    Likes Received:
    8
    Trophy Points:
    78
    Quick clarification: install_ssl does NOT install certificates onto “domains” per se; rather, it first installs them onto Apache httpd virtual hosts and then creates appropriate entries for non-httpd SSL services (e.g., Dovecot, Exim, cpsrvd, …).

    Consider a case where “example.com” and “haha.org” share an Apache virtual host. While install_ssl will accept either of those domain names, it’s not possible to have separate SSL certificates for the two domains; an installation for one will overwrite the installation for the other. Thus, the only way to secure both domains is to have a certificate that matches both domains.

    This is all because Apache httpd associates SSL certificates with virtual hosts, not with domain names. It’s an unfortunate design that creates a lot of confusion.
     
    cPanelMichael likes this.
  8. glpanel

    glpanel Member

    Joined:
    Jun 24, 2018
    Messages:
    10
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    Italy
    cPanel Access Level:
    Website Owner
    Hi Felipe, thank you for this useful clarification.

    I’ve successfully installed three separate RSA certificates on three of my domains using cPanel Uapi, but my domains are not sharing Apache virtual hosts.

    Previously, the installation of Ecdsa certificates failed
     
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice