@php // 定義 safe_output() if (!function_exists('safe_output')) { function safe_output($value) { if (is_array($value)) { return implode(', ', $value); } return $value; } } @endphp {{ safe_output($host->name) }} - 主機檢查報告

{{ safe_output($host->name) }} - 主機檢查報告

報告日期:{{ safe_output($reportDate) }}

基本系統資訊

作業系統: {{ safe_output($reportData['os_release']['PRETTY_NAME'] ?? $reportData['os'] ?? 'N/A') }}

核心版本: {{ safe_output($reportData['kernel_version'] ?? 'N/A') }}

時區: {{ safe_output($reportData['timezone'] ?? 'N/A') }}

IP 位址: {{ safe_output($reportData['ip'] ?? 'N/A') }}

硬體資訊

CPU 型號: {{ safe_output($reportData['cpu_model'] ?? 'N/A') }}

CPU 數量: {{ safe_output($reportData['cpu_count'] ?? 'N/A') }}

記憶體: @if(isset($reportData['memory']) && isset($reportData['memory']['total_gb'])) 總容量:{{ $reportData['memory']['total_gb'] }} GB, 使用中:{{ $reportData['memory']['used_gb'] }} GB, 可用:{{ $reportData['memory']['free_gb'] }} GB @else N/A @endif

@php $rootDisk = null; if(isset($reportData['disk_info']) && is_array($reportData['disk_info'])) { foreach($reportData['disk_info'] as $disk) { if(isset($disk['mounted_on']) && $disk['mounted_on'] == '/') { $rootDisk = $disk; break; } } } @endphp

硬碟資訊(根目錄): @if($rootDisk) 檔案系統:{{ safe_output($rootDisk['filesystem']) }}, 總容量:{{ safe_output($rootDisk['size']) }}, 已使用:{{ safe_output($rootDisk['used']) }}, 可用:{{ safe_output($rootDisk['avail']) }} @else N/A @endif

網路與服務資訊
@php $apacheRaw = $reportData['apache_version'] ?? 'N/A'; $apacheVersion = $apacheRaw; if($apacheRaw !== 'N/A' && preg_match('/Apache\/([\d\.]+)/', $apacheRaw, $matches)){ $apacheVersion = $matches[1]; } $phpVersion = $reportData['php_version'] ?? 'N/A'; $mysqlRaw = $reportData['mysql_version'] ?? 'N/A'; $mysqlVersion = $mysqlRaw; if($mysqlRaw !== 'N/A' && preg_match('/([\d\.]+)/', $mysqlRaw, $matches)){ $mysqlVersion = $matches[1]; } $opensslRaw = $reportData['openssl_version'] ?? 'N/A'; $opensslVersion = $opensslRaw; if($opensslRaw !== 'N/A' && preg_match('/OpenSSL\s+([\d\.]+)/', $opensslRaw, $matches)){ $opensslVersion = $matches[1]; } $opensshRaw = $reportData['openssh_version'] ?? 'N/A'; $opensshVersion = $opensshRaw; if($opensshRaw !== 'N/A' && preg_match('/OpenSSH_([^\s]+)/', $opensshRaw, $matches)){ $opensshVersion = $matches[1]; } $ntpStatus = $reportData['ntp_status'] ?? 'N/A'; $ntpServers = (isset($reportData['ntp_servers']) && is_array($reportData['ntp_servers'])) ? safe_output($reportData['ntp_servers']) : 'N/A'; @endphp

Apache 版本: {{ safe_output($apacheVersion) }}

PHP 版本: {{ safe_output($phpVersion) }}

MySQL 版本: {{ safe_output($mysqlVersion) }}

OpenSSL 版本: {{ safe_output($opensslVersion) }}

OpenSSH 版本: {{ safe_output($opensshVersion) }}

NTP 狀態: {{ safe_output($ntpStatus) }}

校時伺服器: {{ safe_output($ntpServers) }}

帳號清單

特權帳號: {{ isset($reportData['privileged_accounts']) ? safe_output($reportData['privileged_accounts']) : 'N/A' }}

帳號到期日資訊:
@php $rawAccountExpiry = $reportData['account_expiry'] ?? ''; $mapping = [ "Last password change" => "最後更改密碼日期", "Password expires" => "密碼到期", "Password inactive" => "密碼失效", "Account expires" => "帳號到期", "Minimum number of days between password change" => "密碼更改最小間隔天數", "Maximum number of days between password change" => "密碼更改最大間隔天數", "Number of days of warning before password expires" => "密碼到期前警告天數" ]; $accountExpiryDetails = []; if($rawAccountExpiry) { $lines = preg_split('/\r?\n/', $rawAccountExpiry); foreach ($lines as $line) { $line = trim($line); if($line === '') continue; $parts = explode(":", $line, 2); if(count($parts) == 2) { $key = trim($parts[0]); $value = trim($parts[1]); $label = isset($mapping[$key]) ? $mapping[$key] : $key; $accountExpiryDetails[$label] = $value; } } } @endphp @if(!empty($accountExpiryDetails)) @foreach($accountExpiryDetails as $label => $value) @endforeach
項目 資訊
{{ $label }} {{ $value }}
@else

N/A

@endif
掃毒資訊

掃毒軟體: {{ (isset($reportData['antivirus_installed']) && $reportData['antivirus_installed']) ? '已安裝' : '未安裝' }}

掃毒版本: {{ safe_output($reportData['antivirus_version'] ?? 'N/A') }}

掃毒結果: @if(isset($reportData['antivirus_result'])) {!! nl2br(e($reportData['antivirus_result'])) !!} @else N/A @endif

Log 管理

Logrotate (180天): {{ (isset($reportData['log_rotate_180days']) && $reportData['log_rotate_180days']) ? '已設定' : '未設定' }}

Apache Logrotate (180天): {{ (isset($reportData['apache_logrotate_180days']) && $reportData['apache_logrotate_180days']) ? '已設定' : '未設定' }}

螢幕保護設定

螢幕保護程式: {{ (isset($reportData['screensaver_configured']) && $reportData['screensaver_configured']) ? '已設定' : '未設定' }}

@php $rawTimeout = $reportData['screensaver_timeout'] ?? ''; $humanTimeout = $rawTimeout; if(is_string($rawTimeout) && preg_match('/uint32\s+(\d+)/', $rawTimeout, $matches)) { $seconds = intval($matches[1]); $minutes = round($seconds / 60, 2); $humanTimeout = $seconds . " 秒 (約 " . $minutes . " 分鐘)"; } @endphp

螢幕保護等待時間: {{ $humanTimeout }}

安全設定

憑證到期日: {{ safe_output($reportData['certificate_expiry'] ?? '憑證檔案不存在') }}

@if(isset($reportData['subsites']) && is_array($reportData['subsites']) && isset($reportData['subsites']['exists']) && $reportData['subsites']['exists'] && isset($reportData['subsites']['details']) && is_array($reportData['subsites']['details']))
子網站詳細資訊:
@foreach($reportData['subsites']['details'] as $site) @endforeach
網站名稱 網址 憑證狀態 資料夾
{{ safe_output($site['name'] ?? 'N/A') }} {{ safe_output($site['url'] ?? 'N/A') }} {{ safe_output($site['certificate_status'] ?? 'N/A') }} {{ safe_output($site['folder'] ?? 'N/A') }}
@else

子網站: {{ (isset($reportData['subsites']['count'])) ? '共 ' . $reportData['subsites']['count'] . ' 個' : '無' }}

@endif