@extends('layouts.app') @section('content') @php $nftLines = is_array($nftLines ?? null) ? $nftLines : []; $nftText = strtolower(trim((string) ($nftRaw ?? ''))); $nftBlocked = str_contains($nftText, 'permission denied') || str_contains($nftText, 'you must be root') || str_contains($nftText, 'operation not permitted'); @endphp

Raw Firewall Rules

Read-only live snapshot of the nftables ruleset on this host.
Total Lines
{{ count($nftLines) }}
Drop / Reject Rules
{{ count(array_filter($nftLines, fn($l) => str_contains(strtolower($l), ' drop') || str_contains(strtolower($l), ' reject'))) }}
Status
{{ $nftBlocked ? 'Permission Denied' : (empty($nftLines) ? 'No Output' : 'Loaded') }}
nftables Ruleset sudo nft list ruleset
@if ($nftBlocked)
Permission denied. Grant www-data sudo access to run nft list ruleset in /etc/sudoers.d/pbx-web.
@elseif (empty($nftLines))
No nftables output received. The web server may lack sudo permission — add www-data ALL=(ALL) NOPASSWD: /usr/sbin/nft list ruleset to sudoers.
@else
@foreach ($nftLines as $line)
@php
    $trim   = trim($line);
    $lower  = strtolower($trim);
    $isDrop = str_contains($lower, ' drop') || str_contains($lower, 'drop;');
    $isRej  = str_contains($lower, ' reject') || str_contains($lower, 'reject;');
    $isRet  = str_contains($lower, ' return') || str_contains($lower, 'return;');
    $isCom  = str_starts_with($trim, '#');
    $cls    = $isDrop || $isRej ? 'color:#f87171' : ($isRet ? 'color:#34d399' : ($isCom ? 'color:#64748b' : ''));
@endphp
{{ $trim }}
@endforeach
@endif
@endsection