{"id":22840880,"url":"https://github.com/namescode/ddnsh","last_synced_at":"2025-03-31T04:37:43.146Z","repository":{"id":265871069,"uuid":"851305037","full_name":"NamesCode/ddnsh","owner":"NamesCode","description":"A minimal POSIX shell script to update your dynamic ip in DNS records","archived":false,"fork":false,"pushed_at":"2024-09-05T00:55:56.000Z","size":10,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-24T11:00:49.130Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/NamesCode.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-09-02T20:50:33.000Z","updated_at":"2024-09-05T00:58:06.000Z","dependencies_parsed_at":"2024-12-01T10:07:24.412Z","dependency_job_id":null,"html_url":"https://github.com/NamesCode/ddnsh","commit_stats":null,"previous_names":["namescode/ddnsh"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NamesCode%2Fddnsh","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NamesCode%2Fddnsh/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NamesCode%2Fddnsh/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NamesCode%2Fddnsh/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NamesCode","download_url":"https://codeload.github.com/NamesCode/ddnsh/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246418698,"owners_count":20773935,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-13T01:13:55.067Z","updated_at":"2025-03-31T04:37:43.105Z","avatar_url":"https://github.com/NamesCode.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DDNSH\n\nA minimal POSIX shell script to update your DNS entries in the case that your dynamic IP updates.\nIdeally run as a cron job.\n\nThis script should work on Linux, *BSD and any other POSIX system.\nCurrently, It only supports updating records from Cloudflare. \nOther DNS providers can be supported in future if an issue gets risen for them, and they have a REST API.\n\n## Dependencies\n\nYou will need:\n- curl\n- jq\n\nCurl is often preinstalled on most Linux systems, however it is not on *BSD systems.\nConsult your package manager on how to install curl if it is not installed already.\n\n## Installation\n\n```sh\ncurl -s -o ./ddnsh.sh https://raw.githubusercontent.com/NamesCode/ddnsh/main/ddnsh.sh;\nchmod +x ./ddnsh.sh\n```\n\n## Usage\n\n\n### With Cloudflare\n\n#### Record comments\n\nIn order for DDNSH to know which records it should update it uses comments on the records which can get queried.\nTo get DDNSH working for your A/AAAA records all you have to do is add `DDNSH-[The hostname of your machine from uname -n]`.\n\nThe hostname is added so that you can run DDNSH across multiple networks with dynamic IP's for the same domain.\n\nExample:\n```sh\n# On your machine\nWeb@ServerBox\u003e uname -n\nServerBox\n\n# In the record comment\nDDNSH-ServerBox\n```\n\n#### Env vars\n\nFirstly, you will have to find your domains [zone id](https://developers.cloudflare.com/fundamentals/setup/find-account-and-zone-ids/).\nSecondly you're going to need an [API token](https://dash.cloudflare.com/profile/api-tokens).\n\nI recommend you use the Zone DNS template for the token.\nThe token will need to have Zone DNS editing access.\nThe rest it up to you, however I would recommend making a token for each specific domain and setting the TTL to be **at most** 6 months.\n\nOnce you have both of these, you'll have to pass them in with the DDNSH_CF env vars.\n```sh\n# Run first to disable shell history. Not doing so will leak your api secrets in plaintext to $HISTFILE.\nHISTFILE_COPY=\"$HISTFILE\" HISTFILE=\"/dev/null\"\n\n# Run this line as many times as you need for each domain.\nDDNSH_CF_ZONEID=\"yourzoneid\" DDNSH_CF_APIKEY=\"yourcloudflareapikey\" ./ddnsh.sh\n\n# Run when your finished to turn back on shell history.\nHISTFILE=\"$HISTFILE_COPY\" unset HISTFILE_COPY\n```\n\n## Quick start\n\nI recommend using this quick setup script if you want something opinionated that \"just works\"™.\nThis will install the script at `~/.local/bin/` and create a crontab for this user running this script every 5 minutes.\nIdeally this should be run on the same user that your web facing server is run on.\n\n```sh\nmkdir ~/.local; \\\nmkdir ~/.local/bin/; \\\ncurl -s -o ~/.local/bin/ddnsh.sh https://raw.githubusercontent.com/NamesCode/ddnsh/main/ddnsh.sh; \\\nchmod +x ~/.local/bin/ddnsh.sh; \\\n(crontab -l; echo \"DDNSH_CF_ZONEID='yourzoneid'\nDDNSH_CF_APIKEY='yourcloudflareapikey'\n*/5 * * * * /home/$USER/.local/bin/ddnsh.sh \u003e /dev/null\") | crontab -\n```\n\n**NOTE**: This quick start script will **ONLY** work if your cron allows setting env vars inside itself. \nCrons that are known **TO** work are:\n- Vixie-cron\n- GNU mcron\n\nCrons that are known **NOT TO** work are:\n- Cronie\n\nVixie-cron is the most widely used which makes it good enough for me to put in the quick start,\n**HOWEVER** if you are no running one of the compatible crons then you'll have to follow the standard install guide.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnamescode%2Fddnsh","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnamescode%2Fddnsh","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnamescode%2Fddnsh/lists"}