@extends('layouts.app') @section('content') {{-- Header --}}

Fail2Ban Protection

Automatically blocks IPs with suspicious authentication attempts to protect your PBX.
Reload
@if(session('status'))
{{ session('status') }}
@endif {{-- KPI Cards --}}
Active Bans
{{ $totalBanned }}
Currently blocked IPs
Monitors Running
{{ $jailsRunning }} / {{ $jailsTotal }}
{{ $jailsTotal > 0 ? 'All monitors healthy' : 'Service unavailable' }}
Recent Events
{{ count($events) }}
Logged security events
Total Monitors
{{ $jailsTotal }}
Configured protection rules
@if($jailsTotal === 0)
Fail2Ban is not responding or www-data lacks sudo permission. Add www-data ALL=(ALL) NOPASSWD: /usr/bin/fail2ban-client status* to /etc/sudoers.d/pbx-web.
@endif {{-- Active Bans --}}
Active Bans {{ $totalBanned }}
@forelse($bans as $i => $ban) @php $cc = $ban['country_code'] ?? null; $flag = ''; if ($cc && strlen($cc) === 2 && ctype_alpha($cc)) { $flag = mb_chr(0x1F1E6 + ord(strtoupper($cc[0])) - 65) . mb_chr(0x1F1E6 + ord(strtoupper($cc[1])) - 65); } @endphp @empty @endforelse
IP Address Country Jail Banned Since Expires Actions
{{ $ban['ip'] }} @if($ban['country_name'] ?? null) {{ $flag }} {{ $ban['country_name'] }} @else — @endif {{ $ban['jail'] }} @if($ban['banned_since'] ?? null) {{ \Carbon\Carbon::parse($ban['banned_since'])->diffForHumans() }} @else — @endif @if($ban['expires'] ?? null) {{ \Carbon\Carbon::parse($ban['expires'])->diffForHumans() }} @else — @endif
@csrf
No IPs currently banned.
{{-- Recent Events --}}
Recent Fail2Ban Events From /var/log/fail2ban.log
@forelse($events as $ev) @empty @endforelse
Time Jail Severity Event IP Address Details
{{ $ev['time'] }} {{ $ev['jail'] }} @if($ev['severity'] === 'high') ● High @elseif($ev['severity'] === 'medium') ● Medium @else ● Low @endif @if($ev['event'] === 'Ban') Ban @elseif($ev['event'] === 'Unban') Unban @else Detected @endif {{ $ev['ip'] ?: '—' }}
No log events found — log may be unreadable or empty.
{{-- Ban Detail Modal --}} {{-- Event Detail Modal --}} @push('custom-scripts') @endpush @endsection