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.

cpanel dns syn hook inquery

Discussion in 'cPanel Developers' started by cosbeta, Mar 20, 2012.

  1. cosbeta

    cosbeta Member

    Joined:
    Jan 8, 2012
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    I am running servers with LAMP+cpanel backend and nginx frontend
    every time my cpanel users addon or park a domain , the dns information will be sent to DNS cluster

    because my frontend servers do not have this same ip address with backend servers

    I want to change the ipaddress of a domain's dns record to my frontservers' ip before information sent to DNS cluster
    so what is the hook name for this action

    conditions:
    I can write cpanel plugin with php by myself
    and I can get the frontends' ip address for the specified user

    my only question this , what is the hook for this ? /hooks/addondomain /hooks/pardomain (both seem do not work)
     
    #1 cosbeta, Mar 20, 2012
    Last edited: Mar 20, 2012
  2. KostonConsulting

    KostonConsulting Well-Known Member

    Joined:
    Jun 17, 2010
    Messages:
    255
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    San Francisco, CA
    cPanel Access Level:
    Root Administrator
    You can use the cPanel Standardized Hooks System to capture addon and parked domain additions and then modify the DNS zone.

    Here's a sample script to set up the hooks:

    Code:
    <?php
    
    $describe = array(
        array(
            'namespace' => 'Cpanel',
            'function'  => 'Api2::AddonDomain::addaddondomain',
            'stage'     => 'post',
            'hook'      => '/var/cpanel/MyApp/modifydns.php',
        ),
        array(
            'namespace' => 'Cpanel',
            'function'  => 'Api1::Park::park',
            'stage'     => 'post',
            'hook'      => '/var/cpanel/MyApp/modifydns.php',
        ),
    );
    
    if ( in_array('--describe', $argv) ) {
        print json_encode($describe);
        exit();
    }
    

    I have not tested to see if the 'post' hooks will execute before DNS is synced and as such, you may need 'pre' hooks (though the DNS zones probably won't exist before the function is called).
     
Loading...

Share This Page