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!

UAPI::SSL::install_ssl Hooks module/scripts

Discussion in 'cPanel Developers' started by partizanes, Nov 2, 2016.

Tags:
  1. partizanes

    partizanes Registered

    Joined:
    Nov 2, 2016
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Belarus
    cPanel Access Level:
    Root Administrator
    Hello, I need to install ssl vhost for nginx , after UAPI::SSL::install_ssl , but i don`t understand how to get information in script or right in module.

    I`m add and register hook for UAPI::SSL::install_ssl
    Code:
    my $hooks = [
            {
                'category' => 'Cpanel',
                'event'    => 'UAPI::SSL::install_ssl',
                'stage'    => 'post',
                'hook'     => 'NginxSsl::install',
                'exectype' => 'module',
            }
    
    
    with module
    Code:
    sub install  {
        my ( $context, $data ) = @_;
        #_more_logging( $context, $data );
    
        my $user = $data->{user};
        my $domain = $data->{args}->{domain};
        #.....
    
    }
    
    I have all information , but haven`t root right use uapi
    (example uapi --user=username DomainInfo single_domain_data domain=example.com) and write to nginx config.


    Okey, i try use script with root right
    Code:
    /usr/local/cpanel/bin/manage_hooks add script install.pl --manual --category Cpanel --event UAPI::SSL::install_ssl --stage post --exectype script --escalateprivs
    
    I have root right , but i don`t know about who call this script and any information .

    May be i dont understand how that work ? Any help .thx.

    Sorry for bad English.
     
    #1 partizanes, Nov 2, 2016
    Last edited by a moderator: Nov 2, 2016
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    44,344
    Likes Received:
    1,853
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello,

    We document privilege escalation for hooks at:

    Guide to Standardized Hooks - Privilege Escalation - Software Development Kit - cPanel Documentation

    I also recommend enabling the following option under the "Development" tab in "WHM >> Tweak Settings" when testing your custom application:

    Debug mode is on. The system displays information about every stage for every hookable event, even if no hooks exist for that stage.

    This is documented at:

    Guide to Standardized Hooks - Debug Mode - Software Development Kit - cPanel Documentation

    Once it's enabled, you can review /usr/local/cpanel/logs/error_log when testing your application to help determine why it's failing.

    Could you let us know if you have a specific issue with your application?

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

    partizanes Registered

    Joined:
    Nov 2, 2016
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Belarus
    cPanel Access Level:
    Root Administrator
    I undestand how to get data in hook script.
    my $user = $input->{data}->{user};
    $logger->info("user: " . $user);



    How can I know when the AutoSsl install ssl certificates(API)? Why AutoSsl don`t use
    UAPI::SSL::install_ssl ? Thx.
     
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    44,344
    Likes Received:
    1,853
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello,

    Certificates provided through the AutoSSL feature are not installed through cPanel or the traditional SSL installation process. The following document explains how the AutoSSL feature works:

    Manage AutoSSL - Documentation - cPanel Documentation

    The following WHM API 1 function is available if you want to see when the next automatic provisioning of certificates is scheduled to run:

    WHM API 1 Functions - get_autossl_check_schedule - Software Development Kit - cPanel Documentation

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
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