UAPI::SSL::install_ssl Hooks module/scripts

partizanes

Registered
Nov 2, 2016
4
0
1
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.
 
Last edited by a moderator:

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,260
463
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.
 

partizanes

Registered
Nov 2, 2016
4
0
1
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.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,260
463
How can I know when the AutoSsl install ssl certificates(API)? Why AutoSsl don`t use
UAPI::SSL::install_ssl ? Thx.
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.