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!

WHM API 1 - install_service_ssl_certificate - cabundle confusion

Discussion in 'cPanel Developers' started by gwurr3, Aug 12, 2015.

  1. gwurr3

    gwurr3 Registered

    Joined:
    Jun 7, 2014
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Hi guys,

    I've got a script working that installs service SSL certs.
    It works fine if the server already has the correct cabundle.

    However, if, say, I'm on a fresh server load without the cabundle, it will fail.

    I've tried specifying the ca-bundle as:
    plaintext ( with or without newlines )
    uri-encoded text ( with or without newlines )
    a filepath to a file on the server containing the cabundle
    etc

    I can't seem to figure this out.
    https://documentation.cpanel.net/display/SDK/WHM+API+1+Functions+-+install_service_ssl_certificate says to use:
    A valid .crtfile on the server. example "ca-bundle.crt"

    I'm guessing it just wants to take in an argument like "ca-bundle.crt" instead of a full filepath.
    If this is the case, what directory is it searching in?

    I'm doing this from a perl script via a http request:
    localhost:2087/json-api/install_service_ssl_certificate?api.version=1&service=cpanel&crt=$cert&key=$key
    I've also tried the xml api with the same results

    Thanks in advance for your time.
     
    #1 gwurr3, Aug 12, 2015
    Last edited by a moderator: Aug 12, 2015
  2. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    45,384
    Likes Received:
    1,951
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello :)

    You should pass the contents of the CRT for "cabundle" the same way you do for "crt" and "key". Do you receive a specific failure message?

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

    gwurr3 Registered

    Joined:
    Jun 7, 2014
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    This is what I get:

    {"metadata":{"version":1,"reason":"Certificate verification failed!\nThe system did not find the Certificate Authority Bundle that matches this certificate.\nContact “GlobalSign nv-sa” to obtain the Certificate Authority Bundle for “AlphaSSL CA - SHA256 - G2”.","result":0,"command":"install_service_ssl_certificate"}}

    This only occurs if the server is a fresh load and has never had an SSL installed via WHM, yet.
    It seems once we login to WHM and setup the cert with the "autofill by certificate" option, it corrects the issue.
    After adding the cert via WHM, I can then remove it completely and then the API call will now work.
    I'm guessing that the CA Bundle is getting cached somewhere or something after using the autofill option.

    btw this is using: json-api/install_service_ssl_certificate?api.version=1&service=cpanel&crt=$cert&key=$key&cabundle=$cab

    Sorry for the late reply, and thanks :)
     
  4. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    45,384
    Likes Received:
    1,951
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Could you open a support ticket using the link in my signature so we can take a closer look? You can post the ticket number here so we can update this thread with the outcome.

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...
Similar Threads - install_service_ssl_certificate cabundle confusion
  1. Jaanus Nurmoja
    Replies:
    1
    Views:
    211
  2. mrcbrown
    Replies:
    9
    Views:
    1,062
  3. Havri
    Replies:
    14
    Views:
    1,712

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