Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added dynu.com as dynamic DNS updater #1410

Open
wants to merge 3 commits into
base: devel
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions bin/ncp/NETWORKING/dynuDNS.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
#!/bin/bash

# DynuDNS updater client installation on Raspbian
#
# Copyleft 2022 by Stefano Guandalini <guandalf _a_t_ protonmail _d_o_t_ com>
# GPL licensed (see end of file) * Use at your own risk!
#



install()
{
apt-get update
apt-get install --no-install-recommends -y dnsutils
}

configure()
{
local updateurl=https://api.dynu.com/nic/update
local url="${updateurl}?hostname=${DOMAIN}&myipv6=${MYIPV6}&password=${PASSWORD}"

[[ $ACTIVE != "yes" ]] && {
rm -f /etc/cron.d/dynuDNS
service cron restart
echo "dynuDNS client is disabled"
return 0
}

cat > /usr/local/bin/dynudns.sh <<EOF
#!/bin/bash
echo "DynuDNS client started"
echo "${url}"
registeredIP=\$(dig +short "$DOMAIN"|tail -n1)
currentIP=\$(wget -q -O - http://checkip.dyndns.org|sed s/[^0-9.]//g)
[ "\$currentIP" != "\$registeredIP" ] && {
wget -q -O /dev/null "${url}"
}
echo "Registered IP: \$registeredIP | Current IP: \$currentIP"
EOF
chmod +744 /usr/local/bin/dynudns.sh

echo "*/${UPDATEINTERVAL} * * * * root /bin/bash /usr/local/bin/dynudns.sh" > /etc/cron.d/dynuDNS
chmod 644 /etc/cron.d/dynuDNS
service cron restart

set-nc-domain "$DOMAIN"

echo "DynuDNS client is enabled"
}

# License
#
# This script is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This script is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this script; if not, write to the
# Free Software Foundation, Inc., 59 Temple Place, Suite 330,
# Boston, MA 02111-1307 USA
40 changes: 40 additions & 0 deletions etc/ncp-config.d/dynuDNS.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"id": "dynuDNS",
"name": "Dynamic DNS from dynuDNS",
"title": "dynuDNS",
"description": "DynuDNS DynamicDNS service",
"info": "Need account from https://www.dynu.com/",
"infotitle": "",
"params": [
{
"id": "ACTIVE",
"name": "Active",
"value": "no",
"type": "bool"
},
{
"id": "PASSWORD",
"name": "Password (better UpdateIP hashed)",
"value": "",
"suggest": "abcdefghijklmnopqrstuvwxyzABCDEFGHIJK1234567"
},
{
"id": "MYIPV6",
"name": "IPv6 address (no == no update)",
"value": "no",
"suggest": "IPv6 address or 'no' not to update"
},
{
"id": "DOMAIN",
"name": "Domain",
"value": "mynextcloud.example.com",
"suggest": "mynextcloud.example.com"
},
{
"id": "UPDATEINTERVAL",
"name": "Update periodicity (in minutes)",
"value": "30",
"suggest": "30"
}
]
}
8 changes: 7 additions & 1 deletion updates/1.46.0.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#!/bin/bash

set -e

# docker images only
[[ -f /.docker-image ]] && {
Expand All @@ -8,7 +11,7 @@ ncc notify_push:self-test || {
killall notify_push
sleep 1
start_notify_push
}"
}
EOF
chmod +x /etc/cron.daily/refresh_notify_push
}
Expand Down Expand Up @@ -41,3 +44,6 @@ EOF
systemctl enable refresh_notify_push.{path,service}
systemctl restart refresh_notify_push.path
}


exit 0