Skip to content

Commit 7aef967

Browse files
Huizerdnachoparker
authored andcommitted
Namecheap dynamic DNS client
Signed-off-by: Huizerd <15855769+Huizerd@users.noreply.github.com>
1 parent 8d76a6b commit 7aef967

5 files changed

Lines changed: 133 additions & 3 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ Find the full documentation at [docs.nextcloudpi.com](http://docs.nextcloudpi.co
4646
* Dynamic DNS support for freeDNS
4747
* Dynamic DNS support for duckDNS
4848
* Dynamic DNS support for spDYN
49+
* Dynamic DNS support for Namecheap
4950
* dnsmasq DNS server with DNS cache
5051
* ModSecurity Web Application Firewall
5152
* NFS ready to mount your files over LAN

bin/ncp/NETWORKING/namecheapDNS.sh

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
#!/bin/bash
2+
3+
# Namecheap DNS updater client installation on Raspbian
4+
#
5+
# Copyleft 2020 by ndunks and Huizerd
6+
# GPL licensed (see end of file) * Use at your own risk!
7+
#
8+
# Based on:
9+
# - https://gist.github.com/ndunks/c756030c0757b667c9a478c97ca5a9b7
10+
# - https://www.namecheap.com/support/knowledgebase/article.aspx/29/11/how-do-i-use-a-browser-to-dynamically-update-the-hosts-ip
11+
#
12+
# Further steps to be taken:
13+
# - Buying a Namecheap domain
14+
# - https://www.namecheap.com/support/knowledgebase/article.aspx/595/11/how-do-i-enable-dynamic-dns-for-a-domain/
15+
# - https://www.namecheap.com/support/knowledgebase/article.aspx/43/11/how-do-i-set-up-a-host-for-dynamic-dns
16+
17+
18+
install()
19+
{
20+
apt-get update
21+
apt-get install --no-install-recommends -y dnsutils
22+
}
23+
24+
configure()
25+
{
26+
local updateurl=https://dynamicdns.park-your-domain.com/update
27+
local url="${updateurl}?host=${HOST}&domain=${DOMAIN}&password=${PASSWORD}"
28+
29+
[[ $ACTIVE != "yes" ]] && {
30+
rm -f /etc/cron.d/namecheapDNS
31+
service cron restart
32+
echo "Namecheap DNS client is disabled"
33+
return 0
34+
}
35+
36+
cat > /usr/local/bin/namecheapdns.sh <<EOF
37+
#!/bin/bash
38+
echo "Namecheap DNS client started"
39+
registeredIP=\$(dig +short "$FULLDOMAIN"|tail -n1)
40+
currentIP=\$(wget -q -O - http://checkip.dyndns.org|sed s/[^0-9.]//g)
41+
echo "${url}&ip=${currentIP}"
42+
[ "\$currentIP" != "\$registeredIP" ] && {
43+
wget -q -O /dev/null "${url}&ip=${currentIP}"
44+
}
45+
echo "Registered IP: \$registeredIP | Current IP: \$currentIP"
46+
EOF
47+
chmod +744 /usr/local/bin/namecheapdns.sh
48+
49+
echo "*/${UPDATEINTERVAL} * * * * root /bin/bash /usr/local/bin/namecheapdns.sh" > /etc/cron.d/namecheapDNS
50+
chmod 644 /etc/cron.d/namecheapDNS
51+
service cron restart
52+
53+
cd /var/www/nextcloud
54+
sudo -u www-data php occ config:system:set trusted_domains 3 --value="$FULLDOMAIN"
55+
sudo -u www-data php occ config:system:set overwrite.cli.url --value=https://"$FULLDOMAIN"/
56+
57+
echo "Namecheap DNS client is enabled"
58+
}
59+
60+
# License
61+
#
62+
# This script is free software; you can redistribute it and/or modify it
63+
# under the terms of the GNU General Public License as published by
64+
# the Free Software Foundation; either version 2 of the License, or
65+
# (at your option) any later version.
66+
#
67+
# This script is distributed in the hope that it will be useful,
68+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
69+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
70+
# GNU General Public License for more details.
71+
#
72+
# You should have received a copy of the GNU General Public License
73+
# along with this script; if not, write to the
74+
# Free Software Foundation, Inc., 59 Temple Place, Suite 330,
75+
# Boston, MA 02111-1307 USA

changelog.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11

2-
[v1.35.2](https://github.com/nextcloud/nextcloudpi/commit/3f345eb) (2021-04-29) ncp-web: fix display of big files for 32 bit
2+
[v1.36.0](https://github.com/nextcloud/nextcloudpi/commit/5709e46) (2020-09-16) Namecheap dynamic DNS client
3+
4+
[v1.35.2](https://github.com/nextcloud/nextcloudpi/commit/bfab195) (2021-04-29) ncp-web: fix display of big files for 32 bit
35

46
[v1.35.1 ](https://github.com/nextcloud/nextcloudpi/commit/e64ca34) (2021-04-29) ncp-web: fix backup download for big files in 32-bit
57

@@ -25,6 +27,8 @@
2527

2628
[v1.34.0 ](https://github.com/nextcloud/nextcloudpi/commit/ec428a2) (2021-01-01) upgrade to NC20.0.4
2729

30+
[v1.33.2 ](https://github.com/nextcloud/nextcloudpi/commit/82d00c8) (2021-01-01) ncp-config: fix empty values
31+
2832
[v1.33.1 ](https://github.com/nextcloud/nextcloudpi/commit/42fd597) (2020-12-12) nc-update-nc: improve error messages
2933

3034
[v1.33.0 ](https://github.com/nextcloud/nextcloudpi/commit/ffd0b44) (2020-12-10) upgrade to NC20.0.3
@@ -39,9 +43,11 @@
3943

4044
[v1.30.0 ](https://github.com/nextcloud/nextcloudpi/commit/f00fe21) (2020-09-19) upgrade to NC19.0.2
4145

42-
[v1.29.10](https://github.com/nextcloud/nextcloudpi/commit/82baebf) (2020-09-03) ncp-web: added a lot of german locales
46+
[v1.29.11](https://github.com/nextcloud/nextcloudpi/commit/82baebf) (2020-09-03) ncp-web: added a lot of german locales
47+
48+
[v1.29.10](https://github.com/nextcloud/nextcloudpi/commit/3706ed0) (2020-09-12) nc-previews: fix killing generate-all
4349

44-
[v1.29.9 ](https://github.com/nextcloud/nextcloudpi/commit/3706ed0) (2020-09-12) nc-previews: fix killing generate-all
50+
[v1.29.9 ](https://github.com/nextcloud/nextcloudpi/commit/9d65011) (2020-09-07) nc-restore: also set tempdirectory
4551

4652
[v1.29.8 ](https://github.com/nextcloud/nextcloudpi/commit/21a791d) (2020-08-30) nc-limits: minimum 6 PHP threads (for NC talk)
4753

etc/ncp-config.d/namecheapDNS.cfg

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{
2+
"id": "namecheapDNS",
3+
"name": "Dynamic DNS from Namecheap",
4+
"title": "namecheapDNS",
5+
"description": "Namecheap Dynamic DNS service (need domain from https://www.namecheap.com/)",
6+
"info": "First, complete these steps: https://www.namecheap.com/support/knowledgebase/article.aspx/595/11/how-do-i-enable-dynamic-dns-for-a-domain/ and https://www.namecheap.com/support/knowledgebase/article.aspx/43/11/how-do-i-set-up-a-host-for-dynamic-dns",
7+
"infotitle": "",
8+
"params": [
9+
{
10+
"id": "ACTIVE",
11+
"name": "Active",
12+
"value": "no",
13+
"type": "bool"
14+
},
15+
{
16+
"id": "PASSWORD",
17+
"name": "Password",
18+
"value": "",
19+
"suggest": "your_ddns_password",
20+
"type": "password"
21+
},
22+
{
23+
"id": "FULLDOMAIN",
24+
"name": "Full domain name",
25+
"value": "",
26+
"suggest": "mynextcloud.example.com"
27+
},
28+
{
29+
"id": "HOST",
30+
"name": "Host name",
31+
"value": "",
32+
"suggest": "mynextcloud"
33+
},
34+
{
35+
"id": "DOMAIN",
36+
"name": "Domain name",
37+
"value": "",
38+
"suggest": "example.com"
39+
},
40+
{
41+
"id": "UPDATEINTERVAL",
42+
"name": "Update interval (minutes)",
43+
"value": "30",
44+
"suggest": "30"
45+
}
46+
]
47+
}

i18n/README-zh_TW.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ NextCloudPi 是專門為 Raspberry Pi、Odroid HC1、rock64 以及其它單板
5151
* 可使用freeDNS 所提供的浮動IP連結功能
5252
* 可使用duckDNS 所提供的浮動IP連結功能
5353
* 可使用spDYN 所提供的浮動IP連結功能
54+
* 可使用Namecheap DNS 所提供的浮動IP連結功能
5455
* 內建 dnsmasq DNS 伺服器快取
5556
* ModSecurity 網路應用程式防火牆
5657
* NFS ready to mount your files over LAN

0 commit comments

Comments
 (0)