diff options
author | Christian Breunig <christian@breunig.cc> | 2023-12-26 12:33:30 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-26 12:33:30 +0100 |
commit | 3b6f2e35db7955cb212b01bb412070e0861bab7a (patch) | |
tree | 242564eb2b7f5439dd5eb2805358b85773ae9314 /src | |
parent | e524b053e7057294051a0daddb19427839f38414 (diff) | |
parent | c8bcc4ad2a82ec95f2f4005fd89ba94264040a68 (diff) | |
download | vyos-1x-3b6f2e35db7955cb212b01bb412070e0861bab7a.tar.gz vyos-1x-3b6f2e35db7955cb212b01bb412070e0861bab7a.zip |
Merge pull request #2686 from indrajitr/ddclient-update-20231224-01
ddclient: T5144: Migrate web-options url to stricter format
Diffstat (limited to 'src')
-rwxr-xr-x | src/migration-scripts/dns-dynamic/0-to-1 | 11 | ||||
-rwxr-xr-x | src/migration-scripts/dns-dynamic/2-to-3 | 2 |
2 files changed, 12 insertions, 1 deletions
diff --git a/src/migration-scripts/dns-dynamic/0-to-1 b/src/migration-scripts/dns-dynamic/0-to-1 index 4f6083eab..b7674a9c8 100755 --- a/src/migration-scripts/dns-dynamic/0-to-1 +++ b/src/migration-scripts/dns-dynamic/0-to-1 @@ -25,8 +25,10 @@ # to "service dns dynamic address <address> service <config> username ..." # - apply global 'ipv6-enable' to per <config> 'ip-version: ipv6' # - apply service protocol mapping upfront, they are not 'auto-detected' anymore +# - migrate web-options url to stricter format import sys +import re from vyos.configtree import ConfigTree service_protocol_mapping = { @@ -104,8 +106,17 @@ for address in config.list_nodes(new_base_path): new_base_path + ['web', svc_type, f'{svc_cfg}-{address}']) # Multiple web-options were not supported, so copy only the first one + # Also, migrate web-options url to stricter format and transition + # checkip.dyndns.org to https://domains.google.com/checkip for better + # TLS support (see: https://github.com/ddclient/ddclient/issues/597) if not config.exists(new_base_path + ['web', 'web-options']): config.copy(new_base_path + [address, 'use-web'], new_base_path + ['web', 'web-options']) + if config.exists(new_base_path + ['web', 'web-options', 'url']): + url = config.return_value(new_base_path + ['web', 'web-options', 'url']) + if re.search("^(https?://)?checkip\.dyndns\.org", url): + config.set(new_base_path + ['web', 'web-options', 'url'], 'https://domains.google.com/checkip') + if not url.startswith(('http://', 'https://')): + config.set(new_base_path + ['web', 'web-options', 'url'], f'https://{url}') config.delete(new_base_path + [address]) diff --git a/src/migration-scripts/dns-dynamic/2-to-3 b/src/migration-scripts/dns-dynamic/2-to-3 index e5910f7b4..4e0aa37d5 100755 --- a/src/migration-scripts/dns-dynamic/2-to-3 +++ b/src/migration-scripts/dns-dynamic/2-to-3 @@ -37,7 +37,7 @@ def normalize_name(name): # Normalize unicode characters to ASCII (NFKD) # Replace all separators with hypens, strip leading and trailing hyphens name = normalize('NFKD', name).encode('ascii', 'ignore').decode() - name = re.sub(r'(\s|\W)+', '-', name).strip('-') + name = re.sub(r'(\s|_|\W)+', '-', name).strip('-') return name |