From a5bf59c5618e13ab4fc71c12f2d141bc03275fa4 Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Fri, 21 Oct 2022 17:43:21 +0200 Subject: [PATCH] add template for Enhanced Secure Erasure --- .../templates/workbench/settings.html | 8 ++++---- .../templates/workbench/wbSettings.ini | 5 ++--- ereuse_devicehub/workbench/views.py | 18 ++++++++++++++---- 3 files changed, 20 insertions(+), 11 deletions(-) diff --git a/ereuse_devicehub/templates/workbench/settings.html b/ereuse_devicehub/templates/workbench/settings.html index edcf93b6..d0db7756 100644 --- a/ereuse_devicehub/templates/workbench/settings.html +++ b/ereuse_devicehub/templates/workbench/settings.html @@ -191,7 +191,7 @@ Performs 1 pass overwriting each sector with zeros and a final verification. Compliant with HMG Infosec Standard 5 Baseline.

- Download settings file @@ -210,11 +210,11 @@ Performs 3 passes overwriting every sector with zeros and ones, and final verification. Compliant with HMG Infosec Standard 5 Enhanced.

- Download settings file - +
diff --git a/ereuse_devicehub/templates/workbench/wbSettings.ini b/ereuse_devicehub/templates/workbench/wbSettings.ini index 14459454..a0357ab0 100644 --- a/ereuse_devicehub/templates/workbench/wbSettings.ini +++ b/ereuse_devicehub/templates/workbench/wbSettings.ini @@ -16,8 +16,7 @@ WB_ERASE_STEPS = 1 WB_ERASE_LEADING_ZEROS = False WB_DEBUG = True -{% endif %} -{% if erease_sectors %} +{% elif baseline_erease %} DH_HOST = {{ host }} DH_DATABASE = {{ schema }} DEVICEHUB_URL = https://${DB_HOST}/${DB_DATABASE}/ @@ -27,7 +26,7 @@ WB_STRESS_TEST = 0 WB_SMART_TEST = short WB_ERASE = EraseSectors -WB_ERASE_STEPS = 1 +WB_ERASE_STEPS = {{ erase_steps }} WB_ERASE_LEADING_ZEROS = True WB_DEBUG = True diff --git a/ereuse_devicehub/workbench/views.py b/ereuse_devicehub/workbench/views.py index 28842826..55ae905e 100644 --- a/ereuse_devicehub/workbench/views.py +++ b/ereuse_devicehub/workbench/views.py @@ -43,7 +43,13 @@ class SettingsView(GenericMixin): form_kangaroo.save() self.opt = request.values.get('opt') - if self.opt in ['register', 'erease_basic', 'erease_sectors']: + options = [ + 'register', + 'erease_basic', + 'baseline_erease', + 'enhanced_erease', + ] + if self.opt in options: return self.download() return flask.render_template(self.template_name, **self.context) @@ -54,7 +60,7 @@ class SettingsView(GenericMixin): 'token': self.get_token(), 'url': url, 'erease_basic': None, - 'erease_sectors': None, + 'baseline_erease': None, } # if is a v14 version # TODO when not use more v14, we can remove this if @@ -63,10 +69,14 @@ class SettingsView(GenericMixin): self.wbContext['url'] = url self.wbContext['host'] = app.config['HOST'] self.wbContext['schema'] = app.config['SCHEMA'] + if self.opt == 'erease_basic': self.wbContext['erease_basic'] = True - if self.opt == 'erease_sectors': - self.wbContext['erease_sectors'] = True + if self.opt in ['baseline_erease', 'enhanced_erease']: + self.wbContext['baseline_erease'] = True + self.wbContext['erase_steps'] = 1 + if self.opt == 'enhanced_erease': + self.wbContext['erase_steps'] = 3 data = flask.render_template('workbench/wbSettings.ini', **self.wbContext) return self.response_download(data)