Merge pull request #383 from eReuse/changes/3861-setup
Changes/3861 setup
This commit is contained in:
commit
00e40cbdeb
|
@ -0,0 +1,34 @@
|
||||||
|
"""add is_server_erase
|
||||||
|
|
||||||
|
Revision ID: d65745749e34
|
||||||
|
Revises: a13ed6ad0e3e
|
||||||
|
Create Date: 2022-10-17 13:20:29.875274
|
||||||
|
|
||||||
|
"""
|
||||||
|
import sqlalchemy as sa
|
||||||
|
from alembic import context, op
|
||||||
|
|
||||||
|
# revision identifiers, used by Alembic.
|
||||||
|
revision = 'd65745749e34'
|
||||||
|
down_revision = 'a13ed6ad0e3e'
|
||||||
|
branch_labels = None
|
||||||
|
depends_on = None
|
||||||
|
|
||||||
|
|
||||||
|
def get_inv():
|
||||||
|
INV = context.get_x_argument(as_dictionary=True).get('inventory')
|
||||||
|
if not INV:
|
||||||
|
raise ValueError("Inventory value is not specified")
|
||||||
|
return INV
|
||||||
|
|
||||||
|
|
||||||
|
def upgrade():
|
||||||
|
op.add_column(
|
||||||
|
'snapshot',
|
||||||
|
sa.Column('is_server_erase', sa.Boolean(), nullable=True),
|
||||||
|
schema=f'{get_inv()}',
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def downgrade():
|
||||||
|
op.drop_column('snapshot', 'is_server_erase', schema=f'{get_inv()}')
|
|
@ -676,6 +676,7 @@ class Snapshot(JoinedWithOneDeviceMixin, ActionWithOneDevice):
|
||||||
of time it took to complete.
|
of time it took to complete.
|
||||||
"""
|
"""
|
||||||
sid = Column(CIText(), nullable=True)
|
sid = Column(CIText(), nullable=True)
|
||||||
|
is_server_erase = Column(Boolean(), nullable=True)
|
||||||
|
|
||||||
def get_last_lifetimes(self):
|
def get_last_lifetimes(self):
|
||||||
"""We get the lifetime and serial_number of the first disk"""
|
"""We get the lifetime and serial_number of the first disk"""
|
||||||
|
|
|
@ -115,8 +115,15 @@ class SnapshotMixin:
|
||||||
if snapshot.device.hid is None:
|
if snapshot.device.hid is None:
|
||||||
snapshot.severity = Severity.Warning
|
snapshot.severity = Severity.Warning
|
||||||
|
|
||||||
|
self.is_server_erase(snapshot)
|
||||||
|
|
||||||
return snapshot
|
return snapshot
|
||||||
|
|
||||||
|
def is_server_erase(self, snapshot):
|
||||||
|
if snapshot.device.binding:
|
||||||
|
if snapshot.device.binding.kangaroo:
|
||||||
|
snapshot.is_server_erase = True
|
||||||
|
|
||||||
def get_old_smbios_version(self, debug):
|
def get_old_smbios_version(self, debug):
|
||||||
capabilities = debug.get('lshw', {}).get('capabilities', {})
|
capabilities = debug.get('lshw', {}).get('capabilities', {})
|
||||||
for x in capabilities.values():
|
for x in capabilities.values():
|
||||||
|
|
|
@ -68,7 +68,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-xl-6">
|
<div class="col">
|
||||||
|
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
|
@ -82,120 +82,150 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xl-8">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{% if demo %}
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-xl-6">
|
<div class="col">
|
||||||
|
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
|
|
||||||
<div class="pt-6 pb-2">
|
<div class="pt-6 pb-2">
|
||||||
<h5 class="card-title text-center pb-0 fs-4">Workbench 2022</h5>
|
<h5 class="card-title pb-0 fs-4">Usody Metadata Snapshots</h5>
|
||||||
<div class="row pt-3">
|
<p class="mb-5">
|
||||||
<div class="col-5">
|
A certified collection of hardware details and testing reports<br />
|
||||||
<a href="{{ iso.demo.url }}{{ iso.demo.iso }}" class="btn btn-primary">{{ iso.demo.iso }}</a>
|
<small>Desktops, Servers and Laptops</small>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-2">
|
||||||
|
<a href="{{ iso_register.url }}{{ iso_register.iso }}" class="btn btn-primary" style="max-width: 200px;">
|
||||||
|
Download ISO
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="col">
|
<div class="col-3">
|
||||||
<p class="small">
|
<p class="small">
|
||||||
Download Checksum: <a class="help" href="{{ iso.demo.url }}SHA512SUM">SHA512SUM</a> |
|
Download Checksum: <a class="help" href="{{ iso_register.url }}SHA512SUM">SHA512SUM</a> |
|
||||||
<a href="https://help.usody.com/es/setup/setup-pendrive/" target="_blank" class="help">Help</a></p>
|
<a href="https://help.usody.com/es/setup/setup-pendrive/" target="_blank" class="help">Help</a>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row mt-3">
|
||||||
|
<div class="col-3">
|
||||||
|
<div class="border mr-2 p-2">
|
||||||
|
<h5>Basic Metadata</h5>
|
||||||
|
<p>Settings for basic hardware metadata collection and hard drive smart Test reports.</p>
|
||||||
|
<a href="{{ url_for('workbench.settings') }}?opt=register" class="btn btn-primary" style="width: 100%">Download settings file</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
|
||||||
<div class="col-xl-8">
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% else %}
|
</div>
|
||||||
{% for d, v in iso.items() %}
|
</div>
|
||||||
{% if d != 'demo' %}
|
{% if not demo %}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-xl-6">
|
<div class="col">
|
||||||
|
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
|
|
||||||
<div class="pt-6 pb-2">
|
<div class="pt-8 pb-2">
|
||||||
<h5 class="card-title text-center pb-0 fs-4">Workbench {{ d }}</h5>
|
<h5 class="card-title pb-0 fs-4">Usody Erasure Snapshots</h5>
|
||||||
{% if d == 'v14' %}
|
<p class="mb-5">
|
||||||
|
A certified data erasure software to irreversibly removing data sored on hard drives.<br />
|
||||||
|
<small>Desktops, Servers and Laptops</small>
|
||||||
|
</p>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-5">
|
<div class="col-2">
|
||||||
<a href="{{ url_for('workbench.settings') }}?opt=erease_basic" class="btn btn-primary" style="width: 200px;">Get settings file!</a>
|
<a href="{{ iso_erease.url }}{{ iso_erease.iso }}" class="btn btn-primary" style="max-width: 200px;">
|
||||||
|
Download ISO
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="col">
|
<div class="col-3">
|
||||||
<p class="small">
|
<p class="small">
|
||||||
Settings for basic data erasure. | <a href="https://help.usody.com/es/setup/setup-pendrive/" target="_blank" class="help">Help</a>
|
Download Checksum: <a class="help" href="{{ iso_erease.url }}SHA512SUM">SHA512SUM</a> |
|
||||||
|
<a href="https://help.usody.com/es/setup/setup-pendrive/" target="_blank" class="help">Help</a>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row pt-2">
|
|
||||||
<div class="col-5">
|
<div class="row mt-3">
|
||||||
<a href="{{ url_for('workbench.settings') }}?opt=erease_sectors" class="btn btn-primary" style="width: 200px;">Get settings file!</a>
|
<div class="col-3">
|
||||||
</div>
|
<div class="border mr-2 p-2">
|
||||||
<div class="col">
|
<h5>Basic Erasure</h5>
|
||||||
<p class="small">
|
<p>
|
||||||
Settings for advanced data erasure through sectors and hidden areas. Guarantee of data removal. | <a href="https://help.usody.com/es/setup/setup-pendrive/" target="_blank" class="help">Help</a>
|
Settings for basic data erasure using shred Linux command.
|
||||||
|
A software-based fast non-100%-secured way of erasing data storage.
|
||||||
</p>
|
</p>
|
||||||
</div>
|
<p>
|
||||||
</div>
|
Performs <strong>1</strong> pass overwriting one round using all zeros.
|
||||||
{% else %}
|
Compliant with <strong>NIST SP-800-88</strong>
|
||||||
<div class="row">
|
|
||||||
<div class="col-5">
|
|
||||||
<a href="{{ url_for('workbench.settings') }}?opt=register" class="btn btn-primary" style="width: 200px;">Get settings file!</a>
|
|
||||||
</div>
|
|
||||||
<div class="col">
|
|
||||||
<p class="small">
|
|
||||||
Settings for register devices.
|
|
||||||
</p>
|
</p>
|
||||||
|
<a href="{{ url_for('workbench.settings') }}?opt=erease_basic"
|
||||||
|
class="btn btn-primary"
|
||||||
|
style="width: 100%;">
|
||||||
|
Download settings file
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
|
||||||
{% if iso %}
|
<div class="col-3">
|
||||||
<br />
|
<div class="border mr-2 p-2">
|
||||||
<div class="row">
|
<h5>Baseline Secure Erasure</h5>
|
||||||
<div class="col-5">
|
<p>
|
||||||
<a href="{{ v.url }}{{ v.iso }}" class="btn btn-primary" style="width: 200px;">Get ISO file</a>
|
Settings for advanced data erasure using badblocks Linux software.
|
||||||
</div>
|
A secured-way of erasing data storages, erase hidden areas, checking the erase sector by sector.
|
||||||
<div class="col">
|
|
||||||
<p class="small">
|
|
||||||
{{ v.iso }}
|
|
||||||
</p>
|
</p>
|
||||||
<p class="small">
|
<p>
|
||||||
Download Checksum: <a class="help" href="{{ v.url }}SHA512SUM">SHA512SUM</a> |
|
Performs <strong>1</strong> pass overwriting each sector with zeros and a final verification.
|
||||||
<a href="https://help.usody.com/es/setup/setup-pendrive/" target="_blank" class="help">Help</a></p>
|
Compliant with <strong>HMG Infosec Standard 5 Baseline</strong>.
|
||||||
</p>
|
</p>
|
||||||
|
<a href="{{ url_for('workbench.settings') }}?opt=erease_sectors"
|
||||||
|
class="btn btn-primary"
|
||||||
|
style="width: 100%;">
|
||||||
|
Download settings file
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
|
||||||
|
<div class="col-3">
|
||||||
|
<div class="border mr-2 p-2">
|
||||||
|
<h5>Enhanced Secure Erasure</h5>
|
||||||
|
<p>
|
||||||
|
Settings for advanced data erasure using badblocks Linux software.
|
||||||
|
A secured-way of erasing data storages, erase hidden areas, checking the erase sector by sector.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
Performs <strong>3</strong> passes overwriting every sector with zeros and ones, and final verification.
|
||||||
|
Compliant with <strong>HMG Infosec Standard 5 Enhanced</strong>.
|
||||||
|
</p>
|
||||||
|
<span
|
||||||
|
class="btn btn-secondary"
|
||||||
|
style="width: 100%;">
|
||||||
|
Download settings file
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xl-8">
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
|
||||||
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
{% endblock main %}
|
{% endblock main %}
|
||||||
|
|
|
@ -3,11 +3,11 @@ isos = {
|
||||||
'iso': "USODY_2022.8.0-Demo.iso",
|
'iso': "USODY_2022.8.0-Demo.iso",
|
||||||
'url': 'http://releases.usody.com/demo/',
|
'url': 'http://releases.usody.com/demo/',
|
||||||
},
|
},
|
||||||
"2022": {
|
"register": {
|
||||||
'iso': "USODY_2022.8.0-beta.iso",
|
'iso': "USODY_2022.8.0-beta.iso",
|
||||||
'url': 'http://releases.usody.com/2022/',
|
'url': 'http://releases.usody.com/2022/',
|
||||||
},
|
},
|
||||||
"v14": {
|
"erease": {
|
||||||
'iso': "USODY_14.0.0.iso",
|
'iso': "USODY_14.0.0.iso",
|
||||||
'url': 'http://releases.usody.com/v14/',
|
'url': 'http://releases.usody.com/v14/',
|
||||||
},
|
},
|
||||||
|
|
|
@ -23,7 +23,7 @@ class SettingsView(GenericMixin):
|
||||||
decorators = [login_required]
|
decorators = [login_required]
|
||||||
methods = ['GET', 'POST']
|
methods = ['GET', 'POST']
|
||||||
template_name = 'workbench/settings.html'
|
template_name = 'workbench/settings.html'
|
||||||
page_title = "Workbench"
|
page_title = "Snapshots"
|
||||||
|
|
||||||
def dispatch_request(self):
|
def dispatch_request(self):
|
||||||
self.get_context()
|
self.get_context()
|
||||||
|
@ -32,7 +32,9 @@ class SettingsView(GenericMixin):
|
||||||
{
|
{
|
||||||
'page_title': self.page_title,
|
'page_title': self.page_title,
|
||||||
'demo': g.user.email == app.config['EMAIL_DEMO'],
|
'demo': g.user.email == app.config['EMAIL_DEMO'],
|
||||||
'iso': isos,
|
'iso_demo': isos['demo'],
|
||||||
|
'iso_register': isos['register'],
|
||||||
|
'iso_erease': isos['erease'],
|
||||||
'form': form_kangaroo,
|
'form': form_kangaroo,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
|
@ -2534,3 +2534,36 @@ def test_filter_hdd_in_kangaroo(user3: UserClientFlask):
|
||||||
assert status == '200 OK'
|
assert status == '200 OK'
|
||||||
for hdd in Device.query.filter_by(type='HardDrive').all():
|
for hdd in Device.query.filter_by(type='HardDrive').all():
|
||||||
assert hdd.dhid in body
|
assert hdd.dhid in body
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.mvp
|
||||||
|
@pytest.mark.usefixtures(conftest.app_context.__name__)
|
||||||
|
def test_snapshot_is_server_erase(user3: UserClientFlask):
|
||||||
|
snapshot = create_device(user3, 'real-eee-1001pxd.snapshot.12.json')
|
||||||
|
|
||||||
|
user3.get('/workbench/')
|
||||||
|
data = {
|
||||||
|
'csrf_token': generate_csrf(),
|
||||||
|
'phid': snapshot.device.phid(),
|
||||||
|
}
|
||||||
|
user3.post('/workbench/', data=data)
|
||||||
|
|
||||||
|
uri = '/inventory/upload-snapshot/'
|
||||||
|
file_name = 'real-eee-1001pxd.snapshot.12'
|
||||||
|
snapshot_json = conftest.yaml2json(file_name)
|
||||||
|
snapshot_json['uuid'] = 'c058e8d2-fb92-47cb-a4b7-522b75561136'
|
||||||
|
b_snapshot = bytes(json.dumps(snapshot_json), 'utf-8')
|
||||||
|
file_snap = (BytesIO(b_snapshot), file_name)
|
||||||
|
user3.get(uri)
|
||||||
|
|
||||||
|
data = {
|
||||||
|
'snapshot': file_snap,
|
||||||
|
'csrf_token': generate_csrf(),
|
||||||
|
}
|
||||||
|
user3.post(uri, data=data, content_type="multipart/form-data")
|
||||||
|
snapshot2 = Snapshot.query.filter_by(uuid=snapshot_json['uuid']).one()
|
||||||
|
|
||||||
|
assert not snapshot.is_server_erase
|
||||||
|
assert snapshot2.is_server_erase
|
||||||
|
assert snapshot in snapshot.device.actions
|
||||||
|
assert snapshot2 in snapshot.device.actions
|
||||||
|
|
Reference in New Issue