From 28129cb989f8ae1726f5530eeeef49fb5190b0ad Mon Sep 17 00:00:00 2001 From: boban Date: Sun, 19 Oct 2025 18:46:53 +0200 Subject: [PATCH] =?UTF-8?q?Rechtebechebung=20f=C3=BCr=20User=20mit=20Sudor?= =?UTF-8?q?echte?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/DkimService.php | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/app/Services/DkimService.php b/app/Services/DkimService.php index 80636bb..d63ec7a 100644 --- a/app/Services/DkimService.php +++ b/app/Services/DkimService.php @@ -17,9 +17,12 @@ class DkimService { $selector = $selector ?: (string) config('mailpool.defaults.dkim_selector', 'mwl1'); - $dirKey = $this->safeKey($domain->domain); - $selKey = $this->safeKey($selector, 32); +// $dirKey = $this->safeKey($domain->domain); +// $selKey = $this->safeKey($selector, 32); + $dirKey = $this->dirKeyFor($domain); + $selKey = preg_replace('/[^A-Za-z0-9._-]/', '_', substr($selector, 0, 32)); // schlicht & stabil + // Disk "local" zeigt bei dir auf storage/app/private (siehe Kommentar in deinem Code) $disk = Storage::disk('local'); $baseRel = "dkim/{$dirKey}"; @@ -145,6 +148,17 @@ class DkimService ]; } + protected function dirKeyFor(Domain $domain, int $max = 64): string + { + $raw = $domain->domain; // <<< WICHTIG: Domain-String, NICHT die ID! + $san = preg_replace('/[^A-Za-z0-9._-]/', '_', $raw); + if ($san === '') $san = 'unknown'; + if (strlen($san) > $max) { + $san = substr($san, 0, $max - 13) . '_' . substr(sha1($raw), 0, 12); + } + return $san; + } + protected function safeKey($value, int $max = 64): string { if (is_object($value)) {