Rechtebechebung für User mit Sudorechte

main
boban 2025-10-19 18:46:53 +02:00
parent 98ccb68a34
commit 28129cb989
1 changed files with 16 additions and 2 deletions

View File

@ -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)) {