Revert: Sysmail-Auto-Provisionierung entfernt – war konzeptionell falsch
Sysmail wird nur für die Server-eigene Domain beim Setup angelegt, nicht für User-Domains. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>main v1.1.363
parent
50a68047fc
commit
8ff63dd966
|
|
@ -4,7 +4,6 @@ namespace App\Observers;
|
||||||
|
|
||||||
use App\Models\DkimKey;
|
use App\Models\DkimKey;
|
||||||
use App\Models\Domain;
|
use App\Models\Domain;
|
||||||
use App\Models\MailUser;
|
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
use Illuminate\Support\Facades\Process;
|
use Illuminate\Support\Facades\Process;
|
||||||
|
|
||||||
|
|
@ -18,11 +17,6 @@ class DomainObserver
|
||||||
{
|
{
|
||||||
if ($domain->is_server) return;
|
if ($domain->is_server) return;
|
||||||
|
|
||||||
// Auto-create sysmail subdomain for every new user domain
|
|
||||||
if (!$domain->is_system) {
|
|
||||||
$this->provisionSysmail($domain);
|
|
||||||
}
|
|
||||||
|
|
||||||
$selector = (string) config('mailpool.defaults.dkim_selector', 'mwl1');
|
$selector = (string) config('mailpool.defaults.dkim_selector', 'mwl1');
|
||||||
$bits = (int) config('mailpool.defaults.dkim_bits', 2048);
|
$bits = (int) config('mailpool.defaults.dkim_bits', 2048);
|
||||||
|
|
||||||
|
|
@ -46,45 +40,6 @@ class DomainObserver
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function provisionSysmail(Domain $domain): void
|
|
||||||
{
|
|
||||||
try {
|
|
||||||
$sysmailFqdn = 'sysmail.' . $domain->domain;
|
|
||||||
|
|
||||||
$sysmailDomain = Domain::firstOrCreate(
|
|
||||||
['domain' => $sysmailFqdn],
|
|
||||||
[
|
|
||||||
'is_active' => true,
|
|
||||||
'is_system' => true,
|
|
||||||
'max_mailboxes' => 2,
|
|
||||||
'max_aliases' => 20,
|
|
||||||
'default_quota_mb' => 512,
|
|
||||||
'max_quota_per_mailbox_mb' => 2048,
|
|
||||||
'total_quota_mb' => 2048,
|
|
||||||
'rate_limit_per_hour' => 600,
|
|
||||||
'description' => 'System-Maildomäne für ' . $domain->domain,
|
|
||||||
]
|
|
||||||
);
|
|
||||||
|
|
||||||
MailUser::firstOrCreate(
|
|
||||||
['domain_id' => $sysmailDomain->id, 'localpart' => 'sysmail'],
|
|
||||||
[
|
|
||||||
'email' => 'sysmail@' . $sysmailFqdn,
|
|
||||||
'display_name' => 'System Mail',
|
|
||||||
'password_hash' => null,
|
|
||||||
'is_system' => true,
|
|
||||||
'is_active' => true,
|
|
||||||
'can_login' => false,
|
|
||||||
'quota_mb' => 512,
|
|
||||||
]
|
|
||||||
);
|
|
||||||
|
|
||||||
Log::info('Sysmail domain provisioned', ['sysmail' => $sysmailFqdn, 'for' => $domain->domain]);
|
|
||||||
} catch (\Throwable $e) {
|
|
||||||
Log::error('Sysmail provisioning failed', ['domain' => $domain->domain, 'error' => $e->getMessage()]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Beim Löschen alle DKIM-Selector dieser Domain aus OpenDKIM entfernen.
|
* Beim Löschen alle DKIM-Selector dieser Domain aus OpenDKIM entfernen.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue