From d62800b454bd4ddd00804625244c257a5025a745 Mon Sep 17 00:00:00 2001 From: Emily Karisch Date: Wed, 5 Sep 2018 11:20:46 +0200 Subject: [PATCH] Make a stricter comparison for matching against zone names This adds a dot in front of the fqdn and the zone name, so the comparison will only check against full DNS parts of the fqdn and the zone name. This will prevent to match a fqdn against an unrelated zone name which overlaps with the wanted zone in the naming. Fixes #398 --- dns_scripts/dns_route53.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dns_scripts/dns_route53.py b/dns_scripts/dns_route53.py index 8805269..a972dfa 100755 --- a/dns_scripts/dns_route53.py +++ b/dns_scripts/dns_route53.py @@ -32,7 +32,7 @@ for zone in response['HostedZones']: zone_list[zone['Name']] = zone['Id'] for key in sorted(zone_list.iterkeys(), key=len, reverse=True): - if key in "{z}.".format(z=fqdn): + if ".{z}".format(z=key) in ".{z}.".format(z=fqdn): zone_id = zone_list[key] if zone_id == "": @@ -84,4 +84,4 @@ if action == 'UPSERT': print("Didn't find {f} entry yet, sleeping... ({w}s)".format(f=challenge_fqdn, w=waiting)) time.sleep(10) - pass \ No newline at end of file + pass