security: Move security report to new page

Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
[sunil@medhas.org Remove status header similar to other toolbars]
[sunil@medhas.org Add icon to 'show security report' button]
[sunil@medhas.org Handle error retrieving past CVE counts]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
James Valleroy authored and Sunil Mohan Adapa committed 2019-10-03 16:00:46 -07:00
1 parent 5fe84bf395
commit 03f5ca0b05
4 files changed
+76 -45

No files matched your search

+15 -6
View File
@@ -43,7 +43,6 @@ def index(request):
else:
form = SecurityForm(initial=status, prefix='security')
vulnerability_counts = security.get_vulnerability_counts()
return TemplateResponse(
request, 'security.html', {
'name':
@@ -52,11 +51,6 @@ def index(request):
security.manual_page,
'form':
form,
'freedombox_vulns':
vulnerability_counts.pop('freedombox'),
'apps_vulns':
sorted(vulnerability_counts.values(),
key=lambda app: app['name']),
})
@@ -86,3 +80,18 @@ def _apply_changes(request, old_status, new_status):
actions.superuser_run('service', ['enable', 'fail2ban'])
else:
actions.superuser_run('service', ['disable', 'fail2ban'])
def report(request):
"""Serve the security report page"""
vulnerability_counts = security.get_vulnerability_counts()
return TemplateResponse(
request, 'security_report.html', {
'title':
_('Security Report'),
'freedombox_vulns':
vulnerability_counts.pop('freedombox'),
'apps_vulns':
sorted(vulnerability_counts.values(),
key=lambda app: app['name']),
})