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.

Fetch or Get CSR from the API

Discussion in 'cPanel Developers' started by enflexion, Jun 14, 2011.

  1. enflexion

    enflexion Registered

    Joined:
    Jun 14, 2011
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    Hi,

    I am pretty experienced with using the XML API for CPanel and have successfully integrated it into our workflow.

    However something that is eluding me is the ability to fetch a CSR

    In the documentation on generating a CSG is says:

    You can use SSL::listcsrs to pull the certificate after it has been created. You must must have access to the 'sslmanager' feature to use this function. All parameters are required.

    But this is of no use because all the listcsrs does is list the hosts

    has anyone else come across this or have a solution for me?
     
  2. cPanelDavidN

    cPanelDavidN Integration Developer
    Staff Member

    Joined:
    Dec 17, 2009
    Messages:
    571
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    Hi enflexion,

    Hmm, obviously there's some problems with the documentation on API2 SSL::listcsrs.

    I'm not sure if there is a function for retrieving the CSR. Near as I can tell, you'd have to use a conventional means of retrieval...ftp, scp, etc....which I expect is not what you need.

    I'll ask around to see if anyone has a better idea about this.

    Regards,
    -DavidN
     
  3. enflexion

    enflexion Registered

    Joined:
    Jun 14, 2011
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    Thanks David

    yes you are correct I don't want to have to store the FTP username / passwords and the ftp into each site for the CSR

    Is it possible to ftp to the server from the whm without the individual account passwords and get the CSR?

    IE does the WHM have the necessary authentication to do this?

    drew
     
  4. keddie

    keddie Well-Known Member

    Joined:
    Nov 17, 2007
    Messages:
    50
    Likes Received:
    0
    Trophy Points:
    6
    Did anyone ever come up with a solution for retrieving a CSR via the API?
     
  5. morissette

    morissette Well-Known Member

    Joined:
    May 24, 2009
    Messages:
    119
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Austin, TX
    cPanel Access Level:
    Root Administrator
    Doesn't look like the API has this function, running with a simple test all I get is the following output:


    $VAR1 = {
    'cpanelresult' => {
    'apiversion' => 2,
    'func' => 'listcsrs',
    'data' => [
    {
    'host' => 'secure.ssltest.net'
    }
    ],
    'event' => {
    'result' => 1
    },
    'module' => 'SSL'
    }
    };

    Code:
    
    sub getcsr{
            my $csr = $cp->cpanel_api2_request('whostmgr', { 'module' => 'SSL', 'func' => 'listcsrs' },
                    {
                            'user' => 'ssltest',
                    }
            );
            print Dumper $csr;
    }
    
    You will have to do this the old fashioned way opening the csr from either /etc/ssl/certs or /usr/share/ssl/certs
     

Share This Page