diff --git a/server.py b/server.py index 59abcdc..04423dd 100644 --- a/server.py +++ b/server.py @@ -749,28 +749,36 @@ def index(): alerts = [] warnings = [] for node in node_status: + node["class"] = "normal" if not node["plain_dns"]: + node["class"] = "error" alerts.append(f"{node['name']} does not support plain DNS") if not node["doh"]: + node["class"] = "error" alerts.append(f"{node['name']} does not support DoH") if not node["dot"]: + node["class"] = "error" alerts.append(f"{node['name']} does not support DoT") if not node["cert"]["valid"]: + node["class"] = "error" alerts.append(f"{node['name']} has an invalid certificate") if not node["cert_853"]["valid"]: + node["class"] = "error" alerts.append(f"{node['name']} has an invalid certificate on port 853") cert_expiry = datetime.strptime( node["cert"]["expiry_date"], "%b %d %H:%M:%S %Y GMT" ) if cert_expiry < datetime.now(): + node["class"] = "error" alerts.append(f"The {node['name']} node's certificate has expired") continue elif cert_expiry < datetime.now() + relativedelta.relativedelta(days=7): + node["class"] = "warning" warnings.append( f"The {node['name']} node's certificate is expiring {format_relative_time(cert_expiry)}" ) @@ -779,11 +787,13 @@ def index(): node["cert_853"]["expiry_date"], "%b %d %H:%M:%S %Y GMT" ) if cert_853_expiry < datetime.now(): + node["class"] = "error" alerts.append( f"The {node['name']} node's certificate has expired for DNS over TLS (port 853)" ) continue elif cert_853_expiry < datetime.now() + relativedelta.relativedelta(days=7): + node["class"] = "warning" warnings.append( f"The {node['name']} node's certificate is expiring {format_relative_time(cert_853_expiry)} for DNS over TLS (port 853)" ) diff --git a/templates/assets/css/index.css b/templates/assets/css/index.css index 41bd3c3..6203a8e 100644 --- a/templates/assets/css/index.css +++ b/templates/assets/css/index.css @@ -21,4 +21,10 @@ } .node-info > p{ margin: 0; -} \ No newline at end of file +} +.node.warning { + border-color: #FFA500; +} +.node.error { + border-color: #FF0000; +} diff --git a/templates/index.html b/templates/index.html index f97aa32..0a1aadc 100644 --- a/templates/index.html +++ b/templates/index.html @@ -97,7 +97,7 @@
{% for node in nodes %} -
+

{{node.location}}