Open aka13-404 opened 3 months ago
Hey,
I have 2 sites, 1 with dhcp and 1 with pppoe server. On the dhcp site I have something similar, when the lease is done it sends the change through the API. The same thing happens on the pppoe site, newly configured in /ppp/profile
in the on-up
section.
The original script is made about 1-2 years ago, when my knowledge about mikrotik and cloudflare was very simple, today I have some changes but I haven't written about it.
Thanks for writing to us. If you want to contribute, please create a new file with your changes and make a pull request with your new changes and we will make a blog post with this update.
Regards,
Hey guys,
Found your repo and scripts by accident on google, specifically https://vectops.com/post/2023/configure-mikrotik-with-cloudflare-ddns/ Good writeup, but I have 2 cents on how to make stuff a bit nicer.
Feel free to ignore/close if you don't consider it valuable, feel free to expand/add alternative from my code attached to the issue. I felt that a formal pull request would be too formal.
For quite a while, you don't have to schedule scripts, if you are getting the IP from the provider with the built in dhcp-client. So unless you are doing PPPoE, you can simply doubleclick corresponding dhcp-client and use the script there. It will execute when the lease changes.
Going with the general API key is not a smart move. For a while, you can generate api tokens with limited scope, which also removes the need of the email header. the scope zone.dns for your desired zone is enough
I dunno why you use PUT and the whole payload. a PATCH and the IP only will be sufficient.
Here is the updated version: