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.

Can cPanel Update Dynamic IP Information To DNS Records?

Discussion in 'Bind / DNS / Nameserver Issues' started by nim6us, Mar 2, 2012.

  1. nim6us

    nim6us Registered

    Joined:
    Mar 2, 2012
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    I've previously used a the hostname service with DynDNS because it was free. However now that I'm trying to add an bit of professionalism to my freelance work I want to use a custom domain. Right now I've just created a CNAME so that mycustomname.com references mydyndns.com. That way I'm still using the DynDNS service but the client or whoever is none the wiser. Why not just point mycustomname.com at my IP? Well the only reason I still need to use the DynDNS service is because my IP is dynamic and DynDNS allows my router (running Tomato firmware) to update DNS information with my current IP automatically so my hostname is always accurate. However I was wondering is there a way that I can just have my router update cPanel instead of DynDNS and I could use mycustomname.com exclusively and cut out the need for DynDNS?
     
  2. nim6us

    nim6us Registered

    Joined:
    Mar 2, 2012
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    I was just reading in Ping how cPanel had this stellar customer support.. anyone?
     
  3. gort42

    gort42 Registered

    Joined:
    Sep 1, 2007
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    How about making a feature request? There are a number of forum articles asking for this feature, e.g. this recent post, this post from 2006 w/ a poll, or this one from 2005.

    The prevailing response is as you've suggested. I recently stumbled onto this Dynamic DNS update via cPanel API script by Stefan Gofferje /http://stefan.gofferje.net/it-stuff/scripts/39-dynamic-dns-update-via-cpanel-api but I haven't found much discussion of folks using it. Stefan has a brief article about it here /http://stefan.gofferje.net.nyud.net/news/website-news/40-dynamic-dns-and-cpanel. I'd be interested to know if you get it working.
     
  4. cPanelNick

    cPanelNick Administrator
    Staff Member

    Joined:
    Mar 9, 2015
    Messages:
    3,426
    Likes Received:
    2
    Trophy Points:
    38
    cPanel Access Level:
    DataCenter Provider
    I wrote a shell script a while back to update the dns for my home ip (I'm using this on an openwrt router). I'm posting it inline in case someone finds it useful:

    View attachment cpanel-dynamic-dns.sh.txt
     
  5. doni49

    doni49 Well-Known Member

    Joined:
    Oct 4, 2006
    Messages:
    74
    Likes Received:
    0
    Trophy Points:
    6
    Nick,

    I'm attempting to use your script for my own similar needs. But I have a few questions and I'm hoping you can assist.

    1) Under the Setup_vars function, what does this do? HOMEDIR=`echo ~` I ask because I would've thought it should be /home/username not a line containing "echo".

    2) Under load_config, if $basedir.conf does not exist (which it doesn't), the script will (should) throw an error. So I'm guessing I need to create the file. What belongs in this file?

    THANKS!

    EDIT: You can disregard Q #1. I just figured out that echo ~ outputs the home folder name (which means that as used, it sets HOMEDIR to the home folder path).
     
    #5 doni49, Jun 10, 2013
    Last edited: Jun 10, 2013
  6. cPanelNick

    cPanelNick Administrator
    Staff Member

    Joined:
    Mar 9, 2015
    Messages:
    3,426
    Likes Received:
    2
    Trophy Points:
    38
    cPanel Access Level:
    DataCenter Provider
    Here is what my config file in /root/etc/ looks like:

    Code:
    root@OpenWrt:~/etc# cat cpdyndns.conf 
    CONTACT_EMAIL="my_email_here@cpanel.net"
    CPANEL_SERVER="my_server_here.cpanel.net"
    DOMAIN="my_domain_here.tld"
    SUBDOMAIN="my_subdomain_here"
    CPANEL_USER="my_username_here"
    CPANEL_PASS="my_password_here"
    
     
  7. manokiss

    manokiss Well-Known Member

    Joined:
    Mar 31, 2002
    Messages:
    571
    Likes Received:
    0
    Trophy Points:
    16
    Hi Nick, just a question...do this need root to run? or running through user cron should work? Thanx!
     
  8. cPanelNick

    cPanelNick Administrator
    Staff Member

    Joined:
    Mar 9, 2015
    Messages:
    3,426
    Likes Received:
    2
    Trophy Points:
    38
    cPanel Access Level:
    DataCenter Provider
    It does not need root, just the user/pass to cPanel in the config file.
     
  9. manokiss

    manokiss Well-Known Member

    Joined:
    Mar 31, 2002
    Messages:
    571
    Likes Received:
    0
    Trophy Points:
    16
    Thanx Nick!
     
  10. manokiss

    manokiss Well-Known Member

    Joined:
    Mar 31, 2002
    Messages:
    571
    Likes Received:
    0
    Trophy Points:
    16
    I keep getting the following error, wondering if you can give me an idea from where start looking? simple and advanced DNS editor is enabled in the user cpanel. Im on whm 11.38

    Fetching zone for domain.com....Request failed with error: Unknown Error (Please make sure you have the zoneedit, or simplezone edit permission on your account.)
    skipping notification because a notication was sent 28 seconds ago.

    Thanx in advance!
     
  11. manokiss

    manokiss Well-Known Member

    Joined:
    Mar 31, 2002
    Messages:
    571
    Likes Received:
    0
    Trophy Points:
    16
    Wondering if this line:

    AUTH_STRING=`echo -n "$CPANEL_USER:$CPANEL_PASS" | openssl enc -base64`

    Should be changed? is cpanel continue using base64 or md5?
     
  12. cPanelNick

    cPanelNick Administrator
    Staff Member

    Joined:
    Mar 9, 2015
    Messages:
    3,426
    Likes Received:
    2
    Trophy Points:
    38
    cPanel Access Level:
    DataCenter Provider
    It just using openssl to do the base64 required for Basic authentication. If you don't have openssl installed on your client, you might need to change this to use something like base64(1) - Linux man page
     
  13. manokiss

    manokiss Well-Known Member

    Joined:
    Mar 31, 2002
    Messages:
    571
    Likes Received:
    0
    Trophy Points:
    16
    Thanx Nick!

    Could there be anything about the user account that doesn't have perms to that API? Openssl is installed in the client but keep getting auth error....

    Thanx again!
     
    #13 manokiss, Aug 2, 2013
    Last edited by a moderator: Aug 2, 2013
  14. surfrock66

    surfrock66 Registered

    Joined:
    Oct 14, 2013
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    Just a heads up, I've been using this script for months but now it isn't working. I'm not sure when it broke; I'd been running it as a cronjob with output redirected to /dev/null, so I have no log.

    The output I get when running the script is the following:

    My username and password are printed out above, so I've removed them. Thoughts?
     
  15. _cedric_

    _cedric_ Registered

    Joined:
    Nov 19, 2013
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    Hi, I registered to thank cPanelNick for his script that perfectly fits my needs.

    I made two little changes:
    - Set the ttl from to 300 to 1800
    - Use a precalculated auth string as I don't like to have my login/pass clear in a conf file:
    PRECALC_AUTH_STRING is defined in the .conf file.

    For information, the script run on a synology DS106j with DSM 2.1-0844, the cronjob is set to run every two hours.
    My domain and cpanel are hosted by hostpapa.com

    Best regards :)
    Cedric
     
  16. chuq00

    chuq00 Registered

    Joined:
    Nov 23, 2013
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner

    Nick I am trying to use this on my ubuntu system and whenever I run this I have bunches of errors
    Code:
    ./cpanel-dynamic-dns.sh: 350: [: 0: unexpected operator
    ./cpanel-dynamic-dns.sh: 347: [: 0: unexpected operator
    ./cpanel-dynamic-dns.sh: 350: [: 0: unexpected operator
    ./cpanel-dynamic-dns.sh: 347: [: 0: unexpected operator
    ./cpanel-dynamic-dns.sh: 350: [: 0: unexpected operator
    ./cpanel-dynamic-dns.sh: 347: [: 0: unexpected operator
    ./cpanel-dynamic-dns.sh: 350: [: 0: unexpected operator
    ./cpanel-dynamic-dns.sh: 347: [: 0: unexpected operator
    ./cpanel-dynamic-dns.sh: 350: [: 0: unexpected operator
    ./cpanel-dynamic-dns.sh: 356: [: unexpected operator
    
    just for a sample of them..
    What am I missing? are there some pre-req's that I may be missing?
     
  17. tariq2sa

    tariq2sa Registered

    Joined:
    Jan 26, 2014
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Thank you it did the work.
     
  18. seanos

    seanos Registered

    Joined:
    Apr 8, 2014
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    In case anyone else is running into this problem (with the shutdown of DynDNS free service in a month’s time)—the problem here is the script is being run using sh rather than bash.

    Try...
    Code:
    bash ./cpanel-dynamic-dns.sh
    Thanks CpanelNick!
     
  19. Gibby

    Gibby Member

    Joined:
    Feb 24, 2012
    Messages:
    9
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    DataCenter Provider
    Thanks Nick, I was about 50% done with my script since dyndns is going away and I have been using it for years, decided maybe someone has already done what I was trying to do. You saved me some time. It works great on Zentyal which is on top of Ubuntu 12.04.
     
  20. lorio

    lorio Well-Known Member

    Joined:
    Feb 25, 2004
    Messages:
    243
    Likes Received:
    3
    Trophy Points:
    18
    cPanel Access Level:
    Root Administrator
    Is there a differen under 11.42 with API and a token instead of using a cpanel username?
     
Loading...

Share This Page