Initial commit, DMARC checking support added

This commit is contained in:
Mr Sleeps
2026-06-29 17:57:01 +01:00
commit d81fdbfda8
30 changed files with 4019 additions and 0 deletions
@@ -0,0 +1,140 @@
<div class="space-y-6 text-foreground">
{{-- Header --}}
<div class="flex items-start justify-between">
<div>
<h3 class="text-lg font-semibold text-foreground">
{{ $domain }}
</h3>
@if($dmarc && $dmarc->valid)
<span class="mt-1 inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-green-500/10 text-green-600 dark:text-green-400">
Valid
</span>
@elseif($dmarc)
<span class="mt-1 inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-red-500/10 text-red-600 dark:text-red-400">
Invalid
</span>
@else
<span class="mt-1 inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-muted text-muted-foreground">
Not Checked
</span>
@endif
</div>
@if($dmarc && $dmarc->last_checked_at)
<div class="text-xs text-muted-foreground text-right">
Last checked<br>
<span class="text-foreground">
{{ $dmarc->last_checked_at->format('Y-m-d H:i:s') }}
</span>
</div>
@endif
</div>
@if($dmarc)
{{-- Error --}}
@if(!$dmarc->valid && $dmarc->error_message)
<div class="p-4 rounded-lg border border-red-500/20 bg-red-500/5">
<div class="text-sm font-medium text-red-500">
Error
</div>
<div class="mt-1 text-sm text-red-400">
{{ $dmarc->error_message }}
</div>
</div>
@endif
{{-- Record --}}
@if($dmarc->record)
<div>
<div class="text-xs text-muted-foreground uppercase">
DMARC Record
</div>
<div class="mt-1 p-3 rounded-lg border border-border bg-card">
<code class="text-sm text-foreground break-all">
{{ $dmarc->record }}
</code>
</div>
</div>
@endif
{{-- Grid --}}
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
<div class="p-3 rounded-lg border border-border bg-card">
<div class="text-xs text-muted-foreground uppercase">Policy</div>
<div class="mt-1 text-sm text-foreground">
{{ ucfirst($dmarc->policy ?? 'Not set') }}
</div>
</div>
<div class="p-3 rounded-lg border border-border bg-card">
<div class="text-xs text-muted-foreground uppercase">Subdomain Policy</div>
<div class="mt-1 text-sm text-foreground">
{{ $dmarc->subdomain_policy ? ucfirst($dmarc->subdomain_policy) : 'Not set' }}
</div>
</div>
<div class="p-3 rounded-lg border border-border bg-card">
<div class="text-xs text-muted-foreground uppercase">DKIM Alignment</div>
<div class="mt-1 text-sm text-foreground">
{{ $dmarc->adkim ? ucfirst($dmarc->adkim) : 'Not set' }}
</div>
</div>
<div class="p-3 rounded-lg border border-border bg-card">
<div class="text-xs text-muted-foreground uppercase">SPF Alignment</div>
<div class="mt-1 text-sm text-foreground">
{{ $dmarc->aspf ? ucfirst($dmarc->aspf) : 'Not set' }}
</div>
</div>
@if($dmarc->percentage !== null)
<div class="p-3 rounded-lg border border-border bg-card">
<div class="text-xs text-muted-foreground uppercase">Percentage</div>
<div class="mt-1 text-sm text-foreground">
{{ $dmarc->percentage }}%
</div>
</div>
@endif
</div>
{{-- RUA / RUF --}}
@if($dmarc->rua || $dmarc->ruf)
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
@if($dmarc->rua)
<div class="p-3 rounded-lg border border-border bg-card">
<div class="text-xs text-muted-foreground uppercase">Aggregate (RUA)</div>
<div class="mt-1 text-sm text-foreground break-all">
{{ implode(', ', $dmarc->rua) }}
</div>
</div>
@endif
@if($dmarc->ruf)
<div class="p-3 rounded-lg border border-border bg-card">
<div class="text-xs text-muted-foreground uppercase">Forensic (RUF)</div>
<div class="mt-1 text-sm text-foreground break-all">
{{ implode(', ', $dmarc->ruf) }}
</div>
</div>
@endif
</div>
@endif
@else
<div class="text-center py-10 text-muted-foreground">
No DMARC record has been checked yet.
</div>
@endif
</div>
@@ -0,0 +1,14 @@
<x-filament-panels::page>
<div class="max-w-4xl mx-auto">
<div class="bg-white dark:bg-gray-800 rounded-lg shadow p-6 mb-6">
<h3 class="text-lg font-medium text-gray-900 dark:text-gray-100 mb-2">
Generate DMARC Record for {{ $record->domain }}
</h3>
<p class="text-sm text-gray-500 dark:text-gray-400">
Configure your DMARC policy below. The generated record will be saved and can be viewed in the DMARC management page.
</p>
</div>
{{ $this->form }}
</div>
</x-filament-panels::page>
@@ -0,0 +1,90 @@
<x-filament-panels::page>
@if($dmarc && $dmarc->valid)
<div class="space-y-6">
<div class="grid grid-cols-1 md:grid-cols-3 gap-6">
<div class="bg-white dark:bg-gray-800 rounded-lg shadow p-6">
<h4 class="text-sm font-medium text-gray-500 dark:text-gray-400">Domain</h4>
<p class="text-xl font-semibold mt-1">{{ $record->domain }}</p>
</div>
<div class="bg-white dark:bg-gray-800 rounded-lg shadow p-6">
<h4 class="text-sm font-medium text-gray-500 dark:text-gray-400">Policy</h4>
<p class="text-xl font-semibold mt-1">
<span class="px-2 py-1 rounded text-sm font-medium bg-{{ $dmarc->getPolicyColor() }}-100 text-{{ $dmarc->getPolicyColor() }}-800">
{{ $dmarc->getPolicyLabel() }}
</span>
<span class="text-sm text-gray-500 ml-2">({{ $dmarc->policy }})</span>
</p>
</div>
<div class="bg-white dark:bg-gray-800 rounded-lg shadow p-6">
<h4 class="text-sm font-medium text-gray-500 dark:text-gray-400">Last Checked</h4>
<p class="text-xl font-semibold mt-1">{{ $dmarc->last_checked_at?->diffForHumans() ?? 'Never' }}</p>
</div>
</div>
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
<div class="bg-white dark:bg-gray-800 rounded-lg shadow p-6">
<h4 class="text-sm font-medium text-gray-500 dark:text-gray-400">DKIM Alignment</h4>
<p class="text-lg font-semibold mt-1">{{ ucfirst($dmarc->adkim ?? 'Not set') }}</p>
</div>
<div class="bg-white dark:bg-gray-800 rounded-lg shadow p-6">
<h4 class="text-sm font-medium text-gray-500 dark:text-gray-400">SPF Alignment</h4>
<p class="text-lg font-semibold mt-1">{{ ucfirst($dmarc->aspf ?? 'Not set') }}</p>
</div>
<div class="bg-white dark:bg-gray-800 rounded-lg shadow p-6">
<h4 class="text-sm font-medium text-gray-500 dark:text-gray-400">Enforcement Percentage</h4>
<p class="text-lg font-semibold mt-1">{{ $dmarc->percentage ?? 100 }}%</p>
</div>
<div class="bg-white dark:bg-gray-800 rounded-lg shadow p-6">
<h4 class="text-sm font-medium text-gray-500 dark:text-gray-400">Testing Mode</h4>
<p class="text-lg font-semibold mt-1">{{ $dmarc->t === 'y' ? '✅ On' : '❌ Off' }}</p>
</div>
</div>
@if($dmarc->rua || $dmarc->ruf)
<div class="bg-white dark:bg-gray-800 rounded-lg shadow p-6">
<h4 class="text-sm font-medium text-gray-500 dark:text-gray-400 mb-4">Reporting Addresses</h4>
<div class="space-y-2">
@if($dmarc->rua)
<p class="text-sm"><span class="font-medium">RUA:</span> {{ implode(', ', $dmarc->rua) }}</p>
@endif
@if($dmarc->ruf)
<p class="text-sm"><span class="font-medium">RUF:</span> {{ implode(', ', $dmarc->ruf) }}</p>
@endif
</div>
</div>
@endif
<div class="bg-white dark:bg-gray-800 rounded-lg shadow p-6">
<h4 class="text-sm font-medium text-gray-500 dark:text-gray-400 mb-4">DNS Record</h4>
<div class="p-4 bg-gray-100 dark:bg-gray-900 rounded font-mono text-sm overflow-x-auto">
<code>v=DMARC1; {{ $dmarc->record }}</code>
</div>
<div class="mt-4 text-sm text-gray-500">
<p>Next check: {{ $dmarc->next_check_at?->diffForHumans() ?? 'Not scheduled' }}</p>
</div>
</div>
</div>
@else
<div class="text-center py-12">
<div class="mb-4 text-4xl">📡</div>
<h3 class="text-lg font-medium text-gray-900 dark:text-gray-100">No DMARC Record Found</h3>
<p class="mt-2 text-sm text-gray-500 dark:text-gray-400">
Domain: <span class="font-mono">{{ $record->domain }}</span>
</p>
@if($dmarc?->error_message)
<p class="mt-2 text-sm text-red-600 dark:text-red-400">{{ $dmarc->error_message }}</p>
@endif
<div class="mt-6">
<a href="{{ \VEximweb\Plugin\DnsTools\Filament\Resources\DmarcResource::getUrl('generate', ['record' => $record]) }}"
class="inline-flex items-center px-4 py-2 bg-primary-600 hover:bg-primary-700 text-white rounded-lg">
Generate DMARC Record
</a>
</div>
</div>
@endif
</x-filament-panels::page>