{"id":15040987,"url":"https://github.com/mrikirill/ktsynologyddnscloudflaremultidomain","last_synced_at":"2025-04-14T19:34:19.462Z","repository":{"id":257185797,"uuid":"857562543","full_name":"mrikirill/KTSynologyDDNSCloudflareMultidomain","owner":"mrikirill","description":"Native DDNS Cloudflare agent for Synology DSM and SRM with support for multidomains and subdomains","archived":false,"fork":false,"pushed_at":"2025-01-05T22:18:15.000Z","size":1053,"stargazers_count":15,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-28T07:51:15.673Z","etag":null,"topics":["cloudflare","cloudflare-ddns","ddns","ddns-updater","kmp","kotlin","kotlin-native","native","subdomain","synology"],"latest_commit_sha":null,"homepage":"https://mrikirill.github.io/KTSynologyDDNSCloudflareMultidomain/","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mrikirill.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":"mrikirill"}},"created_at":"2024-09-15T01:30:52.000Z","updated_at":"2025-03-18T05:16:41.000Z","dependencies_parsed_at":null,"dependency_job_id":"d4f2a096-890f-4eb1-ae54-f43c2e9ecd41","html_url":"https://github.com/mrikirill/KTSynologyDDNSCloudflareMultidomain","commit_stats":{"total_commits":8,"total_committers":1,"mean_commits":8.0,"dds":0.0,"last_synced_commit":"e0cf13b3dd90fce22fab5ab4e2f1d9a62d1b67cf"},"previous_names":["mrikirill/ktsynologyddnscloudflaremultidomain"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrikirill%2FKTSynologyDDNSCloudflareMultidomain","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrikirill%2FKTSynologyDDNSCloudflareMultidomain/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrikirill%2FKTSynologyDDNSCloudflareMultidomain/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrikirill%2FKTSynologyDDNSCloudflareMultidomain/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mrikirill","download_url":"https://codeload.github.com/mrikirill/KTSynologyDDNSCloudflareMultidomain/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248946438,"owners_count":21187504,"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":["cloudflare","cloudflare-ddns","ddns","ddns-updater","kmp","kotlin","kotlin-native","native","subdomain","synology"],"created_at":"2024-09-24T20:45:22.290Z","updated_at":"2025-04-14T19:34:19.453Z","avatar_url":"https://github.com/mrikirill.png","language":"Kotlin","funding_links":["https://github.com/sponsors/mrikirill"],"categories":[],"sub_categories":[],"readme":"[![Unit tests](https://github.com/mrikirill/KTSynologyDDNSCloudflareMultidomain/actions/workflows/test.yml/badge.svg)](https://github.com/mrikirill/KTSynologyDDNSCloudflareMultidomain/actions/workflows/test.yml)\n\n# Synology Dynamic DNS Native Agent for Cloudflare (Multidomains \u0026 Subdomains)\n\nThis project is based on my PHP version of the agent: https://github.com/mrikirill/SynologyDDNSCloudflareMultidomain\n\nDocumentation website: https://mrikirill.github.io/KTSynologyDDNSCloudflareMultidomain/\n\n[![Sponsor](https://img.shields.io/badge/sponsor-GitHub%20Sponsors-brightgreen)](https://github.com/sponsors/mrikirill)\n\n## Why this project?\n\nThe idea of this project is to provide a native agent for [Synology DSM](https://www.synology.com/en-global/dsm) and [SRM](https://www.synology.com/en-global/srm) devices ([read SRM support first](#srm-support)) to update Cloudflare DNS records without requiring any dependencies.\n\nThis project is based on [the original PHP version of the agent](https://github.com/mrikirill/SynologyDDNSCloudflareMultidomain) but is written in [Kotlin Native](https://kotlinlang.org/docs/native-overview.html) and does not require the JVM. The agent is a standalone executable file that doesn't rely on system dependencies, which is the main difference from the PHP version. Additionally, it includes unit tests covering the main logic of the agent.\n\n## Stack\n\n- [Kotlin Native](https://kotlinlang.org/docs/native-overview.html) with target [linuxX64 and linuxArm64](https://kotlinlang.org/docs/native-target-support.html#tier-2)\n- [Ktor Client Curl Engine](https://ktor.io/docs/client-engines.html#curl)\n\n## Table of contents\n\n* [What this native agent does](#what-this-native-agent-does)\n* [SRM Support](#srm-support)\n* [Build the agent locally](#build-the-agent-locally)\n* [Before you start](#before-you-start)\n* [How to install](#how-to-install)\n* [Troubleshooting and known issues](#troubleshooting-and-known-issues)\n  + [CloudFlare API free domains limitation](#cloudflare-api-free-domains-limitation)\n  + [Connection test failed or error returned](#connection-test-failed-or-error-returned)\n  + [Cloudflare no longer listed as a DDNS provider after a DSM update](#cloudflare-no-longer-listed-as-a-ddns-provider-after-dsm-or-srm-updates)\n* [Default Cloudflare ports](#default-cloudflare-ports)\n* [Debug script](#debug)\n* [Output messages](#output-messages)\n* [Credits](#credits)\n* [Support this project](#support-this-project)\n\n\n## What this native agent does\n\n* Works as a standalone executable file.\n* Functionality remains consistent with the [PHP version of the agent](https://github.com/mrikirill/SynologyDDNSCloudflareMultidomain).\n* Designed for Synology DSM and [Synology SRM devices](#srm-support) to integrate Cloudflare support into `Network Centre \u003e Dynamic DNS (DDNS)`.\n* Supports single domains, multidomains, subdomains, regional domains, or any combination etc (e.g., dev.my.domain.com.au, domain.com.uk, etc.).\n* Simple installation process.\n* Based on [CloudFlare API v4](https://developers.cloudflare.com/api)\n* Use [ipify.org](https://www.ipify.org) to detect IPv6\n* Compatible with both IPv4 and IPv6 dual stack.\n\n## SRM Support\n[SRM-based devices](#https://www.synology.com/en-global/products/routers) use the Linux Arm64 architecture. The agent has a build target for Linux Arm64 and should work on SRM devices. However, it needs to be built locally and tested on SRM devices. Currently, it has not been tested on SRM devices, and there is no established build process for Linux Arm64.\n\n## Build the agent locally\n\n1. Kotlin Native Documentation [here](https://kotlinlang.org/docs/native-get-started.html)\n\n2. Clone the repository\n\n3. Run the following command to build the agent\n\n```\n./gradlew build\n```\n\nNote: cause the agent includes the Ktor Client Curl Engine it requires extra steps documented [here](https://ktor.io/docs/client-engines.html#curl)\n\n## Before you start\n\nBefore starting the installation process, make sure you have (and know) the following information, or have completed these steps:\n\n 1. *Cloudflare credentials:*\n \n\t a. Know your Cloudflare account username (or [register for an account if you're new to Cloudflare](https://dash.cloudflare.com/sign-up)); and\n\t \n\t b. Have your [API key](https://dash.cloudflare.com/profile/api-tokens) - no need to use your Global API key! (More info: [API keys](https://support.cloudflare.com/hc/en-us/articles/200167836-Managing-API-Tokens-and-Keys)).\n\n\t![image](/docs/example4.png)\n\n\n\t c. Create a API key with following (3) permissions:\n\t \n\t **Zone** \u003e **Zone.Settings** \u003e **Read**  \n\t **Zone** \u003e **Zone** \u003e **Read**  \n\t **Zone** \u003e **DNS** \u003e **Edit**  \n\n\t The affected zone ressouces have to be (at least):\n\n\t**Include** \u003e **All zones from an account** \u003e `\u003cdomain\u003e`  \n\n 2. *DNS settings:*\n \n\tEnsure the DNS A record(s) for the domain/zone(s) you wish to update with this script have been created (More information: [Managing DNS records](https://support.cloudflare.com/hc/en-us/articles/360019093151-Managing-DNS-records-in-Cloudflare)).\n\n\tYour DNS records should appear (or already be setup as follows) in Cloudflare:\n\t\n\t(Note: Having Proxied turned on for your A records isn't necessary, but it will prevent those snooping around from easily finding out your current IP address)\n\n\t![image](/docs/example1.png)\n\t\n3. *SSH access to your Synology device:*\n\nIf you haven't setup this access, see the following Synology Knowledge Base article:\n[How can I sign in to DSM/SRM with root privilege via SSH?[(https://kb.synology.com/en-id/DSM/tutorial/How_to_login_to_DSM_with_root_permission_via_SSH_Telnet)\n\n\n## How to install\n\n1. **SSH with sudo on your supported device:**\n\n\t a. For DSM Users:\n\t \n\t Navigate to __Control Panel \u003e Terminal \u0026 SNMP \u003e Enable SSH service__\n\t \n\t b. For SRM users:\n\t \n\t Navigate to __Control Panel \u003e Services \u003e System Services \u003e Terminal \u003e Enable SSH service__\n\t \n\t![image](/docs/example2.png)\n\n2. **Connect via SSH:** Connect to your supported device via SSH and run this command:\n\n  ```\n  wget https://raw.githubusercontent.com/mrikirill/KTSynologyDDNSCloudflareMultidomain/master/install.sh -O install.sh \u0026\u0026 sudo bash install.sh\n  ```\n\n\n3. **Update your DDNS settings:** \n\n\t a. *For DSM Users:* Navigate to __Control Panel \u003e External Access \u003e DDNS__ then add new DDNS\n\t \n\t b. *For SRM users:* Navigate to __Network Centre \u003e Internet \u003e QuickConnect \u0026 DDNS \u003e DDNS__ and press the Add button:\n\n\tAdd/Update the DDNS settings screen as follows:\n\n\t* Service provider: Select Cloudflare\n    * Hostname: this field is not used anymore, you can put any value here\n\t* Username:\nFor a single domain: __mydomain.com__\nFor multiple domains: __subdomain.mydomain.com|vpn.mydomain.com__\n\t  (ensure each domain is separated: `|`)\n    \n        __Note: there is 256 symbols limit on Hostname input__\n\t* Password: Your created Cloudflare API Key\n\n\t![image](/docs/example3.png)\n\n\tFinally, press the test connection button to confirm all information is correctly entered, before pressing Ok to save and confirm your details.\n\n4. Enjoy 🍺 and __don't forget to deactivate SSH (step 1) if you don't need it__.\n\n## Troubleshooting and known issues\n\n### CloudFlare API free domains limitation\n\nCloudFlare API doesn't support domains with a .cf, .ga, .gq, .ml, or .tk TLD (top-level domain)\n\nFor more details read here: https://github.com/mrikirill/SynologyDDNSCloudflareMultidomain/issues/28 and https://community.cloudflare.com/t/unable-to-update-ddns-using-api-for-some-tlds/167228/61\n\nResponse example:\n\n```\n{\n  \"result\": null,\n  \"success\": false,\n  \"errors\": [\n    {\n      \"code\": 1038,\n      \"message\": \"You cannot use this API for domains with a .cf, .ga, .gq, .ml, or .tk TLD (top-level domain). To configure the DNS settings for this domain, use the Cloudflare Dashboard.\"\n    }\n  ],\n  \"messages\": []\n}\n```\n\n### Connection test failed or error returned\n\nThis will manifest as either 1020 error; or the update attempt not showing in your Cloudflare Audit logs.\n\nThat generally means you may not have entered something correctly in the DDNS screen for your domain(s).\n\nRevisit [Before you begin](#before-you-begin) to ensure you have all the right information, then go back to Step 4 in [How to install](#how-to-install) to make sure everything is correctly entered.\n\n**Handy hint:** You can also check your Cloudflare Audit logs to see what - if anything - has made it there with your API key (More information: [Understanding Cloudflare Audit Logs](https://support.cloudflare.com/hc/en-us/articles/115002833612-Understanding-Cloudflare-Audit-Logs)). Updates using the API will appear in the Audit logs as a Rec Set action.\n\n### Cloudflare no longer listed as a DDNS provider after DSM or SRM updates\n\nIf this occurs, simply [repeat the How to install steps](#how-to-install) shown above.\n\n## Default Cloudflare ports\nSource [Identifying network ports compatible with Cloudflare's proxy](https://support.cloudflare.com/hc/en-us/articles/200169156-Identifying-network-ports-compatible-with-Cloudflare-s-proxy)\n\n| HTTP ports supported by Cloudflare | HTTPS ports supported by Cloudflare |\n|------------------------------------|-------------------------------------|\n| 80                                 | 443                                 |\n| 8080                               | 2053                                | \n| 8880                               | 2083                                |\n| 2052                               | 2087                                | \n| 2082                               | 2096                                |\n| 2086                               | 8443                                | \n| 2095                               |                                     |\n\n## Debug\n\nYou can run this script directly to see output logs\n\n* SSH into your Synology system \n\n* Run this command: \n\n```\n./KTSynologyDDNSCloudflareMultidomain.kexe \"domain1.com|vpn.domain2.com\" \"your-Cloudflare-token\" \"any\" \"1.2.3.4 - ipv4 address\"\n```\n\n* Check output logs\n\n## Output messages\n\nFrom `/etc.defaults/ddns_provider.conf`:\n\n\u003e When you write your own module, you can use the following words to tell user what happen by print it.\n\u003e You can use your own message, but there is no multiple-language support.\n\n\u003e`good` -  Update successfully.\n\u003e\n\u003e`nochg` - Update successfully but the IP address have not changed.\n\u003e\n\u003e`nohost` - The hostname specified does not exist in this user account.\n\u003e\n\u003e`abuse` - The hostname specified is blocked for update abuse.\n\u003e\n\u003e`notfqdn` - The hostname specified is not a fully-qualified domain name.\n\u003e\n\u003e`badauth` - Authenticate failed.\n\u003e\n\u003e`911` - There is a problem or scheduled maintenance on provider side\n\u003e\n\u003e`badagent` - The user agent sent bad request(like HTTP method/parameters is not permitted)\n\u003e\n\u003e`badresolv` - Failed to connect to  because failed to resolve provider address.\n\u003e\n\u003e`badconn` - Failed to connect to provider because connection timeout.\n\n## Credits\n\n[MKDoc - generate documentation](https://www.mkdocs.org)\n\n## Support this project\n\nIf you find this project helpful, please support it here [![Sponsor](https://img.shields.io/badge/sponsor-GitHub%20Sponsors-brightgreen)](https://github.com/sponsors/mrikirill)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrikirill%2Fktsynologyddnscloudflaremultidomain","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmrikirill%2Fktsynologyddnscloudflaremultidomain","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrikirill%2Fktsynologyddnscloudflaremultidomain/lists"}