Add Blancco erasure reports Samba share and webapp viewer
- Samba share at \\server\blancco-reports for automatic report collection - Webapp reports page with list, download, and delete - Compliance warning on delete confirmation - Sidebar link under Tools section Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -223,6 +223,12 @@
|
||||
state: directory
|
||||
mode: '0777'
|
||||
|
||||
- name: "Create Blancco reports share directory"
|
||||
file:
|
||||
path: /srv/samba/blancco-reports
|
||||
state: directory
|
||||
mode: '0777'
|
||||
|
||||
- name: "Configure Samba shares"
|
||||
blockinfile:
|
||||
path: /etc/samba/smb.conf
|
||||
@@ -241,6 +247,13 @@
|
||||
guest ok = yes
|
||||
comment = Clonezilla backup images
|
||||
|
||||
[blancco-reports]
|
||||
path = /srv/samba/blancco-reports
|
||||
browseable = yes
|
||||
read only = no
|
||||
guest ok = yes
|
||||
comment = Blancco Drive Eraser reports
|
||||
|
||||
- name: "Create image-type top-level directories"
|
||||
file:
|
||||
path: "{{ samba_share }}/{{ item }}"
|
||||
@@ -376,6 +389,7 @@
|
||||
Environment=SAMBA_SHARE={{ samba_share }}
|
||||
Environment=CLONEZILLA_SHARE=/srv/samba/clonezilla
|
||||
Environment=WEB_ROOT={{ web_root }}
|
||||
Environment=BLANCCO_REPORTS=/srv/samba/blancco-reports
|
||||
ExecStart=/opt/pxe-webapp/venv/bin/python app.py
|
||||
Restart=always
|
||||
RestartSec=5
|
||||
|
||||
@@ -29,6 +29,7 @@ app.config["MAX_CONTENT_LENGTH"] = 16 * 1024 * 1024 * 1024 # 16 GB max upload
|
||||
# ---------------------------------------------------------------------------
|
||||
SAMBA_SHARE = os.environ.get("SAMBA_SHARE", "/srv/samba/winpeapps")
|
||||
CLONEZILLA_SHARE = os.environ.get("CLONEZILLA_SHARE", "/srv/samba/clonezilla")
|
||||
BLANCCO_REPORTS = os.environ.get("BLANCCO_REPORTS", "/srv/samba/blancco-reports")
|
||||
WEB_ROOT = os.environ.get("WEB_ROOT", "/var/www/html")
|
||||
BOOT_WIM = os.path.join(WEB_ROOT, "win11", "sources", "boot.wim")
|
||||
|
||||
@@ -640,6 +641,55 @@ def clonezilla_delete(filename):
|
||||
return redirect(url_for("clonezilla_backups"))
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Routes — Blancco Reports
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
@app.route("/reports")
|
||||
def blancco_reports():
|
||||
reports = []
|
||||
if os.path.isdir(BLANCCO_REPORTS):
|
||||
for f in sorted(os.listdir(BLANCCO_REPORTS), reverse=True):
|
||||
fpath = os.path.join(BLANCCO_REPORTS, f)
|
||||
if os.path.isfile(fpath):
|
||||
stat = os.stat(fpath)
|
||||
ext = os.path.splitext(f)[1].lower()
|
||||
reports.append({
|
||||
"filename": f,
|
||||
"size": stat.st_size,
|
||||
"modified": stat.st_mtime,
|
||||
"type": ext.lstrip(".").upper() or "FILE",
|
||||
})
|
||||
return render_template(
|
||||
"reports.html",
|
||||
reports=reports,
|
||||
image_types=IMAGE_TYPES,
|
||||
friendly_names=FRIENDLY_NAMES,
|
||||
)
|
||||
|
||||
|
||||
@app.route("/reports/download/<filename>")
|
||||
def blancco_download_report(filename):
|
||||
filename = secure_filename(filename)
|
||||
fpath = os.path.join(BLANCCO_REPORTS, filename)
|
||||
if not os.path.isfile(fpath):
|
||||
flash(f"Report not found: {filename}", "danger")
|
||||
return redirect(url_for("blancco_reports"))
|
||||
return send_file(fpath, as_attachment=True)
|
||||
|
||||
|
||||
@app.route("/reports/delete/<filename>", methods=["POST"])
|
||||
def blancco_delete_report(filename):
|
||||
filename = secure_filename(filename)
|
||||
fpath = os.path.join(BLANCCO_REPORTS, filename)
|
||||
if os.path.isfile(fpath):
|
||||
os.remove(fpath)
|
||||
flash(f"Deleted {filename}.", "success")
|
||||
else:
|
||||
flash(f"Report not found: {filename}", "danger")
|
||||
return redirect(url_for("blancco_reports"))
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Routes — startnet.cmd Editor (WIM)
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
@@ -149,6 +149,12 @@
|
||||
<i class="bi bi-archive"></i> Clonezilla Backups
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link {% if request.endpoint == 'blancco_reports' %}active{% endif %}"
|
||||
href="{{ url_for('blancco_reports') }}">
|
||||
<i class="bi bi-shield-check"></i> Blancco Reports
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div class="nav-section-divider"></div>
|
||||
|
||||
109
webapp/templates/reports.html
Normal file
109
webapp/templates/reports.html
Normal file
@@ -0,0 +1,109 @@
|
||||
{% extends "base.html" %}
|
||||
{% block title %}Blancco Reports - PXE Server Manager{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||
<h2 class="mb-0"><i class="bi bi-file-earmark-check me-2"></i>Blancco Erasure Reports</h2>
|
||||
<span class="badge bg-secondary fs-6">{{ reports|length }} report{{ 's' if reports|length != 1 }}</span>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header d-flex align-items-center">
|
||||
<i class="bi bi-shield-check me-2"></i> Drive Erasure Certificates
|
||||
</div>
|
||||
<div class="card-body p-0">
|
||||
{% if reports %}
|
||||
<table class="table table-hover mb-0">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th>Filename</th>
|
||||
<th>Type</th>
|
||||
<th>Size</th>
|
||||
<th>Date</th>
|
||||
<th class="text-end">Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for r in reports %}
|
||||
<tr>
|
||||
<td><code>{{ r.filename }}</code></td>
|
||||
<td><span class="badge bg-info text-dark">{{ r.type }}</span></td>
|
||||
<td>
|
||||
{% if r.size > 1048576 %}
|
||||
{{ "%.1f"|format(r.size / 1048576) }} MB
|
||||
{% else %}
|
||||
{{ "%.1f"|format(r.size / 1024) }} KB
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>{{ r.modified | timestamp_fmt }}</td>
|
||||
<td class="text-end text-nowrap">
|
||||
<a href="{{ url_for('blancco_download_report', filename=r.filename) }}"
|
||||
class="btn btn-sm btn-outline-primary" title="Download">
|
||||
<i class="bi bi-download"></i>
|
||||
</a>
|
||||
<button type="button" class="btn btn-sm btn-outline-danger"
|
||||
data-bs-toggle="modal" data-bs-target="#deleteModal"
|
||||
data-filename="{{ r.filename }}" title="Delete">
|
||||
<i class="bi bi-trash"></i>
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% else %}
|
||||
<div class="text-center text-muted py-5">
|
||||
<i class="bi bi-shield-check" style="font-size: 3rem;"></i>
|
||||
<p class="mt-2">No erasure reports yet.</p>
|
||||
<p class="small">Reports will appear here after Blancco Drive Eraser completes a wipe.</p>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card mt-3">
|
||||
<div class="card-body">
|
||||
<h6 class="card-title"><i class="bi bi-info-circle me-1"></i> Report Storage</h6>
|
||||
<p class="card-text mb-1">
|
||||
Blancco Drive Eraser saves erasure certificates to the network share
|
||||
<code>\\10.9.100.1\blancco-reports</code>.
|
||||
</p>
|
||||
<p class="card-text mb-0 text-muted">
|
||||
Reports are generated automatically after each drive wipe and contain proof of erasure for compliance and audit purposes.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Delete Confirmation Modal -->
|
||||
<div class="modal fade" id="deleteModal" tabindex="-1">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<form id="deleteForm" method="post">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><i class="bi bi-exclamation-triangle me-2 text-danger"></i>Confirm Delete</h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p>Are you sure you want to delete <strong id="deleteFilename"></strong>?</p>
|
||||
<p class="text-muted mb-0">Erasure reports may be needed for compliance audits. This action cannot be undone.</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button>
|
||||
<button type="submit" class="btn btn-danger"><i class="bi bi-trash me-1"></i> Delete</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block extra_scripts %}
|
||||
<script>
|
||||
document.getElementById('deleteModal').addEventListener('show.bs.modal', function (event) {
|
||||
var btn = event.relatedTarget;
|
||||
var filename = btn.getAttribute('data-filename');
|
||||
document.getElementById('deleteFilename').textContent = filename;
|
||||
document.getElementById('deleteForm').action = '/reports/delete/' + encodeURIComponent(filename);
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user