From 0441a2e2e3a2a9c9b03e52b79d65bf0cc4278ed9 Mon Sep 17 00:00:00 2001 From: Joshua Tauberer Date: Tue, 7 Oct 2014 20:41:07 +0000 Subject: [PATCH] make a self-signed certificate on a non-primary domain a warning rather than an error, fixes #95 --- management/daemon.py | 2 ++ management/status_checks.py | 5 ++++- management/templates/system-status.html | 17 ++++++++++++----- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/management/daemon.py b/management/daemon.py index 69bb9294..5263c323 100755 --- a/management/daemon.py +++ b/management/daemon.py @@ -255,6 +255,8 @@ def system_status(): self.items.append({ "type": "ok", "text": message, "extra": [] }) def print_error(self, message): self.items.append({ "type": "error", "text": message, "extra": [] }) + def print_warning(self, message): + self.items.append({ "type": "warning", "text": message, "extra": [] }) def print_line(self, message, monospace=False): self.items[-1]["extra"].append({ "text": message, "monospace": monospace }) output = WebOutput() diff --git a/management/status_checks.py b/management/status_checks.py index f0ae28b7..b8fdbe0a 100755 --- a/management/status_checks.py +++ b/management/status_checks.py @@ -386,7 +386,7 @@ def check_ssl_cert(domain, env): env['out'].print_line("") env['out'].print_line(" " + fingerprint, monospace=True) else: - env['out'].print_error("""The SSL certificate for this domain is currently self-signed. Visitors to a website on + env['out'].print_warning("""The SSL certificate for this domain is currently self-signed. Visitors to a website on this domain will get a security warning. If you are not serving a website on this domain, then it is safe to leave the self-signed certificate in place.""") env['out'].print_line("") @@ -571,6 +571,9 @@ class ConsoleOutput: def print_error(self, message): self.print_block(message, first_line="✖ ") + def print_warning(self, message): + self.print_block(message, first_line="? ") + def print_block(self, message, first_line=" "): print(first_line, end='') message = re.sub("\n\s*", " ", message) diff --git a/management/templates/system-status.html b/management/templates/system-status.html index ed7404b1..82f49c6b 100644 --- a/management/templates/system-status.html +++ b/management/templates/system-status.html @@ -10,11 +10,14 @@ border-top: none; padding-top: 0; } -#system-checks .error td { +#system-checks .status-error td { color: #733; } -#system-checks .ok td { - color: #030; +#system-checks .status-warning td { + color: #770; +} +#system-checks .status-ok td { + color: #040; } #system-checks div.extra { display: none; @@ -52,9 +55,13 @@ function show_system_status() { for (var i = 0; i < r.length; i++) { var n = $("

"); if (i == 0) n.addClass('first') - n.addClass(r[i].type) + if (r[i].type == "heading") + n.addClass(r[i].type) + else + n.addClass("status-" + r[i].type) if (r[i].type == "ok") n.find('td.status').text("✓") if (r[i].type == "error") n.find('td.status').text("✖") + if (r[i].type == "warning") n.find('td.status').text("?") n.find('td.message p').text(r[i].text) $('#system-checks tbody').append(n); @@ -76,4 +83,4 @@ function show_system_status() { } }) } - \ No newline at end of file +