From 0c63c84e505033474368b7842e271ee8614c9e51 Mon Sep 17 00:00:00 2001 From: Indrajit Raychaudhuri Date: Fri, 21 Apr 2023 00:51:34 -0500 Subject: dns: T5144: Improve dynamic DNS validations and completions Apply validations and completions to dynamic DNS protocols supported. This also opens up additional protocols supported by ddclient 3.10. Additional details: - Validation and constraint have been added for interface names as well. - While at it, the help texts got some copyedit and rewording. --- interface-definitions/dns-dynamic.xml.in | 116 +++++------------------------- src/completion/list_ddclient_protocols.sh | 17 +++++ src/validators/ddclient-protocol | 24 +++++++ 3 files changed, 60 insertions(+), 97 deletions(-) create mode 100755 src/completion/list_ddclient_protocols.sh create mode 100755 src/validators/ddclient-protocol diff --git a/interface-definitions/dns-dynamic.xml.in b/interface-definitions/dns-dynamic.xml.in index 58dd48f9d..3e77e2540 100644 --- a/interface-definitions/dns-dynamic.xml.in +++ b/interface-definitions/dns-dynamic.xml.in @@ -14,10 +14,17 @@ - Interface to send DDNS updates for + Interface to send Dynamic DNS updates for + + txt + Interface name + + + #include + @@ -127,144 +134,59 @@ - Hostname registered with DDNS service + Hostname to register with Dynamic DNS service - Login for DDNS service + Login for Dynamic DNS service (not used by all protocols, or referred as api-token in some cases) - Password for DDNS service + Password for Dynamic DNS service (referred as api-token, global-token or api-secret in some cases) - ddclient protocol used for DDNS service + ddclient protocol used for Dynamic DNS service - changeip cloudflare dnsmadeeasy dnspark dondominio dslreports1 dtdns duckdns dyndns2 easydns freedns freemyip googledomains hammernode1 namecheap nfsn noip sitelutions woima yandex zoneedit1 + - - changeip - ChangeIP protocol - - - cloudflare - Cloudflare protocol - - - dnsmadeeasy - DNS Made Easy protocol - - - dnspark - DNS Park protocol - - - dondominio - DonDominio protocol - - - dslreports1 - DslReports protocol - - - dtdns - DtDNS protocol - - - duckdns - DuckDNS protocol - - - dyndns2 - DynDNS protocol v2 - - - easydns - easyDNS protocol - - - freedns - FreeDNS protocol - - - freemyip - freemyip protocol - - - googledomains - Google domains protocol - - - hammernode1 - Hammernode protocol - - - namecheap - Namecheap protocol - - - nfsn - NearlyFreeSpeech DNS protocol - - - noip - No-IP protocol - - - sitelutions - Sitelutions protocol - - - woima - WOIMA protocol - - - yandex - Yandex.DNS protocol - - - zoneedit1 - Zoneedit protocol - - (changeip|cloudflare|dnsmadeeasy|dnspark|dondominio|dslreports1|dtdns|duckdns|dyndns2|easydns|freedns|freemyip|googledomains|hammernode1|namecheap|nfsn|noip|sitelutions|woima|yandex|zoneedit1) + - Please choose from the list of allowed protocols #include - DNS zone to update (only available with CloudFlare) + DNS zone to update (not used by all protocols) - Web check used for obtaining the external IP address + Use http(s) web request to obtain the external IP address instead of the IP address associated with the interface - Skip everything before this on the given URL + Text pattern to skip from the respose of the given URL to extract the external IP address - URL to obtain the current external IP address + Custom URL to obtain the current external IP address over http(s) web request, overriding ddclient default - Allow explicit IPv6 addresses for Dynamic DNS for this interface + Explicitly use IPv6 address instead of IPv4 address to update the Dynamic DNS IP address diff --git a/src/completion/list_ddclient_protocols.sh b/src/completion/list_ddclient_protocols.sh new file mode 100755 index 000000000..75fb0cf44 --- /dev/null +++ b/src/completion/list_ddclient_protocols.sh @@ -0,0 +1,17 @@ +#!/bin/sh +# +# Copyright (C) 2023 VyOS maintainers and contributors +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 or later as +# published by the Free Software Foundation. +# +# This program 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 program. If not, see . + +echo -n $(ddclient -list-protocols) diff --git a/src/validators/ddclient-protocol b/src/validators/ddclient-protocol new file mode 100755 index 000000000..6f927927b --- /dev/null +++ b/src/validators/ddclient-protocol @@ -0,0 +1,24 @@ +#!/bin/sh +# +# Copyright (C) 2023 VyOS maintainers and contributors +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 or later as +# published by the Free Software Foundation. +# +# This program 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 program. If not, see . + +ddclient -list-protocols | grep -qw $1 + +if [ $? -gt 0 ]; then + echo "Error: $1 is not a valid protocol, please choose from the supported list of protocols" + exit 1 +fi + +exit 0 -- cgit v1.2.3 From 2f278d4dd00caf2b30b3908545d982062a6eb68d Mon Sep 17 00:00:00 2001 From: Christian Breunig Date: Mon, 8 May 2023 08:32:35 +0200 Subject: dns: T4144: additional improvements to dynamic DNS XML definitions * Re-use XML building blocks when poossible * Use XML constraints when possible (password) * Capitalize protocols (HTTP) in strings --- interface-definitions/dns-dynamic.xml.in | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/interface-definitions/dns-dynamic.xml.in b/interface-definitions/dns-dynamic.xml.in index 3e77e2540..48c101d73 100644 --- a/interface-definitions/dns-dynamic.xml.in +++ b/interface-definitions/dns-dynamic.xml.in @@ -135,19 +135,19 @@ Hostname to register with Dynamic DNS service + + #include + + Host-name must be alphanumeric and can contain hyphens - Login for Dynamic DNS service (not used by all protocols, or referred as api-token in some cases) - - - - - Password for Dynamic DNS service (referred as api-token, global-token or api-secret in some cases) + Login/Username for Dynamic DNS service + #include ddclient protocol used for Dynamic DNS service @@ -163,25 +163,29 @@ DNS zone to update (not used by all protocols) + + txt + Name of DNS zone + - Use http(s) web request to obtain the external IP address instead of the IP address associated with the interface + Use HTTP(S) web request to obtain external IP address instead of the IP address associated with the interface - Text pattern to skip from the respose of the given URL to extract the external IP address - - - - - Custom URL to obtain the current external IP address over http(s) web request, overriding ddclient default + Pattern to skip from the respose + + txt + Pattern to skip from the respose of the given URL to extract the external IP address + + #include -- cgit v1.2.3