{"id":21355339,"url":"https://github.com/mrikirill/synologyddnscloudflaremultidomain","last_synced_at":"2025-04-09T05:08:57.912Z","repository":{"id":43468383,"uuid":"239058473","full_name":"mrikirill/SynologyDDNSCloudflareMultidomain","owner":"mrikirill","description":"Synology DDNS Cloudflare service provider with multidomains and subdomains","archived":false,"fork":false,"pushed_at":"2024-09-19T22:07:41.000Z","size":1708,"stargazers_count":497,"open_issues_count":15,"forks_count":78,"subscribers_count":18,"default_branch":"master","last_synced_at":"2025-04-02T03:18:05.261Z","etag":null,"topics":["cloudflare","cloudflare-ddns","ddns","ddns-updater","dms","multidomain","subdomain","synology"],"latest_commit_sha":null,"homepage":"https://mrikirill.github.io/SynologyDDNSCloudflareMultidomain/","language":"PHP","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":"2020-02-08T02:41:26.000Z","updated_at":"2025-03-18T05:15:30.000Z","dependencies_parsed_at":"2022-08-27T22:03:31.287Z","dependency_job_id":"c43ce1ad-4123-47b2-9d58-c03bcf452fc4","html_url":"https://github.com/mrikirill/SynologyDDNSCloudflareMultidomain","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrikirill%2FSynologyDDNSCloudflareMultidomain","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrikirill%2FSynologyDDNSCloudflareMultidomain/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrikirill%2FSynologyDDNSCloudflareMultidomain/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrikirill%2FSynologyDDNSCloudflareMultidomain/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mrikirill","download_url":"https://codeload.github.com/mrikirill/SynologyDDNSCloudflareMultidomain/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247980837,"owners_count":21027808,"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","dms","multidomain","subdomain","synology"],"created_at":"2024-11-22T04:16:53.414Z","updated_at":"2025-04-09T05:08:57.891Z","avatar_url":"https://github.com/mrikirill.png","language":"PHP","funding_links":["https://github.com/sponsors/mrikirill"],"categories":[],"sub_categories":[],"readme":"\n# Synology Dynamic DNS with Cloudflare for both multidomains and subdomains\n\n\u003e Documentation website: https://mrikirill.github.io/SynologyDDNSCloudflareMultidomain/\n\u003e \n\u003e [![Sponsor](https://img.shields.io/badge/sponsor-GitHub%20Sponsors-brightgreen)](https://github.com/sponsors/mrikirill)\n\n📢 *Check out the new native version of this agent, written in Kotlin -\u003e [KTSynologyDDNSCloudflareMultidomain](https://github.com/mrikirill/KTSynologyDDNSCloudflareMultidomain)* \n\n## Table of contents\n\n* 🆕 [What is new](#what-is-new)\n* [What this script does](#what-this-script-does)\n* [Before you begin](#before-you-begin)\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* [Support this project](#support-this-project)\n\n## What is new\n\n- 🆕 New hostname input format: `subdomain1.mydomain.com|subdomain2.mydomain.com` (each domain is separated: `|`) used to be with `---` separator\n- 🆕 Hostname input uses a new source of data (account) and support 256 symbols limit (DSM UI limit)\n- 🆕 Autodetect IPv6 addresses via [ipify.org](https://www.ipify.org)\n- 🆕 Optimised request to Cloudflare API\n- 🆕 Installer script\n\n## What this script does\n\n* A PHP script for Synology DSM (and potentially Synology SRM devices) adding support for Cloudflare to Network Centre \u003e Dynamic DNS (DDNS).\n* Supports single domains, multidomains, subdomains and regional domains, or any combination thereof (example: dev.my.domain.com.au, domain.com.uk etc)\n* 🆕 Easy installation process (added auto install script)\n* Based on CloudFlare API v4\n* [Supports dual stack IPv4 and IPv6](https://github.com/mrikirill/SynologyDDNSCloudflareMultidomain/pull/13)\n\n## Before you begin\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](https://github.com/mrikirill/SynologyDDNSCloudflareMultidomain/blob/master/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\tCase for if IpV6 is available (check via https://api6.ipify.org), you can create an AAAA record for the domain/zone(s) you wish to update with this script.\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](https://github.com/mrikirill/SynologyDDNSCloudflareMultidomain/blob/master/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\n4. *SRM users: Knowledge of vi:*\n\nvi is the only text editor available within the [Busybox](https://linux.die.net/man/1/busybox) environment available at the SSH command line on devices running SRM.\n\nFor assistance with vi commands, see:\n[Basic vi commands](https://www.cs.colostate.edu/helpdocs/vi.html)\n\n\n## How to install\n\n1. **SSH with root privileges 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](https://github.com/mrikirill/SynologyDDNSCloudflareMultidomain/blob/master/docs/example2.png)\n\n2. **Connect via SSH:** Connect to your supported device via SSH and execute command\n\n* 🆕 For DSM Users\n  ```\n  wget https://raw.githubusercontent.com/mrikirill/SynologyDDNSCloudflareMultidomain/master/install.sh -O install.sh \u0026\u0026 sudo bash install.sh\n  ```\n\n* 🆕 For SRM Users\n  Note: Ensure you are connected as root in your SSH session\n  ```\n  wget https://raw.githubusercontent.com/mrikirill/SynologyDDNSCloudflareMultidomain/master/install.sh -O install.sh \u0026\u0026 sudo bash install.sh\n  ```\n\n\t**Note:** For SRM users, you must connect to your device as root. No other username will allow these commands to run.\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](https://github.com/mrikirill/SynologyDDNSCloudflareMultidomain/blob/master/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. Don't forget to deactivate SSH (step 1) if you don't need it. Leaving it active can be a security risk.\n5. You're done! Optional, if you're happy with this script you could buy me ☕ or 🍺 here -\u003e [![Sponsor](https://img.shields.io/badge/sponsor-GitHub%20Sponsors-brightgreen)](https://github.com/sponsors/mrikirill)\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\nAfter system updates to either Synology DSM or SRM, you may find that:\n* __/usr/syno/bin/ddns/cloudflare.php__ has been deleted;\n* __/etc.defaults/ddns_provider.conf__ was reset to its default settings (settings for Cloudflare no longer included); and\n* The DDNS settings in your DDNS panel constantly show Cloudflare's status as loading.\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/usr/bin/php -d open_basedir=/usr/syno/bin/ddns -f /usr/syno/bin/ddns/cloudflare.php \"domain1.com|vpn.domain2.com\" \"your-CloudFlare-token\" \"\" \"your-ip-address\"\n```\n\n* Check output logs\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%2Fsynologyddnscloudflaremultidomain","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmrikirill%2Fsynologyddnscloudflaremultidomain","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrikirill%2Fsynologyddnscloudflaremultidomain/lists"}