mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
ipexposuresetting: replace confusing negations with explicit 'in'
This commit is contained in:
parent
e82849492b
commit
95f98a9c68
3 changed files with 8 additions and 8 deletions
|
@ -77,7 +77,7 @@ class MyDiagnoser(Diagnoser):
|
||||||
|
|
||||||
ipversions = []
|
ipversions = []
|
||||||
ipv4 = Diagnoser.get_cached_report("ip", item={"test": "ipv4"}) or {}
|
ipv4 = Diagnoser.get_cached_report("ip", item={"test": "ipv4"}) or {}
|
||||||
if ipv4.get("status") == "SUCCESS" and settings_get("misc.network.dns_exposure") != "ipv6":
|
if ipv4.get("status") == "SUCCESS" and settings_get("misc.network.dns_exposure") in ["both", "ipv4"]:
|
||||||
ipversions.append(4)
|
ipversions.append(4)
|
||||||
|
|
||||||
# To be discussed: we could also make this check dependent on the
|
# To be discussed: we could also make this check dependent on the
|
||||||
|
@ -97,7 +97,7 @@ class MyDiagnoser(Diagnoser):
|
||||||
# "curl --head the.global.ip" will simply timeout...
|
# "curl --head the.global.ip" will simply timeout...
|
||||||
if self.do_hairpinning_test:
|
if self.do_hairpinning_test:
|
||||||
global_ipv4 = ipv4.get("data", {}).get("global", None)
|
global_ipv4 = ipv4.get("data", {}).get("global", None)
|
||||||
if global_ipv4 and settings_get("misc.network.dns_exposure") != "ipv6":
|
if global_ipv4 and settings_get("misc.network.dns_exposure") in ["both", "ipv4"]:
|
||||||
try:
|
try:
|
||||||
requests.head("http://" + global_ipv4, timeout=5)
|
requests.head("http://" + global_ipv4, timeout=5)
|
||||||
except requests.exceptions.Timeout:
|
except requests.exceptions.Timeout:
|
||||||
|
@ -148,7 +148,7 @@ class MyDiagnoser(Diagnoser):
|
||||||
if all(
|
if all(
|
||||||
results[ipversion][domain]["status"] == "ok" for ipversion in ipversions
|
results[ipversion][domain]["status"] == "ok" for ipversion in ipversions
|
||||||
):
|
):
|
||||||
if 4 in ipversions and settings_get("misc.network.dns_exposure") != "ipv6":
|
if 4 in ipversions and settings_get("misc.network.dns_exposure") in ["both", "ipv4"]:
|
||||||
self.do_hairpinning_test = True
|
self.do_hairpinning_test = True
|
||||||
yield dict(
|
yield dict(
|
||||||
meta={"domain": domain},
|
meta={"domain": domain},
|
||||||
|
@ -186,7 +186,7 @@ class MyDiagnoser(Diagnoser):
|
||||||
)
|
)
|
||||||
AAAA_status = dnsrecords.get("data", {}).get("AAAA:@")
|
AAAA_status = dnsrecords.get("data", {}).get("AAAA:@")
|
||||||
|
|
||||||
return AAAA_status in ["OK", "WRONG"] or settings_get("misc.network.dns_exposure") != "ipv4"
|
return AAAA_status in ["OK", "WRONG"] or settings_get("misc.network.dns_exposure") in ["both", "ipv6"]
|
||||||
|
|
||||||
if failed == 4 or ipv6_is_important_for_this_domain():
|
if failed == 4 or ipv6_is_important_for_this_domain():
|
||||||
yield dict(
|
yield dict(
|
||||||
|
|
|
@ -302,13 +302,13 @@ class MyDiagnoser(Diagnoser):
|
||||||
outgoing_ipversions = []
|
outgoing_ipversions = []
|
||||||
outgoing_ips = []
|
outgoing_ips = []
|
||||||
ipv4 = Diagnoser.get_cached_report("ip", {"test": "ipv4"}) or {}
|
ipv4 = Diagnoser.get_cached_report("ip", {"test": "ipv4"}) or {}
|
||||||
if ipv4.get("status") == "SUCCESS" and settings_get("misc.network.dns_exposure") != "ipv6":
|
if ipv4.get("status") == "SUCCESS" and settings_get("misc.network.dns_exposure") in ["both", "ipv4"]:
|
||||||
outgoing_ipversions.append(4)
|
outgoing_ipversions.append(4)
|
||||||
global_ipv4 = ipv4.get("data", {}).get("global", {})
|
global_ipv4 = ipv4.get("data", {}).get("global", {})
|
||||||
if global_ipv4:
|
if global_ipv4:
|
||||||
outgoing_ips.append(global_ipv4)
|
outgoing_ips.append(global_ipv4)
|
||||||
|
|
||||||
if settings_get("email.smtp.smtp_allow_ipv6") or settings_get("misc.network.dns_exposure") != "ipv4":
|
if settings_get("email.smtp.smtp_allow_ipv6") or settings_get("misc.network.dns_exposure") in ["both", "ipv6"]:
|
||||||
ipv6 = Diagnoser.get_cached_report("ip", {"test": "ipv6"}) or {}
|
ipv6 = Diagnoser.get_cached_report("ip", {"test": "ipv6"}) or {}
|
||||||
if ipv6.get("status") == "SUCCESS":
|
if ipv6.get("status") == "SUCCESS":
|
||||||
outgoing_ipversions.append(6)
|
outgoing_ipversions.append(6)
|
||||||
|
|
|
@ -186,7 +186,7 @@ def _build_dns_conf(base_domain, include_empty_AAAA_if_no_ipv6=False):
|
||||||
###########################
|
###########################
|
||||||
# Basic ipv4/ipv6 records #
|
# Basic ipv4/ipv6 records #
|
||||||
###########################
|
###########################
|
||||||
if ipv4 and settings_get("misc.network.dns_exposure") != "ipv6":
|
if ipv4 and settings_get("misc.network.dns_exposure") in ["both", "ipv4"]:
|
||||||
basic.append([basename, ttl, "A", ipv4])
|
basic.append([basename, ttl, "A", ipv4])
|
||||||
|
|
||||||
if ipv6:
|
if ipv6:
|
||||||
|
@ -241,7 +241,7 @@ def _build_dns_conf(base_domain, include_empty_AAAA_if_no_ipv6=False):
|
||||||
|
|
||||||
# Only recommend wildcard and CAA for the top level
|
# Only recommend wildcard and CAA for the top level
|
||||||
if domain == base_domain:
|
if domain == base_domain:
|
||||||
if ipv4 and settings_get("misc.network.dns_exposure") != "ipv6":
|
if ipv4 and settings_get("misc.network.dns_exposure") in ["both", "ipv4"]:
|
||||||
extra.append([f"*{suffix}", ttl, "A", ipv4])
|
extra.append([f"*{suffix}", ttl, "A", ipv4])
|
||||||
|
|
||||||
if ipv6:
|
if ipv6:
|
||||||
|
|
Loading…
Add table
Reference in a new issue