WHM hooks for WHM events
Hi,
I am a plugin developer that is integrating the nginx server into the cPanel webstack.
For the proper working of the plugin ;I will need hooks from the following WHM functions
##
Home "IP Functions "Change a Site"s IP Address
Home "Multi Account Functions "Change Multiple Sites" IP Addresses
Home "SSL/TLS "Manage SSL Hosts
Home "SSL/TLS "Install an SSL Certificate on a Domain
##
I put the hooks in debug mode and confirmed that no hook is called in any such events.
It would be great if cPanel take an effort and support these functions too in
Guide to Standardized Hooks - Whostmgr Functions - Software Development Kit - cPanel Documentation
-
I put the hooks in debug mode and confirmed that no hook is called in any such events.
Hello, You can add a hook after WHM API 1 functions using a command such as:/usr/local/cpanel/bin/manage_hooks add script /var/cpanel/myapp/myscript.pl --manual --category Whostmgr --event setsiteip --stage post
Information on WHM API 1 functions such as "setsiteip" are available at: Guide to WHM API 1 - Software Development Kit - cPanel Documentation Thank you.0 -
I tested this and its not working . Moreover your documentation at Guide to Standardized Hooks - Whostmgr Functions - Software Development Kit - cPanel Documentation doesnt mention the usage as described above. The hooks does get added ; but its not executing for setsiteip or installssl events. 0 -
Hello, Upon further review, the ability to hook into any WHM API 1 function is not currently possible, as is the case for cPanel API functions. Per our documentation: The Standardized Hooks system uses the following categories for hookable events: Cpanel " The Cpanel category creates hookable events for cPanel API 1, cPanel API 2, or UAPI functions. PkgAcct " The PkgAcct category's events occur during backup creation. Passwd " The Passwd category's events occur when a WHM user changes a cPanel user's password. Stats " The Stats category's events occur during statistics processing. System " The System category's events occur during system updates or backups. Whostmgr " The Whostmgr category's events occur during WHM functions.
We have an internal case open (HB-1394) to explore the possibility of such as feature, but the current available hooks for Web Host Manager functions are listed at: Guide to Standardized Hooks - Whostmgr Functions - Software Development Kit - cPanel Documentation Thus, you can see the step listed in my previous response will work for the listed functions. In this example, it touches a file after suspending an account:# cat /var/cpanel/myapp/myscript.pl #!/bin/bash touch /root/12345678 # /usr/local/cpanel/bin/manage_hooks add script /var/cpanel/myapp/myscript.pl --manual --category Whostmgr --event Accounts::suspendacct --stage post # ls /root/12345678 /bin/ls: cannot access /root/12345678: No such file or directory # /scripts/suspendacct cptest123 Changing Shell to /bin/false...Changing shell for cptest123. Shell changed. Done Locking Password...Locking password for user cptest123. passwd: Success Done 1Suspending mysql users Suspending websites... Suspending FTP accounts... Suspending outgoing email....Done cptest123's account has been suspended # ls /root/12345678 /root/12345678
Feel free to open a feature request to add hook support for the specific actions you require via: Submit A Feature Request For instance, here's an example of a similar feature request we implemented: Rearrange an Account hook Thank you.0
Please sign in to leave a comment.
Comments
3 comments