Dynamic DNS Server WHM API PHP

CanadaGuy

Active Member
Sep 24, 2018
38
7
8
Ottawa
cPanel Access Level
Root Administrator
I'm trying to consolidate some services, and was looking to see what has been done with WHM and dynamic dns using API tokens. I found this, but it is user/password based:

github.com/teampalmtree/WHMDDNS

I found this as an example of the API token implementation for php:

Guide to API Authentication - API Tokens - Developer Documentation - cPanel Documentation

Has anyone done something already? Between the above two links I think I could hack together something for my own uses, but I thought I would ask the community.
 
Last edited by a moderator:

CanadaGuy

Active Member
Sep 24, 2018
38
7
8
Ottawa
cPanel Access Level
Root Administrator
So I took those two examples I posted and wrote a php script that is mostly compatible with the DynDNS "protocol". There isn't as much to it as I thought. I need to clean up and workout the authentication part still but if anyone is interested, I'd be happy to share.

You need to create a WHM API token for it to work. You then configure a sub-domain to act as the update server where you drop the php script and .htaccess file. Then you configure your DDNS client to point at the server, use DynDNS protocol (if necessary) and go to town. It could still use some improvements to flexibility and robustness I'm sure.
 
  • Like
Reactions: cPanelMichael

CanadaGuy

Active Member
Sep 24, 2018
38
7
8
Ottawa
cPanel Access Level
Root Administrator
Hello @CanadaGuy,

Feel free to share the script here, or perhaps create a GitHub repo for it and share the link. You may also find the following GitHub repo helpful:

CpanelInc/cpanel-dynamicdns-tools

Thank you.
Thanks for providing that link. That is a well developed script it looks like, but in a different direction. I'll share mine when I get a little more done.
 
  • Like
Reactions: cPanelMichael

ddaddy

Active Member
Aug 19, 2015
31
1
8
UK
cPanel Access Level
Root Administrator
Thanks for this. I’ll give this a go.
You mentioned you wanted to use tokens but I see it requires username and password. Could you not get tokens working?
 

CanadaGuy

Active Member
Sep 24, 2018
38
7
8
Ottawa
cPanel Access Level
Root Administrator
Thanks for this. I’ll give this a go.
You mentioned you wanted to use tokens but I see it requires username and password. Could you not get tokens working?
To be honest, I don't remember what my motivations were for login vs tokens at the time. Every time I learn something new it pushes old stuff out of my brain.

If you think I could help, let me know. It does take a bit of setup to make it work, but interestingly everyone seems to use the Dyn DNS API, even Google, so feel free to extend on the work or whatever.