From 83be1ad1c6e3d28e128a9cf469a3ecd703933ddb Mon Sep 17 00:00:00 2001 From: Indrajit Raychaudhuri Date: Fri, 9 Jun 2023 10:15:19 -0500 Subject: dns: T5144: Skip clearing 'PIDFile' in ddclient systemd override 'PIDFile' option in 'Service' isn't multi-value and thus doesn't need to be cleared before overriding. --- data/templates/dns-dynamic/override.conf.j2 | 1 - 1 file changed, 1 deletion(-) diff --git a/data/templates/dns-dynamic/override.conf.j2 b/data/templates/dns-dynamic/override.conf.j2 index 8a9dfcd70..6ca1b8a45 100644 --- a/data/templates/dns-dynamic/override.conf.j2 +++ b/data/templates/dns-dynamic/override.conf.j2 @@ -4,7 +4,6 @@ ConditionPathExists={{ config_file }} After=vyos-router.service [Service] -PIDFile= PIDFile={{ config_file | replace('.conf', '.pid') }} EnvironmentFile= ExecStart= -- cgit v1.2.3 From b85755383b2a4c76b0ad557e1f6396162dd6f937 Mon Sep 17 00:00:00 2001 From: Indrajit Raychaudhuri Date: Fri, 9 Jun 2023 10:52:38 -0500 Subject: dns: T5144: Support dynamic dns monitor and log via journalctl Add support for monitoring dynamic dns updates via journalctl. Additionally, switch to using journalctl to show dynamic dns updates. Also add/adjust the CLI help messages for consistency. --- op-mode-definitions/dns-dynamic.xml.in | 35 ++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/op-mode-definitions/dns-dynamic.xml.in b/op-mode-definitions/dns-dynamic.xml.in index 8047d55cd..4f0399964 100644 --- a/op-mode-definitions/dns-dynamic.xml.in +++ b/op-mode-definitions/dns-dynamic.xml.in @@ -1,16 +1,40 @@ + + + + + + + Monitor last lines of Domain Name System (DNS) related services + + + + + Monitor last lines of Dynamic DNS update service + + journalctl --no-hostname --follow --boot --unit ddclient.service + + + + + + + + + Show log for Domain Name System (DNS) related services + - Show log for dynamic DNS + Show log for Dynamic DNS update service - cat $(printf "%s\n" /var/log/messages* | sort -nr) | grep -e "ddclient" + journalctl --no-hostname --boot --unit ddclient.service @@ -18,7 +42,7 @@ - Show DNS information + Show Domain Name System (DNS) related information @@ -41,6 +65,9 @@ + + Restart specific Domain Name System (DNS) related service + @@ -59,7 +86,7 @@ - Update DNS information + Update Domain Name System (DNS) related information -- cgit v1.2.3 From 3c7c3b6cb08ffb5e177b10594281af8153c7e29c Mon Sep 17 00:00:00 2001 From: Indrajit Raychaudhuri Date: Fri, 9 Jun 2023 10:59:19 -0500 Subject: dns: T5144: Adjust DNS related CLI help messages for consistency This should make the help messages more consistent for DNS related CLI subtree. --- interface-definitions/dns-dynamic.xml.in | 2 +- interface-definitions/dns-forwarding.xml.in | 2 +- op-mode-definitions/dns-forwarding.xml.in | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/interface-definitions/dns-dynamic.xml.in b/interface-definitions/dns-dynamic.xml.in index 292c50603..c7b45b8f7 100644 --- a/interface-definitions/dns-dynamic.xml.in +++ b/interface-definitions/dns-dynamic.xml.in @@ -4,7 +4,7 @@ - Domain Name System related services + Domain Name System (DNS) related services diff --git a/interface-definitions/dns-forwarding.xml.in b/interface-definitions/dns-forwarding.xml.in index ced1c9c31..86dc47a47 100644 --- a/interface-definitions/dns-forwarding.xml.in +++ b/interface-definitions/dns-forwarding.xml.in @@ -5,7 +5,7 @@ - Domain Name System related services + Domain Name System (DNS) related services diff --git a/op-mode-definitions/dns-forwarding.xml.in b/op-mode-definitions/dns-forwarding.xml.in index c8ca117be..a4c650c38 100644 --- a/op-mode-definitions/dns-forwarding.xml.in +++ b/op-mode-definitions/dns-forwarding.xml.in @@ -6,7 +6,7 @@ - Monitor last lines of Domain Name Service (DNS) + Monitor last lines of Domain Name System (DNS) related services @@ -27,7 +27,7 @@ - Show log for Domain Name Service (DNS) + Show log for Domain Name System (DNS) related services @@ -42,7 +42,7 @@ - Show DNS information + Show Domain Name System (DNS) related information @@ -66,7 +66,7 @@ - Restart specific DNS service + Restart specific Domain Name System (DNS) related service @@ -83,7 +83,7 @@ - Reset a DNS service state + Reset Domain Name System (DNS) related service state -- cgit v1.2.3 From 316b0e3912feccb27baa1fab79efdb41b2546069 Mon Sep 17 00:00:00 2001 From: Indrajit Raychaudhuri Date: Fri, 9 Jun 2023 18:31:25 -0500 Subject: dns: T5144: Force systemd daemon-reload on ddclient config change --- src/conf_mode/dns_dynamic.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/conf_mode/dns_dynamic.py b/src/conf_mode/dns_dynamic.py index e070a3502..67134e681 100755 --- a/src/conf_mode/dns_dynamic.py +++ b/src/conf_mode/dns_dynamic.py @@ -117,13 +117,17 @@ def generate(dyndns): return None def apply(dyndns): + systemd_service = 'ddclient.service' + # Reload systemd manager configuration + call('systemctl daemon-reload') + # bail out early - looks like removal from running config if not dyndns or 'address' not in dyndns: - call('systemctl stop ddclient.service') + call(f'systemctl stop {systemd_service}') if os.path.exists(config_file): os.unlink(config_file) else: - call('systemctl restart ddclient.service') + call(f'systemctl reload-or-restart {systemd_service}') return None -- cgit v1.2.3 From 2e79de15fc3852a67d2fa4ae557ecd091a3ad780 Mon Sep 17 00:00:00 2001 From: Indrajit Raychaudhuri Date: Fri, 9 Jun 2023 20:54:32 -0500 Subject: dns: T5144: Explicitly override ddclient global options for reliability - For option 'web', ddclient defaults to 'dyndns' which doesn't support ssl. This results ddclient process lockup till connection to checkip.dyndns.org:443 times out. - For option 'use', ddclient defaults 'ip'. This results in confusing message "WARNING: '' is not a valid IPv4 or IPv6 address" in log. --- data/templates/dns-dynamic/ddclient.conf.j2 | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/data/templates/dns-dynamic/ddclient.conf.j2 b/data/templates/dns-dynamic/ddclient.conf.j2 index a19b79c00..4da7153c7 100644 --- a/data/templates/dns-dynamic/ddclient.conf.j2 +++ b/data/templates/dns-dynamic/ddclient.conf.j2 @@ -28,6 +28,9 @@ syslog=yes ssl=yes pid={{ config_file | replace('.conf', '.pid') }} cache={{ config_file | replace('.conf', '.cache') }} +{# Explicitly override global options for reliability #} +web=googledomains {# ddclient default ('dyndns') doesn't support ssl and results in process lockup #} +use=no {# ddclient default ('ip') results in confusing warning message in log #} {% if address is vyos_defined %} {% for address, service_cfg in address.items() %} @@ -58,9 +61,9 @@ cache={{ config_file | replace('.conf', '.cache') }} {% set ip_suffixes = ['v4', 'v6'] if config.ip_version == 'both' else (['v6'] if config.ip_version == 'ipv6' else ['']) %} # Web service dynamic DNS configuration for {{ name }}: [{{ config.protocol }}, {{ host }}] -{# For ipv4 only setup, don't append 'new-style' compliant suffix ('usev4', 'ifv4', 'webv4' etc.) - to the properties and instead live through the deprecation warnings for better compatibility - with most ddclient protocols. #} +{# For ipv4 only setup or legacy ipv6 setup, don't append 'new-style' compliant suffix + ('usev4', 'ifv4', 'webv4' etc.) to the properties and instead live through the + deprecation warnings for better compatibility with most ddclient protocols. #} {{ render_config(host, address, service_cfg.web_options, ip_suffixes, protocol=config.protocol, server=config.server, zone=config.zone, login=config.username, password=config.password) }} -- cgit v1.2.3