Files
DMARC-Sentinel/app/templates/domain.html
T
2026-05-16 12:05:36 -03:00

231 lines
12 KiB
HTML

{% extends "base.html" %}
{% block content %}
<header class="dw-page-header">
<h1>{{ domain }}</h1>
<p>Domain telemetry and alert evidence.</p>
</header>
<section class="dw-metrics-grid" aria-label="Domain metrics">
<article class="dw-metric-card">
<span class="dw-kicker">Messages</span>
<strong>{{ metrics.messages }}</strong>
</article>
<article class="dw-metric-card">
<span class="dw-kicker">SPF Aligned</span>
<strong>{{ metrics.spf_aligned }} <small>{{ metrics.spf_rate }}</small></strong>
</article>
<article class="dw-metric-card">
<span class="dw-kicker">DKIM Aligned</span>
<strong>{{ metrics.dkim_aligned }} <small>{{ metrics.dkim_rate }}</small></strong>
</article>
<article class="dw-metric-card dw-metric-card-critical">
<span class="dw-kicker">Unknown Sources</span>
<strong class="dw-danger-value">{{ metrics.unknown_sources }}</strong>
</article>
</section>
<section class="dw-domain-summary-section">
<h2 class="dw-sidebar-kicker">Latest LLM Posture Summary</h2>
<article class="dw-summary-card dw-domain-summary-card">
<div class="dw-summary-rail"></div>
<div class="dw-summary-copy">
{% set summary_parts = summary.split("Actions:", 1) %}
<div>{{ summary_parts[0] }}</div>
{% if summary_parts | length > 1 %}
<div class="dw-recommendations">
<span>Recommended Actions</span>
<ul>
{% for action in summary_parts[1].replace(".", "").split(";") %}
{% if action.strip() %}
<li><span class="material-symbols-outlined">task_alt</span>{{ action.strip() }}</li>
{% endif %}
{% endfor %}
</ul>
</div>
{% endif %}
</div>
</article>
</section>
<section class="dw-domain-main-grid">
<div class="dw-domain-main-column" id="source-panel">
<h2 class="dw-panel-title">Top Observed IPs</h2>
<div class="dw-table-card">
<table class="dw-table">
<thead>
<tr>
<th title="DMARC aggregate source_ip: the IP observed by the reporting receiver. It may be a relay, forwarder, gateway, or direct sender.">Observed IP</th>
<th>Count</th>
<th>DKIM Domains</th>
<th>Known</th>
<th>DMARC</th>
</tr>
</thead>
<tbody>
{% for row in records %}
<tr>
<td><code>{{ row.source_ip }}</code></td>
<td>{{ row.count }}</td>
<td class="dw-muted">{{ row.dkim_domains }}</td>
<td class="dw-muted">{{ row.known_sender_name or "unknown" }}</td>
<td>
<span class="dw-chip {{ 'dw-chip-pass' if row.dmarc_pass else 'dw-chip-fail' }}">{{ "pass" if row.dmarc_pass else "fail" }}</span>
</td>
</tr>
{% else %}
<tr>
<td colspan="5" class="dw-muted">No observed IP records yet.</td>
</tr>
{% endfor %}
</tbody>
<tfoot>
<tr>
<td colspan="5">
<div class="dw-table-footer">
<span>Showing {{ records | length }} observed IPs</span>
<span class="dw-pager">
<a hx-get="/domains/{{ domain }}?source_page={{ source_page - 1 }}&alert_page={{ alert_page }}&report_page={{ report_page }}&trend_page={{ trend_page }}" hx-select="#source-panel" hx-target="#source-panel" hx-swap="outerHTML" class="{{ 'is-disabled' if source_page <= 1 else '' }}" href="/domains/{{ domain }}?source_page={{ source_page - 1 }}&alert_page={{ alert_page }}&report_page={{ report_page }}&trend_page={{ trend_page }}"><span class="material-symbols-outlined">chevron_left</span></a>
<a hx-get="/domains/{{ domain }}?source_page={{ source_page + 1 }}&alert_page={{ alert_page }}&report_page={{ report_page }}&trend_page={{ trend_page }}" hx-select="#source-panel" hx-target="#source-panel" hx-swap="outerHTML" class="{{ 'is-disabled' if source_page * source_page_size >= source_total else '' }}" href="/domains/{{ domain }}?source_page={{ source_page + 1 }}&alert_page={{ alert_page }}&report_page={{ report_page }}&trend_page={{ trend_page }}"><span class="material-symbols-outlined">chevron_right</span></a>
</span>
</div>
</td>
</tr>
</tfoot>
</table>
</div>
</div>
<aside class="dw-domain-alert-column" id="domain-alert-panel">
<h2 class="dw-panel-title">Open Alerts <span class="dw-muted">({{ alert_total }})</span></h2>
<div class="dw-alert-feed">
{% for alert in alerts %}
<a class="dw-alert-item is-{{ alert.severity_class }}" href="{{ '/reports/' ~ alert.report_db_id if alert.report_db_id else '/alerts?domain=' ~ domain }}">
<span class="dw-alert-row">
<span>{{ alert.severity }}</span>
<time>{{ (alert.report_end or alert.report_start or alert.report_time) | fmt_dt }}</time>
</span>
<strong>{{ alert.title }}</strong>
<p>{{ alert.llm_summary or alert.summary }}</p>
</a>
{% else %}
<div class="dw-alert-empty">No open alerts.</div>
{% endfor %}
</div>
{% if alert_total > alert_page_size %}
<div class="dw-table-footer">
<span>{{ ((alert_page - 1) * alert_page_size) + 1 }}-{{ [alert_page * alert_page_size, alert_total] | min }} of {{ alert_total }}</span>
<span class="dw-pager">
<a hx-get="/domains/{{ domain }}?source_page={{ source_page }}&alert_page={{ alert_page - 1 }}&report_page={{ report_page }}&trend_page={{ trend_page }}" hx-select="#domain-alert-panel" hx-target="#domain-alert-panel" hx-swap="outerHTML" class="{{ 'is-disabled' if alert_page <= 1 else '' }}" href="/domains/{{ domain }}?source_page={{ source_page }}&alert_page={{ alert_page - 1 }}&report_page={{ report_page }}&trend_page={{ trend_page }}"><span class="material-symbols-outlined">chevron_left</span></a>
<a hx-get="/domains/{{ domain }}?source_page={{ source_page }}&alert_page={{ alert_page + 1 }}&report_page={{ report_page }}&trend_page={{ trend_page }}" hx-select="#domain-alert-panel" hx-target="#domain-alert-panel" hx-swap="outerHTML" class="{{ 'is-disabled' if alert_page * alert_page_size >= alert_total else '' }}" href="/domains/{{ domain }}?source_page={{ source_page }}&alert_page={{ alert_page + 1 }}&report_page={{ report_page }}&trend_page={{ trend_page }}"><span class="material-symbols-outlined">chevron_right</span></a>
</span>
</div>
{% endif %}
</aside>
</section>
<section class="dw-domain-lower-grid">
<div id="trend-panel">
<h2 class="dw-panel-title">Daily DMARC and Volume Trend</h2>
<div class="dw-table-card">
<table class="dw-table dw-compact-table">
<thead>
<tr>
<th>Date</th>
<th>Messages</th>
<th>Pass</th>
<th>Fail</th>
</tr>
</thead>
<tbody>
{% for stat in stats %}
<tr>
<td>{{ stat.date | fmt_date }}</td>
<td>{{ stat.total_messages }}</td>
<td class="dw-success-text">{{ stat.dmarc_pass_count }}</td>
<td class="dw-danger-text">{{ stat.dmarc_fail_count }}</td>
</tr>
{% else %}
<tr>
<td colspan="4" class="dw-muted">No daily stats yet.</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% if trend_total > trend_page_size %}
<div class="dw-table-footer">
<span>{{ ((trend_page - 1) * trend_page_size) + 1 }}-{{ [trend_page * trend_page_size, trend_total] | min }} of {{ trend_total }}</span>
<span class="dw-pager">
<a hx-get="/domains/{{ domain }}?source_page={{ source_page }}&alert_page={{ alert_page }}&report_page={{ report_page }}&trend_page={{ trend_page - 1 }}" hx-select="#trend-panel" hx-target="#trend-panel" hx-swap="outerHTML" class="{{ 'is-disabled' if trend_page <= 1 else '' }}" href="/domains/{{ domain }}?source_page={{ source_page }}&alert_page={{ alert_page }}&report_page={{ report_page }}&trend_page={{ trend_page - 1 }}"><span class="material-symbols-outlined">chevron_left</span></a>
<a hx-get="/domains/{{ domain }}?source_page={{ source_page }}&alert_page={{ alert_page }}&report_page={{ report_page }}&trend_page={{ trend_page + 1 }}" hx-select="#trend-panel" hx-target="#trend-panel" hx-swap="outerHTML" class="{{ 'is-disabled' if trend_page * trend_page_size >= trend_total else '' }}" href="/domains/{{ domain }}?source_page={{ source_page }}&alert_page={{ alert_page }}&report_page={{ report_page }}&trend_page={{ trend_page + 1 }}"><span class="material-symbols-outlined">chevron_right</span></a>
</span>
</div>
{% endif %}
</div>
<div>
<h2 class="dw-panel-title">Top Report Organizations</h2>
<div class="dw-list-card">
{% for org, count in reporters %}
<div class="dw-list-row">
<span>{{ org or "unknown" }}</span>
<code>{{ count }}</code>
</div>
{% else %}
<div class="dw-list-empty">No reporting organizations yet.</div>
{% endfor %}
</div>
</div>
<div>
<h2 class="dw-panel-title">Disposition and Sender Mix</h2>
<div class="dw-list-card">
{% for disposition, count in dispositions %}
<div class="dw-list-row">
<span>{{ disposition or "none" }}</span>
<code>{{ count }}</code>
</div>
{% endfor %}
{% for known, count in known_unknown %}
<div class="dw-list-row">
<span>{{ "Known senders" if known else "Unknown senders" }}</span>
<code>{{ count }}</code>
</div>
{% else %}
{% if not dispositions %}
<div class="dw-list-empty">No disposition data yet.</div>
{% endif %}
{% endfor %}
</div>
</div>
</section>
<section class="dw-reports-section" id="reports-panel">
<h2 class="dw-panel-title">Recent Reports</h2>
<div class="dw-report-list">
{% for report in reports %}
<a href="/reports/{{ report.id }}" class="dw-report-row">
<span class="material-symbols-outlined">description</span>
<span class="dw-report-copy">
<strong>{{ report.org_name or "unknown" }} · {{ report.report_id or report.id }}</strong>
<code>{{ report.date_begin | fmt_dt }}{% if report.date_end %} to {{ report.date_end | fmt_dt }}{% endif %}</code>
</span>
<span class="material-symbols-outlined">arrow_forward_ios</span>
</a>
{% else %}
<div class="dw-list-empty">No reports imported for this domain yet.</div>
{% endfor %}
</div>
{% if report_total > report_page_size %}
<div class="dw-table-footer">
<span>{{ ((report_page - 1) * report_page_size) + 1 }}-{{ [report_page * report_page_size, report_total] | min }} of {{ report_total }}</span>
<span class="dw-pager">
<a hx-get="/domains/{{ domain }}?source_page={{ source_page }}&alert_page={{ alert_page }}&report_page={{ report_page - 1 }}&trend_page={{ trend_page }}" hx-select="#reports-panel" hx-target="#reports-panel" hx-swap="outerHTML" class="{{ 'is-disabled' if report_page <= 1 else '' }}" href="/domains/{{ domain }}?source_page={{ source_page }}&alert_page={{ alert_page }}&report_page={{ report_page - 1 }}&trend_page={{ trend_page }}"><span class="material-symbols-outlined">chevron_left</span></a>
<a hx-get="/domains/{{ domain }}?source_page={{ source_page }}&alert_page={{ alert_page }}&report_page={{ report_page + 1 }}&trend_page={{ trend_page }}" hx-select="#reports-panel" hx-target="#reports-panel" hx-swap="outerHTML" class="{{ 'is-disabled' if report_page * report_page_size >= report_total else '' }}" href="/domains/{{ domain }}?source_page={{ source_page }}&alert_page={{ alert_page }}&report_page={{ report_page + 1 }}&trend_page={{ trend_page }}"><span class="material-symbols-outlined">chevron_right</span></a>
</span>
</div>
{% endif %}
</section>
{% endblock %}