|
1 | | -Synology DDNS Cloudflare with multidomains and subdomains |
2 | | -======================== |
3 | 1 |
|
4 | | -Update note |
5 | | ---------------- |
6 | | -I've mentioned that after Synology DSM update, the file __/usr/syno/bin/ddns/cloudflare.php__ has been deleted and __/etc.defaults/ddns_provider.conf__ reset to default settings. |
| 2 | +# Synology Dynamic DNS with Cloudflare for both multidomains and subdomains |
7 | 3 |
|
8 | | -For that case you need just repeat all installations steps. |
| 4 | +## Table of contents |
9 | 5 |
|
10 | | -The list of default Cloudflare ports |
11 | | ---------------- |
| 6 | +* [Update note](#update-note) |
| 7 | +* [Default Cloudflare ports](#default-cloudflare-ports) |
| 8 | +* [What this script does](#what-this-script-does) |
| 9 | +* [Before you begin](#before-you-begin) |
| 10 | +* [Example](#example) |
| 11 | +* [How to install](#how-to-install) |
| 12 | +* [Troubleshooting](#troubleshooting) |
| 13 | + + [Error returned, such as 1020 error; or update attempt not showing in Cloudflare Audit logs?](#error-returned--such-as-1020-error--or-update-attempt-not-showing-in-cloudflare-audit-logs-) |
12 | 14 |
|
13 | | -HTTP ports supported by Cloudflare: |
| 15 | +## Update note |
14 | 16 |
|
15 | | -80 |
16 | | -8080 |
17 | | -8880 |
18 | | -2052 |
19 | | -2082 |
20 | | -2086 |
21 | | -2095 |
| 17 | +*Reinstall may be required after updating DSM* |
| 18 | +After updates to Synology DSM, you may find the file __/usr/syno/bin/ddns/cloudflare.php__ has been deleted, and __/etc.defaults/ddns_provider.conf__ reset to default settings. |
22 | 19 |
|
23 | | -HTTPS ports supported by Cloudflare: |
| 20 | +If this occurs, simply repeat the installations steps below. |
24 | 21 |
|
25 | | -443 |
26 | | -2053 |
27 | | -2083 |
28 | | -2087 |
29 | | -2096 |
30 | | -8443 |
| 22 | +## Default Cloudflare ports |
31 | 23 |
|
32 | | -Description |
33 | | ---------------- |
34 | | -* A PHP script for Synology DSM which adds Cloudflare DDNS support in your DMS |
35 | | -* Supports multidomains, subdomains and also regional domains (example: dev.my.domain.com.au, domain.com.uk etc) |
| 24 | +|HTTP ports supported by Cloudflare | HTTPS ports supported by Cloudflare | |
| 25 | +|--|--| |
| 26 | +| 80 | 443 | |
| 27 | +| 8080 | 2053 | |
| 28 | +| 8880 | 2083 | |
| 29 | +| 2052 | 2087 | |
| 30 | +| 2082 | 2096 | |
| 31 | +| 2086 | 8443 | |
| 32 | +| 2095 | | |
| 33 | + |
| 34 | + |
| 35 | +## What this script does |
| 36 | + |
| 37 | +* A PHP script for Synology DSM (and potentially Synology SRM devices) adding support for Cloudflare to Network Centre > Dynamic DNS (DDNS). |
| 38 | +* Supports single domains, multidomains, subdomains and regional domains, or any combination thereof (example: dev.my.domain.com.au, domain.com.uk etc) |
36 | 39 | * Easy instalation process |
37 | 40 | * Based on CloudFlare API v4 |
38 | 41 |
|
39 | | -Before start to use this script |
40 | | ---------------- |
41 | | -* Have a Cloudflare account with active domains |
42 | | -* Have A Records |
| 42 | +## Before you begin |
| 43 | + |
| 44 | +Before starting the installation process, make sure you have (and know) the following information, or have completed these steps: |
| 45 | + |
| 46 | + 1. *Cloudflare credentials* |
| 47 | + a. Know your Cloudflare account username (or [register for an account if you're new to Cloudflare](https://dash.cloudflare.com/sign-up)); and |
| 48 | + b. Have your [Global API key](https://dash.cloudflare.com/profile/api-tokens) (More info: [Global API keys](https://support.cloudflare.com/hc/en-us/articles/200167836-Managing-API-Tokens-and-Keys)). |
| 49 | + 2. *DNS settings:* |
| 50 | + Ensure 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)) |
| 51 | + |
| 52 | +## Example |
43 | 53 |
|
44 | | -Example |
45 | | ---------------- |
46 | 54 |  |
47 | 55 |
|
48 | | -Installation |
49 | | ----------------- |
50 | | -1. Activate SSH in DMS (__Control Panel -> Terminal & SNMP -> Enable SSH service__) |
51 | | - |
| 56 | +## How to install |
| 57 | + |
| 58 | +1. **Activate SSH on your supported device:** |
| 59 | + a. For DSM Users: Navigate to __Control Panel > Terminal & SNMP > Enable SSH service__ |
| 60 | + b. For SRM users: Navigate to __Control Panel > Services > System Services > Terminal > Enable SSH service__ |
| 61 | + |
| 62 | +  |
| 63 | + |
| 64 | +2. **Connect via SSH:** Connect to your supported device via SSH and execute command |
| 65 | + |
| 66 | +* For DSM Users |
| 67 | + ``` |
| 68 | + wget https://raw.githubusercontent.com/mrikirill/SynologyDDNSCloudflareMultidomain/master/cloudflare.php -O /usr/syno/bin/ddns/cloudflare.php && sudo chmod 755 /usr/syno/bin/ddns/cloudflare.php |
| 69 | + ``` |
| 70 | + |
| 71 | +* For SRM Users |
| 72 | + Note: Ensure you are connected as root in your SSH session |
| 73 | + ``` |
| 74 | + wget https://raw.githubusercontent.com/mrikirill/SynologyDDNSCloudflareMultidomain/master/cloudflare.php -O /usr/syno/bin/ddns/cloudflare.php && chmod 755 /usr/syno/bin/ddns/cloudflare.php |
| 75 | + ``` |
| 76 | + |
| 77 | + **Note:** For SRM users, you must connect to your device as root. No other username will allow these commands to run. |
| 78 | + |
| 79 | +3. **Update DDNS provider list:** Using your preferred/available command line editor, insert the text below to your DMS file (Location : __/etc.defaults/ddns_provider.conf__), to add DDNS support via Cloudflare: |
| 80 | + |
| 81 | + ``` |
| 82 | + [Cloudflare] |
| 83 | + modulepath=/usr/syno/bin/ddns/cloudflare.php |
| 84 | + queryurl=https://www.cloudflare.com/ |
| 85 | + ``` |
| 86 | + |
| 87 | + Note: For SRM users, break out this [Vim cheat sheet](https://coderwall.com/p/adv71w/basic-vim-commands-for-getting-started), as it's the only text editor available to you. |
| 88 | + |
| 89 | +4. **Update your DDNS settings:** |
| 90 | + |
| 91 | + a. *For DSM Users:* Navigate to __Control Panel > External Access > DDNS__ then add new DDNS |
| 92 | + b. *For SRM users:* Navigate to __Network Centre > Internet > QuickConnect & DDNS > DDNS__ and press the Add button: |
| 93 | + |
| 94 | + Add/Update the DDNS settings screen as follows: |
52 | 95 |
|
53 | | -2. Connect via SSH and execute command |
| 96 | + * Service provider: Select Cloudflare |
| 97 | + * Hostname: |
| 98 | + For a single domain: __mydomain.com__ |
| 99 | +For multiple domains: __subdomain.mydomain.com---vpn.mydomain.com__ |
| 100 | + (ensure each domain is seperated by three dashes: ---) |
| 101 | + * Username: The email address you use for logging in to Cloudflare. |
| 102 | + * Password: Your Cloudflare Global API Key |
54 | 103 |
|
55 | | -``` |
56 | | -wget https://raw.githubusercontent.com/mrikirill/SynologyDDNSCloudflareMultidomain/master/cloudflare.php -O /usr/syno/bin/ddns/cloudflare.php && sudo chmod 755 /usr/syno/bin/ddns/cloudflare.php |
57 | | -``` |
| 104 | +  |
58 | 105 |
|
59 | | -3. Add Cloudflare to the list of DDNS providers DMS file(Location : __/etc.defaults/ddns_provider.conf__) |
| 106 | + Finally, press the test connection button to confirm all information is correctly entered, before pressing Ok to save and confirm your details. |
60 | 107 |
|
61 | | -``` |
62 | | -[Cloudflare] |
63 | | - modulepath=/usr/syno/bin/ddns/cloudflare.php |
64 | | - queryurl=https://www.cloudflare.com/ |
65 | | -``` |
| 108 | +5. Enjoy 🍺 and __don't forget to deactivate SSH (step 1) if you don't need it__. |
66 | 109 |
|
67 | | -5. Than go to DMS settingS __Control Panel -> External Access -> DDNS__ and add new DDNS: |
| 110 | +## Troubleshooting |
68 | 111 |
|
69 | | -* Select Cloudflare as a service provider |
70 | | -* Set in __hostname__ field your list of domains divided by __---__ example: __mydoman.com---subdomain.mydomain.com---vpn.mydomain.com__ or simple: __mydomain.com__ |
71 | | -* Set your Cloudflare acoount email into __Username/Email__ field |
72 | | -* Set Cloudflare Global API Key into __Password/Key__ field (See: [https://dash.cloudflare.com/profile/api-tokens](https://dash.cloudflare.com/profile/api-tokens)) |
| 112 | +### Error returned, such as 1020 error; or update attempt not showing in Cloudflare Audit logs? |
| 113 | +That generally means you've not entered something correctly in the DDNS screen for your domain. |
73 | 114 |
|
74 | | - |
| 115 | +Revisit Step 4 in How to install, and make sure everything is correctly entered. |
75 | 116 |
|
76 | | -6. Enjoy 🍺 and __don't forget to deactivate SSH (step 1) if you don't need it__ |
| 117 | +And 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. |
0 commit comments