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.

API ZoneEdit edit_zone_record TTL Update

Discussion in 'Bind / DNS / Nameserver Issues' started by BlackAqua, Jan 8, 2017.

  1. BlackAqua

    BlackAqua Registered

    Joined:
    May 30, 2005
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    151
    I have a home server with a dynamic IP. A subdomain points to this IP.

    As it's dynamic, the following API2 (my first such attempt at doing this on cPanel) command is called via SSH as part of some wider (non-CP related) processing:

    cpapi2 --user=$USER ZoneEdit edit_zone_record Line=$LINE domain=domain.com name=sub type=A address=$HOMEIP ttl=600 class=IN

    The IP updates fine, however the TTL appears to be completely ignored and the server goes with the default (14400). The output from this on CLI is:

    cpanelresult:
    apiversion: 2
    data:
    -
    result:
    newserial: '2017010805'
    status: 1
    statusmsg: ''
    event:
    result: 1
    func: edit_zone_record
    module: ZoneEdit


    Any ideas?
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    37,163
    Likes Received:
    1,294
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello,

    I'm unable to reproduce this issue on a test system:

    Code:
    # grep sub123 /var/named/cptest01.com.db
    sub123   600   IN   A   10.10.10.10
    # cpapi2 --user=cptest01 ZoneEdit edit_zone_record Line=25 domain=cptest01.com name=sub123 type=A address=10.10.10.10 ttl=700 class=IN
    # grep sub123 /var/named/cptest01.com.db
    sub123   700   IN   A   10.10.10.10
    Could you verify which version of cPanel is installed on this system? Also, are you manually entering a IP Address in place of "$HOMEIP" in the example you provided, or is the value obtained from a custom script?

    Thank you.
     
  3. BlackAqua

    BlackAqua Registered

    Joined:
    May 30, 2005
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    151
    Hi Michael,

    The IP is obtained via a custom script, but as mentioned, the IP is updated OK.

    So I've manually set the TTL to 600 in WHM web...

    Code:
    # grep sub /var/named/domain.com.db
    sub     600     IN      A       255.255.255.255
    # cpapi2 --user=username ZoneEdit edit_zone_record Line=48 domain=domain.com name=sub type=A address=10.10.10.10 ttl=600 class=IN
    ---
    cpanelresult:
      apiversion: 2
      data:
        -
          result:
            newserial: '2017011504'
            status: 1
            statusmsg: ''
      event:
        result: 1
      func: edit_zone_record
      module: ZoneEdit
    # grep sub/var/named/domain.com.db
    sub     14400   IN      A       10.10.10.10
    
    
    Note how it reverts back to 14400.

    Code:
    /etc/redhat-release:CentOS Linux release 7.3.1611 (Core)
    /usr/local/cpanel/version:11.62.0.2
    /var/cpanel/envtype:virtuozzo
    CPANEL=current
    Server version: Apache/2.4.25 (cPanel)
    Server built:   Jan  4 2017 14:51:03
     
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    37,163
    Likes Received:
    1,294
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    On a test system, I see the following in place of your output:

    Code:
     statusmsg: "Bind reloading on current using rndc zone: [domain.tld]\n"
    What name server is configured under "WHM Home »Service Configuration » Nameserver Selection" on this system?

    Thank you.
     
  5. BlackAqua

    BlackAqua Registered

    Joined:
    May 30, 2005
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    151
    PowerDNS, not bind.
     
  6. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    37,163
    Likes Received:
    1,294
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello,

    I've tested with PowerDNS and am still unable to reproduce the issue. Could you open a support ticket using the link in my signature so we can take a closer look? You can post the ticket number here so we can update this thread with the outcome.

    Thank you.
     

Share This Page