Skip to main content
Sign in
Snippets Groups Projects
Commit d0d37df4 authored by Suvendhu Hansa's avatar Suvendhu Hansa :speech_balloon: Committed by Vivek Dutta
Browse files

ddnsmngr with ddns-script and inadyn backend

parent f6b2e2e1
No related branches found
No related tags found
1 merge request!1Initial code
Pipeline #137198 passed
Showing
with 270 additions and 90 deletions
*.o
*.so
variables:
DEBUG: 'TRUE'
SOURCE_FOLDER: "./src"
FLAWFINDER_OPTIONS: "-m 4 --error-level=5"
CPPCHECK_OPTIONS: " --enable=all --inline-suppr"
COMPILE: "./gitlab-ci/compile.sh"
include:
- project: 'iopsys/gitlab-ci-pipeline'
file: '/static-code-analysis.yml'
stages:
- static_code_analysis
# ddnsmngr
## Getting started
To make it easy for you to get started with GitLab, here's a list of recommended next steps.
Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)!
## Add your files
- [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files
- [ ] [Add files using the command line](https://docs.gitlab.com/ee/gitlab-basics/add-file.html#add-a-file-using-the-command-line) or push an existing Git repository with the following command:
# DDNS Manager
DDNS manager is a lightweight program to manage Device.DynamicDNS. TR069 datamodel as per 2.16 version.
This package is dependent on openwrt ddns-script package for the backend job of managing dynamic DNS updation.
We need to create this separate because there is a limitation in ddns-script package that it supports only
one host in every DNS client section in the UCI. Where as datamodel definition allows multiple host under
one DNS client object.
So to achieve the datamodel specification there was one option to patch the openwrt ddns-script package.
We found it not good enough to patch the ddns-script package in openwrt and hence decided to create this
'ddnsmngr' package to achive the datamodel specification.
## Package details
1. In this package we have used bbfdm micro-service mechanism to register the Device.DynamicDNS. datamodel
tree.
2. We have created separate UCI and init script namely "/etc/config/ddnsmngr" and "/etc/init.d/ddnsmngr"
respecively. Datamodel interaction will be with these files rather than the standard ddns-script UCI and
init script.
3. We have added a shell script in this package namely "ddnsmngr_updater.sh" which will spawn one ddns process
for each configured hosts as it is now being done from the standard "dynamic_dns_updater.sh" in the ddns-script
package.
We avoided the patch work in "ddns-script" package by introducing this script. This script uses apis from the
"dynamic_dns_functions.sh" script in ddns-script package and does the ddns work.
## UCI format
Below is the format of the UCI:
```
cd existing_repo
git remote add origin https://dev.iopsys.eu/bbf/ddnsmngr.git
git branch -M main
git push -uf origin main
config ddnsmngr 'global'
option configfile '/var/run/ddnsmngr/ddnsmngr.json'
option ddns_dateformat '%F %R'
option ddns_rundir '/var/run/ddnsmngr'
option ddns_logdir '/var/log/ddnsmngr'
option ddns_loglines '250'
option upd_privateip '0'
option use_curl '1'
config client 'client_1'
option enabled '1'
option service_name 'dynu.com'
option interface 'wan'
option ip_network 'wan'
option username 'xxxxxx'
option password 'xxxxxx'
option use_ipv6 '0'
option force_ipversion '0'
option use_https '0'
option force_dnstcp '0'
config host 'client_1_host_1'
option enabled '1'
option dm_parent 'client_1'
option lookup_host 'device1.loseyourip.com'
config host 'client_1_host_2'
option enabled '1'
option dm_parent 'client_1'
option lookup_host 'device2.loseyourip.com'
```
## Integrate with your tools
- [ ] [Set up project integrations](https://dev.iopsys.eu/bbf/ddnsmngr/-/settings/integrations)
## Collaborate with your team
- [ ] [Invite team members and collaborators](https://docs.gitlab.com/ee/user/project/members/)
- [ ] [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html)
- [ ] [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically)
- [ ] [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/)
- [ ] [Set auto-merge](https://docs.gitlab.com/ee/user/project/merge_requests/merge_when_pipeline_succeeds.html)
## Test and Deploy
Use the built-in continuous integration in GitLab.
- [ ] [Get started with GitLab CI/CD](https://docs.gitlab.com/ee/ci/quick_start/index.html)
- [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing (SAST)](https://docs.gitlab.com/ee/user/application_security/sast/)
- [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html)
- [ ] [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/)
- [ ] [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html)
***
# Editing this README
When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thanks to [makeareadme.com](https://www.makeareadme.com/) for this template.
## Suggestions for a good README
Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information.
## Name
Choose a self-explaining name for your project.
## Description
Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors.
## Badges
On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge.
## Visuals
Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method.
## Installation
Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection.
## Usage
Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README.
## Support
Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc.
## Roadmap
If you have ideas for releases in the future, it is a good idea to list them in the README.
## Contributing
State if you are open to contributions and what your requirements are for accepting them.
For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self.
You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser.
## Authors and acknowledgment
Show your appreciation to those who have contributed to the project.
## License
For open source projects, say how it is licensed.
## Project status
If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers.
## How it works
1. The init script of 'ddnsmngr' package parses each host section in the UCI and creates a
1:1 client-host json configuration in the file mentioned in 'configfile' option of UCI. The
default file is "/var/run/ddnsmngr/ddnsmngr.json".
2. For above UCI config the json configuration would be like:
```
{
"services": [
{
"interface": "wan",
"service_name": "dynu.com",
"username": "xxxxxx",
"password": "xxxxxx",
"lookup_host": "device1.loseyourip.com",
"ip_network": "wan",
"proc_info_file": "client_1_host_1",
"use_ipv6": "0",
"force_ipversion": "0",
"use_https": "0",
"force_dnstcp": "0"
},
{
"interface": "wan",
"service_name": "dynu.com",
"username": "xxxxxx",
"password": "xxxxxx",
"lookup_host": "device2.loseyourip.com",
"ip_network": "wan",
"proc_info_file": "client_1_host_2",
"use_ipv6": "0",
"force_ipversion": "0",
"use_https": "0",
"force_dnstcp": "0"
}
]
}
```
3. Init script then calls the "ddnsmngr_updater.sh" script with this json object as an argument.
4. "ddnsmngr_updater.sh" script then validates each object in the "services" array and starts
process for every valid object.
## ddnsmngr_updater.sh VS dynamic_dns_updater.sh
In ddns-script package "dynamic_dns_updater.sh" script spawn processes for every DDNS client
object and every process can take care of a single host.
"ddnsmngr_updater.sh" spawn a separate process for each host and hence every hostname is being
updated by a dedicated process.
## Backend Support
We have analysed several dynamic DNS client packages for the purpose of using as a backend of
this ddnsmngr package, out of which "ddns-script" and "inadyn" are the two packages we have
found suitable for the implementation.
Below are the details of the packages which were analysed
| Package | Language | License | Pros/Cons |
| ------------ | -------- | ------- | ------------------------------------------------ |
| Enhanced-duc | C | NA | Update URL is hard coded and so a few service provider which uses this url format only work with this package. It also can not support custom providers |
| ddclient | perl | GPLv2 | Can not support custom providers at runtime, to add custom providers need to make changes in code |
| ddnsc | python & REST | GPLv3 | Only a few providers are supported and with this package also custom providers can not be supported at runtime. A python plugin with REST api is need to be written for every custom providers |
| ndyndns | C | BSD | Only supports DynDNS and Namecheap providers. Also this package is no longer in development or maintenance |
| inadyn | C | GPLv2 | Custom providers can be added at runtime. It is available in openwrt_package. It do not rely on DNS to identify if an update is required and supports multiple hostname configuration. We need to do some changes in its logging mechanism |
| ddns-script | Shell | | Custom providers can be added at runtime. It is also available in openwrt_package. It does rely on DNS to identify if an update is required. Do not support multiple hostname but with some alternative implementation mutiple host can be supported |
{
"name": "3322.org",
"ipv4": {
"url": "http://[USERNAME]:[PASSWORD]@members.3322.org/dyndns/update?system=dyndns&hostname=[DOMAIN]&myip=[IP]"
}
}
{
"name": "afraid.org-basicauth",
"ipv4": {
"url": "https://[USERNAME]:[PASSWORD]@freedns.afraid.org/nic/update?hostname=[DOMAIN]&myip=[IP]"
},
"ipv6": {
"url": "https://[USERNAME]:[PASSWORD]@freedns.afraid.org/nic/update?hostname=[DOMAIN]&myip=[IP]"
}
}
{
"name": "afraid.org-keyauth",
"ipv4": {
"url": "https://freedns.afraid.org/dynamic/update.php?[PASSWORD]&address=[IP]"
},
"ipv6": {
"url": "https://freedns.afraid.org/dynamic/update.php?[PASSWORD]&address=[IP]"
}
}
{
"name": "afraid.org-v2-basic",
"ipv4": {
"url": "https://[USERNAME]:[PASSWORD]@sync.afraid.org/u/?h=[DOMAIN]&ip=[IP]"
},
"ipv6": {
"url": "https://[USERNAME]:[PASSWORD]@v6.sync.afraid.org/u/?h=[DOMAIN]&ip=[IP]"
}
}
{
"name": "afraid.org-v2-token",
"ipv4": {
"url": "https://sync.afraid.org/u/[PASSWORD]/?address=[IP]"
},
"ipv6": {
"url": "https://v6.sync.afraid.org/u/[PASSWORD]/?address=[IP]"
}
}
{
"name": "all-inkl.com",
"ipv4": {
"url": "http://[USERNAME]:[PASSWORD]@dyndns.kasserver.com/?myip=[IP]"
},
"ipv6": {
"url": "http://[USERNAME]:[PASSWORD]@dyndns.kasserver.com/?myip=[IP]"
}
}
{
"name": "changeip.com",
"ipv4": {
"url": "http://[USERNAME]:[PASSWORD]@nic.changeip.com/nic/update?u=[USERNAME]&p=[PASSWORD]&cmd=update&hostname=[DOMAIN]&ip=[IP]",
"answer": "Successful"
}
}
{
"name": "core-networks.de",
"ipv4": {
"url": "http://[USERNAME]:[PASSWORD]@dyndns.core-networks.de/?hostname=[DOMAIN]&myip=[IP]&keepipv6=1",
"answer": "good"
},
"ipv6": {
"url": "http://[USERNAME]:[PASSWORD]@dyndns.core-networks.de/?hostname=[DOMAIN]&myip=[IP]&keepipv4=1",
"answer": "good"
}
}
{
"name": "ddnss.de",
"ipv4": {
"url": "http://ip4.ddnss.de/upd.php?user=[USERNAME]&pwd=[PASSWORD]&host=[DOMAIN]&ip=[IP]",
"answer": "Updated|No change"
}
}
{
"name": "ddo.jp",
"ipv4": {
"url": "http://free.ddo.jp/dnsupdate.php?dn=[DOMAIN]&pw=[PASSWORD]&ip=[IP]"
}
}
{
"name": "desec.io",
"ipv4": {
"url": "https://update.dedyn.io/update?username=[USERNAME]&password=[PASSWORD]&hostname=[DOMAIN]&myipv4=[IP]&myipv6=preserve",
"answer": "good|nochg"
},
"ipv6": {
"url": "https://update.dedyn.io/update?username=[USERNAME]&password=[PASSWORD]&hostname=[DOMAIN]&myipv6=[IP]&myipv4=preserve",
"answer": "good|nochg"
}
}
{
"name": "dhis.org",
"ipv4": {
"url": "http://[USERNAME]:[PASSWORD]@is.dhis.org/"
},
"ipv6": {
"url": "http://[USERNAME]:[PASSWORD]@is.dhis.org/"
}
}
{
"name": "dnsdynamic.org",
"ipv4": {
"url": "http://[USERNAME]:[PASSWORD]@www.dnsdynamic.org/api/?hostname=[DOMAIN]&myip=[IP]",
"answer": "good|nochg"
}
}
{
"name": "dnsever.com",
"ipv4": {
"url": "http://[USERNAME]:[PASSWORD]@dyna.dnsever.com/update.php?host[[DOMAIN]]"
}
}
{
"name": "dnsexit.com",
"ipv4": {
"url": "http://update.dnsexit.com/RemoteUpdate.sv?login=[USERNAME]&password=[PASSWORD]&host=[DOMAIN]&myip=[IP]"
}
}
{
"name": "dnshome.de",
"ipv4": {
"url": "http://[USERNAME]:[PASSWORD]@www.dnshome.de/dyndns.php?hostname=[DOMAIN]&ip=[IP]"
},
"ipv6": {
"url": "http://[USERNAME]:[PASSWORD]@www.dnshome.de/dyndns.php?hostname=[DOMAIN]&ip6=[IP]"
}
}
{
"name": "dnsmadeeasy.com",
"ipv4": {
"url": "http://cp.dnsmadeeasy.com/servlet/updateip?username=[USERNAME]&password=[PASSWORD]&id=[DOMAIN]&ip=[IP]",
"answer": "success|ip-same"
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment