--- Menu="Utilities" Type="xmenu" Title="MUA" Icon="cubes" --- true, CURLOPT_TIMEOUT => 5, CURLOPT_CONNECTTIMEOUT => 2, CURLOPT_HTTPHEADER => $headers, CURLOPT_PROXY => '']; if ($method === 'POST') { $options[CURLOPT_POST] = true; if ($payload !== null) { $options[CURLOPT_POSTFIELDS] = json_encode($payload); $headers[] = 'Content-Type: application/json'; $options[CURLOPT_HTTPHEADER] = $headers; } } curl_setopt_array($ch, $options); $raw = curl_exec($ch); $code = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); return [$code, $raw !== false ? json_decode($raw, true) : null]; } function csrf_value($token, $offset = 0) { return hash_hmac('sha256', gmdate('Y-m-d-H', time() + $offset * 3600), $token); } function mua_health($config_port, $admin_token) { // Readiness via the protected loopback channel. No insecure TLS bypass or // plaintext probe against a configured HTTPS MCP endpoint. [$code, $status] = mua_api('GET', '/status', null, $admin_token, $config_port); return $code === 200 && is_array($status) ? $status : null; } $running = false; $pid = null; if (file_exists($pidfile)) { $pid = trim(file_get_contents($pidfile)); $running = $pid && is_numeric($pid) && @posix_kill((int)$pid, 0); } $health_data = mua_health($config_port, $admin_token); $health_ok = is_array($health_data) && ($health_data['status'] ?? '') === 'ok'; $running_version = $health_data['version'] ?? ''; $scheme = ($health_data['scheme'] ?? '') === 'https' ? 'https' : 'http'; $endpoint = $health_ok ? $scheme . '://' . (str_contains($host_ip, ':') ? '[' . $host_ip . ']' : $host_ip) . ':' . ($health_data['port'] ?? $port) . '/mcp' : 'Nicht verfügbar – Dienst/Logs prüfen'; [$config_code, $config] = mua_api('GET', '/config', null, $admin_token, $config_port); $config_ok = $config_code === 200 && is_array($config); $flash_msg = ''; $flash_type = ''; $new_api_key = ''; $csrf = csrf_value($admin_token); $readonly = [ 'unraid_docker_list', 'unraid_docker_inspect', 'unraid_docker_logs', 'unraid_docker_analyze_logs', 'unraid_docker_processes', 'unraid_docker_stats', 'unraid_docker_info', 'unraid_network_inventory', 'unraid_network_list', 'unraid_network_inspect', 'unraid_network_host_state', 'unraid_system_connection_test', 'unraid_system_shell_readonly', 'unraid_docker_update_status', 'unraid_system_health', 'unraid_storage_status', 'unraid_disk_health', 'unraid_notifications_list', 'unraid_shares_list', 'unraid_share_inspect', 'unraid_files_inventory', ]; $operator = array_merge($readonly, [ 'unraid_network_audit_tcp', 'unraid_network_lan_probe', 'unraid_ca_search', 'unraid_ca_install_preview', 'unraid_docker_start', 'unraid_docker_stop', 'unraid_docker_restart', ]); if ($_SERVER['REQUEST_METHOD'] === 'POST') { $posted_csrf = $_POST['mua_csrf'] ?? ''; $csrf_ok = $admin_token && (hash_equals(csrf_value($admin_token), $posted_csrf) || hash_equals(csrf_value($admin_token, -1), $posted_csrf)); if (!$csrf_ok) { $flash_msg = 'Sicherheitsprüfung fehlgeschlagen. Seite neu laden und erneut versuchen.'; $flash_type = 'err'; } else { $action = $_POST['action'] ?? ''; $payload = null; if ($action === 'generate_key') $payload = ['generate' => true]; if ($action === 'preset_readonly') $payload = ['enabledTools' => $readonly, 'allToolsEnabled' => false]; if ($action === 'preset_operator') $payload = ['enabledTools' => $operator, 'allToolsEnabled' => false]; if ($action === 'preset_none') $payload = ['enabledTools' => [], 'allToolsEnabled' => false]; if ($action === 'preset_all') $payload = ['enabledTools' => [], 'allToolsEnabled' => true]; if ($action === 'save_toolbox') $payload = ['toolboxEnabled' => isset($_POST['toolbox_enabled'])]; if ($action === 'save_tls') $payload = ['tls' => [ 'enabled' => isset($_POST['tls_enabled']), 'certFile' => $_POST['tls_cert_file'] ?? '', 'keyFile' => $_POST['tls_key_file'] ?? '', ]]; if ($action === 'save_tools') { $selected = []; foreach (($config['allTools'] ?? []) as $tool) { $name = is_array($tool) ? ($tool['name'] ?? '') : $tool; if ($name && isset($_POST['tool_' . $name])) $selected[] = $name; } $payload = ['enabledTools' => $selected, 'allToolsEnabled' => false]; } if ($action === 'restart') { [$code, $result] = mua_api('POST', '/restart', null, $admin_token, $config_port); $flash_msg = $code === 200 ? 'MUA wird neu gestartet.' : 'Neustart fehlgeschlagen (HTTP ' . $code . ').' . (is_string($result['error'] ?? null) ? ' ' . $result['error'] : ''); $flash_type = $code === 200 ? 'ok' : 'err'; } elseif ($payload !== null) { [$code, $result] = mua_api('POST', '/config', $payload, $admin_token, $config_port); if ($code === 200 && is_array($result) && ($result['ok'] ?? false)) { $new_api_key = $result['generatedApiKey'] ?? ''; $flash_msg = $action === 'save_tls' ? 'TLS-Einstellungen geprüft und gespeichert. Zum Anwenden Dienst ausdrücklich neu starten.' : ($new_api_key ? 'Neuer API-Key erzeugt. Jetzt kopieren – er wird nur dieses eine Mal angezeigt.' : 'Sicherheitseinstellungen gespeichert.'); $flash_type = 'ok'; [$config_code, $config] = mua_api('GET', '/config', null, $admin_token, $config_port); $config_ok = $config_code === 200 && is_array($config); } else { $flash_msg = 'Speichern fehlgeschlagen (HTTP ' . $code . ').' . ($action === 'save_tls' && is_string($result['error'] ?? null) ? ' ' . $result['error'] : ''); $flash_type = 'err'; } } } } $transport = is_array($config['transport'] ?? null) ? $config['transport'] : []; $tls = is_array($transport['tls'] ?? null) ? $transport['tls'] : []; $tls_locked = !$config_ok || !empty($transport['envOverride']); $enabled_tools = $config['enabledTools'] ?? []; $all_tools_enabled = (bool)($config['allToolsEnabled'] ?? false); $all_tools = $config['allTools'] ?? []; $toolbox = is_array($config['toolbox'] ?? null) ? $config['toolbox'] : []; $toolbox_available = (bool)($toolbox['available'] ?? false); $toolbox_enabled = (bool)($toolbox['enabled'] ?? false); $toolbox_containers = is_array($toolbox['containers'] ?? null) ? $toolbox['containers'] : []; $risk_groups = ['read' => [], 'active' => [], 'write' => [], 'critical' => []]; foreach ($all_tools as $tool) { if (!is_array($tool)) $tool = ['name' => $tool, 'description' => '', 'risk' => 'read']; $risk = $tool['risk'] ?? 'read'; if (!isset($risk_groups[$risk])) $risk = 'read'; $risk_groups[$risk][] = $tool; } $risk_labels = [ 'read' => ['Nur Lesen', 'Liest Status und Diagnoseinformationen.', 'mua-risk-safe'], 'active' => ['Aktive Prüfungen', 'Baut gezielt Netzwerkverbindungen für Tests auf.', 'mua-risk-notice'], 'write' => ['Betrieb steuern', 'Startet, stoppt oder startet Container neu.', 'mua-risk-warn'], 'critical' => ['Kritischer Zugriff', 'Verändert Container oder führt uneingeschränkte Root-Befehle aus.', 'mua-risk-danger'], ]; $active_count = $all_tools_enabled ? count($all_tools) : count($enabled_tools); ?>

MUA · Mikes Unraid Agent

Sicherer MCP-Zugriff auf Docker, Netzwerk und Unraid-Systemfunktionen
Neuer API-Key – einmalige Anzeige

Dienst

Version · PID

Zugriffsprofil

von Werkzeugen aktiv

Authentifizierung

MCP-Endpunkt

Streamable HTTP · JSON-RPC 2.0 · Bearer-Authentifizierung erforderlich

HTTPS / TLS

Aktiver Transport: . TLS schützt denselben MCP-Port inklusive /health; Bearer-Key und Toolfreigaben bleiben unverändert.

Gespeicherte Einstellungen sind noch nicht aktiv. Nach Prüfung Dienst ausdrücklich neu starten.

Durch Umgebungsvariablen verwaltet; WebGUI-Änderung gesperrt.

>TLS-Konfiguration

Nur Pfade, keine Schlüssel hochladen/einfügen. Bei einem bestehenden Unraid-WebGUI-Bundle dürfen beide Pfade auf dieselbe ausdrücklich ausgewählte Datei zeigen; keine automatische Kandidatensuche. Nur den öffentlichen Zertifikatsteil zum Client übertragen, niemals das Bundle. Dateien müssen beim Boot bereits lesbar sein. Clients benötigen die passende CA und einen Hostnamen/IP im Zertifikat-SAN; die angezeigte Server-IP gegebenenfalls durch den Zertifikat-DNS-Namen ersetzen. Zertifikatserneuerung erfordert Prüfung und Neustart. Verwaltung bleibt HTTP auf 127.0.0.1:. Lokale Bereitschaft ist kein Client-Trust-Test.

Agent-Werkzeugcontainer

✅ Gefunden: $container): ?> ()

Kein Werkzeugcontainer erkannt

Schnelle Sicherheitsprofile

„Nur Lesen“ ist die empfohlene Dauerstellung. Weitergehende Rechte nur bei konkretem Bedarf freigeben.

">

Werkzeuge im Detail

$tools): $meta=$risk_labels[$risk]; ?>

API-Key

Der vollständige Schlüssel wird nicht dauerhaft angezeigt. Beim Erzeugen erscheint er genau einmal; danach ist nur noch die Endung sichtbar.

Technische Details

Version
MCP-Port
Verwaltung127.0.0.1: · separater Admin-Token
Konfiguration/boot/config/plugins/mua/mua.conf
Audit-Protokoll/var/log/plugins/mua-audit.log (keine Argumente oder Inhalte)