The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Install wildcard ssl using XML API class

Discussion in 'cPanel Developers' started by tomdchi, Feb 21, 2010.

  1. tomdchi

    tomdchi Well-Known Member

    Joined:
    Feb 24, 2008
    Messages:
    114
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Atlanta, GA
    cPanel Access Level:
    DataCenter Provider
    I have been trying to install a wildcard ssl cert using the php api class but having issues.
    I can get the cert to install but apache ends up crashing and I have to terminate the user account in order to get the server back up.

    How it works normaly in WHM in SSL setup

    Enter crt
    Enter key
    Enter ca bundle

    WHM reads the cert as belonging to the base domain and inputs the user, ip, base domain into the user, ip, domain box. I change these to the correct values and then install cert, all is good.

    In the API docs the User and IP are not listed as param options. I tried to include them in the array anyway but still had the same result.
    Code:
    $installssl = $xmlapi->api2_query($user, "SSL", "installssl", array(cabundle => $cabundle, crt => $crt, domain => $domain, key => $key, ip => $ip, user=> $user));
    
    I have tried the above with and without ip and user and it will install but apache crashes. Anyone have any idea if I can get this to work?
     
    #1 tomdchi, Feb 21, 2010
    Last edited: Feb 21, 2010
  2. tomdchi

    tomdchi Well-Known Member

    Joined:
    Feb 24, 2008
    Messages:
    114
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Atlanta, GA
    cPanel Access Level:
    DataCenter Provider
    I got it to install and it works ok. But now when I install the cert a process is started that doesn't shutdown and runs up the cpu usage to almost 100%. I have to manually kill the process.
    the cpu usage list will show the command as:

    whostmgrd - serving *ip of site cert was installed*

    LOL, I finaly get the cert to install and to work but now the server is going to crash anyway because of another process. Just my luck.
    Anyone have any idea on how to prevent this?

    The scrip I am running:

    Code:
    
    <?php  
    
    require ('xmlapi.php');
    require ("ssl.php"); //holds the ssl cert, key, and cabundle
       
    $user = "sub";  
    $domain = "subdomain.domain.com";
    
    $xmlapi = new xmlapi($domain);  
    $xmlapi->password_auth("root","root_pass");  
    $xmlapi->set_debug(1); 
    
    $installssl = $xmlapi->api2_query($user, "SSL", "installssl", array(cabundle => $cabundle, crt => $crt, domain => $domain, key => $key));  
    
    ?>
    
    

    Doing a trace on the process shows this over and over:
    Code:
    
    write(12, "\27\3\1\0000\34&\360\223N\25\"v\2757J\367`\265mb\353\347 \222\t\232\6\273\302\206\231"..., 53) = -1 EPIPE (Broken pipe)
    --- SIGPIPE (Broken pipe) @ 0 (0) ---
    kill(13824, SIGKILL)                    = -1 EPERM (Operation not permitted)
    rt_sigreturn(0x11895410)                = -1 EPIPE (Broken pipe)
    
    
     
    #2 tomdchi, Feb 21, 2010
    Last edited: Feb 21, 2010
  3. MattDees

    MattDees cPanel Product Owner
    Staff Member

    Joined:
    Apr 29, 2005
    Messages:
    417
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    By any chance are you connecting to the same box that is serving the page? If so, then this is the cause of your problem as installing an SSL cert forces an apache restart.
     
  4. tomdchi

    tomdchi Well-Known Member

    Joined:
    Feb 24, 2008
    Messages:
    114
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Atlanta, GA
    cPanel Access Level:
    DataCenter Provider
    yes it is on the same box. I have another server that I can use to initiate this operation. I will give that a try
     
  5. tomdchi

    tomdchi Well-Known Member

    Joined:
    Feb 24, 2008
    Messages:
    114
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Atlanta, GA
    cPanel Access Level:
    DataCenter Provider
    That did it. I moved my scripts over to a different server and everything worked fine!

    Thanks Matt!

    BTW the php class rocks!
     
Loading...

Share This Page