From ce66a84c8d372237fc24df705799b7bcd3536d24 Mon Sep 17 00:00:00 2001 From: boban Date: Sun, 26 Apr 2026 21:19:26 +0200 Subject: [PATCH] Fix: ClamAV wird beim Update automatisch installiert, UI nur Ein/Aus ensure_system() installiert clamav-daemon falls nicht vorhanden, deaktiviert aber den Dienst. User sieht nur noch Ein/Ausschalten. Install-Button, $installed-Property und install()-Methode entfernt. Co-Authored-By: Claude Sonnet 4.6 --- app/Livewire/Ui/Security/ClamavManager.php | 18 ---------------- .../ui/security/clamav-manager.blade.php | 21 ------------------- scripts/update.sh | 11 ++++++++++ 3 files changed, 11 insertions(+), 39 deletions(-) diff --git a/app/Livewire/Ui/Security/ClamavManager.php b/app/Livewire/Ui/Security/ClamavManager.php index 01547f8..87d18b9 100644 --- a/app/Livewire/Ui/Security/ClamavManager.php +++ b/app/Livewire/Ui/Security/ClamavManager.php @@ -10,7 +10,6 @@ use Livewire\Component; #[Title('Virenschutz · Mailwolt')] class ClamavManager extends Component { - public bool $installed = false; public bool $running = false; public bool $enabled = false; public string $dbDate = '—'; @@ -18,7 +17,6 @@ class ClamavManager extends Component public ?int $ramMb = null; public string $lastError = ''; public string $lastSuccess = ''; - public bool $installing = false; public bool $starting = false; public int $startSecs = 0; @@ -52,26 +50,10 @@ class ClamavManager extends Component $this->lastSuccess = ''; $this->running = $this->serviceActive(); $this->enabled = $this->serviceEnabled(); - $this->installed = $this->isInstalled(); $this->ramMb = $this->running ? $this->readRamMb() : null; [$this->dbDate, $this->dbVersion] = $this->readDbInfo(); } - public function install(): void - { - $this->installing = true; - $out = []; - @exec('sudo -n /usr/local/sbin/mailwolt-clamav install 2>&1', $out, $rc); - $this->installing = false; - if ($rc !== 0) { - $this->lastError = implode(' ', $out) ?: 'Installation fehlgeschlagen.'; - } else { - $this->dispatch('toast', type: 'success', badge: 'ClamAV', - title: 'Installiert', text: 'ClamAV wurde installiert. Sie können ihn jetzt aktivieren.'); - } - $this->refresh(); - } - public function enable(): void { $this->lastError = ''; diff --git a/resources/views/livewire/ui/security/clamav-manager.blade.php b/resources/views/livewire/ui/security/clamav-manager.blade.php index a34ecde..8e95c6a 100644 --- a/resources/views/livewire/ui/security/clamav-manager.blade.php +++ b/resources/views/livewire/ui/security/clamav-manager.blade.php @@ -47,26 +47,6 @@
- @if(!$installed) -
-
-
-
-
-
ClamAV nicht installiert
-
Paket clamav clamav-daemon fehlt.
-
-
- -
-
- - @else
{{-- Status-Zeile --}} @@ -137,7 +117,6 @@
- @endif diff --git a/scripts/update.sh b/scripts/update.sh index 398fa55..32dc92b 100644 --- a/scripts/update.sh +++ b/scripts/update.sh @@ -253,6 +253,17 @@ UNIT systemctl start mailwolt-ws echo "[✓] mailwolt-ws Service gestartet." fi + + # ClamAV installieren falls nicht vorhanden (läuft deaktiviert, User schaltet ein/aus) + if ! dpkg -l clamav-daemon 2>/dev/null | grep -q '^ii'; then + echo "[…] ClamAV wird installiert…" + DEBIAN_FRONTEND=noninteractive apt-get install -y clamav clamav-daemon clamav-freshclam 2>&1 | sed 's/^/ /' + systemctl enable clamav-freshclam 2>/dev/null || true + systemctl start clamav-freshclam 2>/dev/null || true + systemctl disable clamav-daemon 2>/dev/null || true + systemctl stop clamav-daemon 2>/dev/null || true + echo "[✓] ClamAV installiert (deaktiviert – User kann es einschalten)." + fi } # -------- Guards --------------------------------------------------------------