mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
dns-autoconf: remove dependency to public suffix list, not sure what scenario it was supposed to cover, probably goodenough without it
This commit is contained in:
parent
bd384d094f
commit
41cf266e25
1 changed files with 0 additions and 26 deletions
|
@ -19,11 +19,8 @@
|
||||||
|
|
||||||
"""
|
"""
|
||||||
import dns.resolver
|
import dns.resolver
|
||||||
from publicsuffixlist import PublicSuffixList
|
|
||||||
from moulinette.utils.filesystem import read_file
|
from moulinette.utils.filesystem import read_file
|
||||||
|
|
||||||
YNH_DYNDNS_DOMAINS = ["nohost.me", "noho.st", "ynh.fr"]
|
|
||||||
|
|
||||||
# Lazy dev caching to avoid re-reading the file multiple time when calling
|
# Lazy dev caching to avoid re-reading the file multiple time when calling
|
||||||
# dig() often during same yunohost operation
|
# dig() often during same yunohost operation
|
||||||
external_resolvers_ = []
|
external_resolvers_ = []
|
||||||
|
@ -94,24 +91,6 @@ def dig(
|
||||||
return ("ok", answers)
|
return ("ok", answers)
|
||||||
|
|
||||||
|
|
||||||
def get_public_suffix(domain):
|
|
||||||
"""get_public_suffix("www.example.com") -> "example.com"
|
|
||||||
|
|
||||||
Return the public suffix of a domain name based
|
|
||||||
"""
|
|
||||||
# Load domain public suffixes
|
|
||||||
psl = PublicSuffixList()
|
|
||||||
|
|
||||||
public_suffix = psl.publicsuffix(domain)
|
|
||||||
|
|
||||||
# FIXME: wtf is this supposed to do ? :|
|
|
||||||
if public_suffix in YNH_DYNDNS_DOMAINS:
|
|
||||||
domain_prefix = domain[0:-(1 + len(public_suffix))]
|
|
||||||
public_suffix = domain_prefix.split(".")[-1] + "." + public_suffix
|
|
||||||
|
|
||||||
return public_suffix
|
|
||||||
|
|
||||||
|
|
||||||
def get_dns_zone_from_domain(domain):
|
def get_dns_zone_from_domain(domain):
|
||||||
# TODO Check if this function is YNH_DYNDNS_DOMAINS compatible
|
# TODO Check if this function is YNH_DYNDNS_DOMAINS compatible
|
||||||
"""
|
"""
|
||||||
|
@ -138,11 +117,6 @@ def get_dns_zone_from_domain(domain):
|
||||||
if answer[0] == "ok":
|
if answer[0] == "ok":
|
||||||
# Domain is dns_zone
|
# Domain is dns_zone
|
||||||
return parent
|
return parent
|
||||||
# Otherwise, check if the parent of this parent is in the public suffix list
|
|
||||||
if parent.split(".", 1)[-1] == get_public_suffix(parent):
|
|
||||||
# Couldn't check if domain is dns zone, # FIXME : why "couldn't" ...?
|
|
||||||
# returning private suffix
|
|
||||||
return parent
|
|
||||||
|
|
||||||
# FIXME: returning None will probably trigger bugs when this happens, code expects a domain string
|
# FIXME: returning None will probably trigger bugs when this happens, code expects a domain string
|
||||||
return None
|
return None
|
||||||
|
|
Loading…
Add table
Reference in a new issue