diff --git a/playbook/pxe_server_setup.yml b/playbook/pxe_server_setup.yml index 4f98dd6..4ebe568 100644 --- a/playbook/pxe_server_setup.yml +++ b/playbook/pxe_server_setup.yml @@ -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 diff --git a/webapp/app.py b/webapp/app.py index bf6722a..765dae8 100644 --- a/webapp/app.py +++ b/webapp/app.py @@ -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/") +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/", 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) # --------------------------------------------------------------------------- diff --git a/webapp/templates/base.html b/webapp/templates/base.html index 53e55cb..f094ff4 100644 --- a/webapp/templates/base.html +++ b/webapp/templates/base.html @@ -149,6 +149,12 @@ Clonezilla Backups + diff --git a/webapp/templates/reports.html b/webapp/templates/reports.html new file mode 100644 index 0000000..b1f56ea --- /dev/null +++ b/webapp/templates/reports.html @@ -0,0 +1,109 @@ +{% extends "base.html" %} +{% block title %}Blancco Reports - PXE Server Manager{% endblock %} + +{% block content %} +
+

Blancco Erasure Reports

+ {{ reports|length }} report{{ 's' if reports|length != 1 }} +
+ +
+
+ Drive Erasure Certificates +
+
+ {% if reports %} + + + + + + + + + + + + {% for r in reports %} + + + + + + + + {% endfor %} + +
FilenameTypeSizeDateActions
{{ r.filename }}{{ r.type }} + {% if r.size > 1048576 %} + {{ "%.1f"|format(r.size / 1048576) }} MB + {% else %} + {{ "%.1f"|format(r.size / 1024) }} KB + {% endif %} + {{ r.modified | timestamp_fmt }} + + + + +
+ {% else %} +
+ +

No erasure reports yet.

+

Reports will appear here after Blancco Drive Eraser completes a wipe.

+
+ {% endif %} +
+
+ +
+
+
Report Storage
+

+ Blancco Drive Eraser saves erasure certificates to the network share + \\10.9.100.1\blancco-reports. +

+

+ Reports are generated automatically after each drive wipe and contain proof of erasure for compliance and audit purposes. +

+
+
+ + + +{% endblock %} + +{% block extra_scripts %} + +{% endblock %}