cPanel & WHM Version 94 has been released, and brings a slew of great updates. Take a look at what is included, and then upgrade today!

WHMAPI1 hook for IP change

gnusys shared this idea 4 years ago
Completed

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 WHMAPI functions


  • Home »IP Functions »Change a Site’s IP Address
  • Home »Multi Account Functions »Change Multiple Sites’ IP Addresses

Best Answer
photo

Version 60 has gone to the CURRENT tier! You can take a look at the full release notes here:


https://documentation.cpanel.net/display/ALD/60+Release+Notes


If you have any questions, feel free to follow your typical support path, or email me directly!

Comments (7)

photo
1

The hook point for Change IP is available in the EDGE tier as of version 59.9999.130. If you're okay with it, I'd like to split the SSL hook points off into another request, as that one requires a much more significant time commitment, and isn't likely to get attention in this release.

photo
1

Sure Benny . Its good news that the edge tier has this implemented at least partially. I will soon test it and update you the results.

photo
2

Perfect! I've created the new request here, and adjusted this request to only be for IP changes.

photo
1

I am running WHM 59.9999 (build 134) [DEV]


Added the hook like


# /usr/local/cpanel/bin/manage_hooks add script /opt/nDeploy/scripts/ipchange.sh --manual --category Whostmgr --event setsiteip --stage post


and the hook doesnt run when an account IP is changed from WHM. no debug log for the hooks execution as well in the cpanel error_log .

photo
2

Hello,


You are using the wrong event. The correct one is Accounts::SiteIP::set. To get hook debugging to work, I believe you need to set debughooks=3 in /var/cpanel/cpanel.config.

photo
1

@Kenneth - yes it works on both events


Home »IP Functions »Change a Site’s IP Address

Home »Multi Account Functions »Change Multiple Sites’ IP Addresses


Thanks

photo
1

Looks like I spoke too soon. The hook is there ..but it does not have the json data to identify the account name for which the IP address was changed . the data dict from the json is blank


{u'hook': {u'exectype': u'script', u'weight': u'100', u'escalateprivs': u'0', u'hook': u'/opt/nDeploy/scripts/xyz', u'id': u'C1naBGmmyHTs5ICMBtiBedIb', u'stage': u'post'}, u'data': None, u'context': {u'category': u'Whostmgr', u'stage': u'post', u'event': u'Accounts::SiteIP::set', u'blocking': 0, u'point': u'main'}}

photo
1

Thank you for pointing that out. The data struct is populate for the pre event, not the post event. I've submitted a pull request to have that added. It is tracked by case CPANEL-8608.

photo
1

Update: the needed change is in build 11.59.9999.157, which went to the EDGE tier today/tonight. My apologies on the delay.

photo
1

@KennethPower - works! . Thanks


Can you also check the related hook request https://features.cpanel.net/topic/whmapi1-hook-for-ssl-install-and-removal . Thats the last piece of hook that will make possible integration of any third party web server buttery smooth .


Thanks.

photo
1

Version 60 has gone to the CURRENT tier! You can take a look at the full release notes here:


https://documentation.cpanel.net/display/ALD/60+Release+Notes


If you have any questions, feel free to follow your typical support path, or email me directly!

Replies have been locked on this page!